AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with using command once per round (https://forums.alliedmods.net/showthread.php?t=24866)

LittleDude 03-03-2006 22:44

Help with using command once per round
 
Alright, I got my plugin, and there's 1 last thing I want to add, and that is that you can only use the command once. When you use it, and get back to down to below 50 health, you can do the command again, I wanna limit it to 1 timer per every round, or 1 time per every 5 rounds, if thats possible. Maybe even like 1 per 15 min. My plugin is:

Code:
 /* Plugin generated by AMXX-Studio */ /* Credits: Kensai: helping me fix bugs and getting it working. Kraugh: helping me figure out how to reset model at player_spawn [ --<-@ ] Black Rose: helped me get the reset model at player_spawn to work */ #include <amxmodx> #include <amxmisc> #include <fun> #include <cstrike> #define PLUGIN "GorillaMode" #define VERSION "1.0" #define AUTHOR "LittleDude" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_event("ResetHUD","player_spawn","b");     register_clcmd("fullupdate","block");     set_task(60.0, "notify", 0, "", 0, "b")     register_clcmd("say /gorillame", "gorillathem")     register_clcmd("say_team /gorillame", "gorillathem")     register_cvar("amx_gorilla", "1") } public plugin_precache(){     precache_model("models/player/gorilla/gorilla.mdl")     return PLUGIN_CONTINUE } public gorillathem(id){     if(get_cvar_num("amx_gorilla") == 0)         return PLUGIN_HANDLED         if(!is_user_alive(id)){         client_print(id, print_chat, "[Gorilla] You are dead and cannot go Gorilla Mode!")         return PLUGIN_HANDLED     }         new health = get_user_health(id)         if(is_user_alive(id) && health >= 50){         client_print(id, print_chat, "[Gorilla] You have too much health to turn Gorilla Mode!")         return PLUGIN_HANDLED             }     else if(health < 50){         set_user_health(id, 250)         set_user_armor(id, 250)         give_item(id, "weapon_m249")         give_item(id, "ammo_556natobox")         give_item(id, "ammo_556natobox")         give_item(id, "ammo_556natobox")         give_item(id, "ammo_556natobox")         give_item(id, "ammo_556natobox")         give_item(id, "ammo_556natobox")         give_item(id, "ammo_556natobox")         give_item(id, "ammo_556natobox")         cs_set_user_model(id, "gorilla")             }         client_print(id, print_chat, "[Gorilla] You have gone Gorilla Mode!")     return PLUGIN_HANDLED } public notify(){     if(get_cvar_num("amx_gorilla") == 1)             client_print(0, print_chat, "[Gorilla] Gorilla Mode is running!")     return PLUGIN_HANDLED } public player_spawn(id) {     new model[32]     cs_get_user_model(id,model,31)         if(equali(model,"gorilla"))         cs_reset_user_model(id) } public block(id) {     return PLUGIN_HANDLED }

Xanimos 03-03-2006 23:00

use
Code:
//...global variable (add it after includes) new PlayerUses[33] //...in plugin_init()     register_logevent( "Event_RoundStart", 2, "0=World triggered", "1=Round_Start" ) //...or depending on when you want it     register_logevent( "Event_RoundEnd",   2, "0=World triggered", "1=Round_End" ) //....make a function Event_RoundStart or Even_RoundEnd depending on when you want it.     for( new i = 0 ; i <=32 ; i++)          PlayerUses[i] = 0; //reset counter //.....add this where the command is done     if(PlayerUses[id] >= 1)         return PLUGIN_HANDLED     PlayerUses[id]++;


All times are GMT -4. The time now is 20:24.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.