Chcialbym prosic o modyfikacje pluginu, by po wpisaniu w sayu /speed uzytkownik kupowal szybkosc (plugin ponizej)
#include <amxmodx> #include <fakemeta> #include <hamsandwich> #include <zombieplague> const TASK_SPEED_BOOST = 100 #define ID_SPEED_BOOST (taskid - TASK_SPEED_BOOST) // Hack to be able to use Ham_Player_ResetMaxSpeed (by joaquimandrade) new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame new g_itemid_boost new cvar_boost_amount new cvar_boost_duration new g_has_speed_boost[33] public plugin_init() { register_plugin("[ZP] Extra Item Speed Boost", "1.2", "MeRcyLeZZ") g_itemid_boost = zp_register_extra_item("Przyspieszenie", 2000, ZP_TEAM_HUMAN | ZP_TEAM_ZOMBIE) cvar_boost_amount = register_cvar("zp_boost_amount", "100.0") cvar_boost_duration = register_cvar("zp_boost_duration", "5.0") RegisterHam(Ham_Player_ResetMaxSpeed, "player", "fw_ResetMaxSpeed_Post", 1) RegisterHam(Ham_Killed, "player", "fw_PlayerKilled") register_event("HLTV", "event_round_start", "a", "1=0", "2=0") } public zp_extra_item_selected(player, itemid) { if (itemid == g_itemid_boost) { // Player frozen (or CS freezetime) if (pev(player, pev_maxspeed) <= 1) { client_print(player, print_chat, "[ZM] Nie mozesz uzywac gdy jestes zamrozony") return ZP_PLUGIN_HANDLED; } // Already using speed boost if (g_has_speed_boost[player]) { client_print(player, print_chat, "[ZM] Kupiles juz Przyspieszenie.") return ZP_PLUGIN_HANDLED; } // Enable speed boost g_has_speed_boost[player] = true client_print(player, print_chat, "[ZM] Przyspieszenie aktywne!") // Set the restore speed task set_task(get_pcvar_float(cvar_boost_duration), "restore_maxspeed", player+TASK_SPEED_BOOST) // Update player's maxspeed ExecuteHamB(Ham_Player_ResetMaxSpeed, player) } return PLUGIN_CONTINUE; } public restore_maxspeed(taskid) { // Disable speed boost g_has_speed_boost[ID_SPEED_BOOST] = false client_print(ID_SPEED_BOOST, print_chat, "[ZM] Przyspieszenie nieaktywne.") // Update player's maxspeed ExecuteHamB(Ham_Player_ResetMaxSpeed, ID_SPEED_BOOST) } // Remove speed boost task when infected, humanized, killed, or disconnected public zp_user_infected_pre(id, infector, nemesis) { g_has_speed_boost[id] = false remove_task(id+TASK_SPEED_BOOST) } public zp_user_humanized_pre(id, survivor) { g_has_speed_boost[id] = false remove_task(id+TASK_SPEED_BOOST) } public fw_PlayerKilled(victim) { g_has_speed_boost[victim] = false remove_task(victim+TASK_SPEED_BOOST) } public client_disconnect(id) { g_has_speed_boost[id] = false remove_task(id+TASK_SPEED_BOOST) } // Remove speed boost at round start public event_round_start() { new id for (id = 1; id <= get_maxplayers(); id++) { g_has_speed_boost[id] = false remove_task(id+TASK_SPEED_BOOST) } } public fw_ResetMaxSpeed_Post(id) { if (!is_user_alive(id) || !g_has_speed_boost[id]) return; // Apply speed boost new Float:current_maxspeed pev(id, pev_maxspeed, current_maxspeed) set_pev(id, pev_maxspeed, current_maxspeed + get_pcvar_float(cvar_boost_amount)) }
Użytkownik VirusX edytował ten post 21.07.2011 15:06