|
Форум Counter-Strike 1.6 Сервер Counter-Strike 1.6 Вопросы по настройке Как купить лишний предмет в начале круглая? |
Как купить лишний предмет в начале круглая? |
Дата: Среда, 07.02.2018, 09:39 | Сообщение # 1
Дух ( Новичок )
Offline
![]()
Код /* Changelog: v1.0 - First Release v1.1 - Added bind function. v1.2 - Added some special effects, fixed 2 bugs, added cooldown To use teleport bind a key. Example: bind "key" teleport. (bind f teleport) WARNING:To prevent bugs do not teleport to sky. */ #include <amxmodx> #include <fun> #include <zombieplague> new const PLUGIN_NAME[] = " [ZP]Teleport_2" new const PLUGIN_VERSION[] = "1.2" new const PLUGIN_AUTHOR[] = "NiHiLaNTh" // Item ID new g_teleport; // Game Variables new bool:hasTeleport[33]; new teleport_counter; new Float:g_lastusetime[33]; // CVAR Pointers new pcv_teleport_limit, pcv_teleport_cooldown; // Sprite Index new BubbleSprite; // Plugin Initialization public plugin_init() { // Plugin Call register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR); // Client Command register_clcmd("teleport", "ActivateTeleport"); // Register new extra item g_teleport = zp_register_extra_item("Teleport_2", 10, ZP_TEAM_HUMAN); // CVARs pcv_teleport_limit = register_cvar("zp_teleport_limit2", "5"); pcv_teleport_cooldown = register_cvar("zp_teleport_cooldown2", "10"); } // Precache Files public plugin_precache() { // Teleport Sound precache_sound("zombie_plague/spark6.wav"); // Sprite BubbleSprite = precache_model("sprites/blueflare2.spr"); } // New round started - remove all teleports zp_round_started(gamemode, id) { if (hasTeleport[id]) return PLUGIN_CONTINUE; } // Player bought our item... public zp_extra_item_selected(owner, itemid) { if (itemid == g_teleport) { if (hasTeleport[owner]) { client_print(owner, print_center, "Already own this item."); hasTeleport [owner]= false; } else { hasTeleport [owner]= true; teleport_counter = 0; client_print(owner, print_chat, " [ZP]To use teleport bind a key(bind f teleport)"); } } } // Activate Teleport public ActivateTeleport(id) { // For some reason zombie or survivor or nemesis has teleport if (zp_get_user_zombie(id) || zp_get_user_survivor(id) || zp_get_user_nemesis(id)) return PLUGIN_CONTINUE; // Check if player has bought teleport if (!hasTeleport[id]) { client_print(id, print_center, "Buy teleport first"); return PLUGIN_CONTINUE; } // Teleport cooldown not over if (get_gametime() - g_lastusetime [id]< get_pcvar_float(pcv_teleport_cooldown)) { client_print(id, print_center, "You must wait a bit."); return PLUGIN_CONTINUE; } // Get old and new location new OldLocation[3], NewLocation[3]; // Get current players location get_user_origin(id, OldLocation); // Get location where player is aiming(where he will be teleported) get_user_origin(id, NewLocation, 3); // Create bubbles in a place where player teleported // First, get user origin new UserOrigin[3]; get_user_origin(id, UserOrigin); // Now create bubbles new BubbleOrigin[3]; BubbleOrigin[0] = UserOrigin[0]; BubbleOrigin[1] = UserOrigin[1]; BubbleOrigin[2] = UserOrigin[2] + 40; message_begin(MSG_BROADCAST, SVC_TEMPENTITY) write_byte(TE_SPRITETRAIL) // TE ID write_coord(BubbleOrigin[0]) // Start Position X write_coord(BubbleOrigin[1]) // Start Position Y write_coord(BubbleOrigin[2]) // Start Position Z write_coord(UserOrigin[0]) // End Position X write_coord(UserOrigin[1]) // End Position Y write_coord(UserOrigin[2]) // End Position Z write_short(BubbleSprite) // Sprite Index write_byte(30) // Count write_byte(10) // Life write_byte(1) // Scale write_byte(50) // Velocity Along Vector write_byte(10) // Rendomness of Velocity message_end(); // Increase teleport counter teleport_counter++ // Play needed sound emit_sound(id, CHAN_STATIC, "warcraft3/blinkarrival.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM); // Player cannot stuck in the wall/floor NewLocation[0] += ((NewLocation[0] - OldLocation[0] > 0) ? -50 : 50); NewLocation[1] += ((NewLocation[1] - OldLocation[1] > 0) ? -50 : 50); NewLocation[2] += 40; // Teleport player set_user_origin(id, NewLocation); // Set current teleport use time g_lastusetime [id]= get_gametime(); // Check if user has reached limit new teleport_limit = get_pcvar_num(pcv_teleport_limit); if (teleport_counter == teleport_limit) { hasTeleport [id]= false; } return PLUGIN_CONTINUE; } Удалил это: Код // New round started - remove all teleports zp_round_started(gamemode, id) { if (hasTeleport[id]) return PLUGIN_CONTINUE; } Но не покупается все-равно. Что ему требуется прописать? |
Дата: Среда, 07.02.2018, 16:57 | Сообщение # 2
Дух ( Новичок )
Offline
![]()
Это удалять не надо, он отключает все телепорты в с того раунда
Код // New round started - remove all teleports zp_round_started(gamemode, id) { if (hasTeleport[id]) return PLUGIN_CONTINUE; } У тебя есть два пути, или в кваре поставить 0 Код pcv_teleport_cooldown = register_cvar("zp_teleport_cooldown2", "10"); Код // Teleport cooldown not over if (get_gametime() - g_lastusetime [id]< get_pcvar_float(pcv_teleport_cooldown)) { client_print(id, print_center, "You must wait a bit."); return PLUGIN_CONTINUE; }
Сообщение отредактировал adik71rus3 - Среда, 07.02.2018, 16:58
|
Дата: Пятница, 09.02.2018, 10:58 | Сообщение # 3
Дух ( Новичок )
Offline
![]()
У меня есть сомнения по поводу кулдауна. Либо имеется ввиду кулдаун в прямом смысле, на использование предмета. Либо кулдаун для выдачи предмета в начале раунда.
Но я сделал и так и так, это не работает. Пишет Buy Teleport First. В самом начале раунда в первую секунду его купить нельзя, а мне нужно только так.
Сообщение отредактировал Ritard - Пятница, 09.02.2018, 10:59
|
| |||
| |||