Thread: Handicap Mod
View Single Post
organizedKaoS
Senior Member
Join Date: Feb 2006
Old 11-02-2006 , 12:02   Re: Handicap Mod
Reply With Quote #6

Rolnaaba....I found the problem for your 2nd version not setting health.

You were using the hltv event to call the new round function.

While it was printing the chat text saying your health will be set, it was calling it too soon and wasn't able to set a users health.

Heres the edited working script which I have confirmed now sets health.

Code:
#include <amxmodx> #include <amxmisc> #include <fun> new PlayerFrags[33] new bool:PlayerDied[33] public plugin_init() {     register_plugin("Handicap Mod2", "2.0", "Rolnaaba")     register_event("DeathMsg", "Event_Death", "a")     register_logevent("Event_RoundEnd", 2, "1=Round_End")     register_cvar("amx_1sthealth", "80")     register_cvar("amx_2ndhealth", "60")     register_cvar("amx_3rdhealth", "40") } public Event_Death()     {       new killer = read_data(1)     new victim = read_data(2)         if(!PlayerDied[victim])         {         PlayerDied[victim] = true         PlayerFrags[victim] = 0     }     if(PlayerDied[killer])         {         PlayerDied[killer] = false     }         PlayerFrags[killer]++ } public Event_RoundEnd()     {     new Players[32], playerCount, i, id     get_players(Players, playerCount, "c")     for(i=0;i<playerCount;i++)         {         id = Players[i]         set_task(5.0, "Do_Health", id)     } } public Do_Health(id)     {       if(is_user_connected(id) && !PlayerDied[id])         {         if(PlayerFrags[id] >= 3 && PlayerFrags[id] <= 5)             {             new health = get_cvar_num("amx_1sthealth")                                      set_user_health(id, health)             client_print(id, print_chat, "Your health will be set to %iHP for having %i kills in a row", health, PlayerFrags[id])         }         else if(PlayerFrags[id] >= 6 && PlayerFrags[id] <= 8)             {             new health = get_cvar_num("amx_2ndhealth")                          set_user_health(id, health)             client_print(id, print_chat, "Your health will be set to %iHP for having %i kills in a row", health, PlayerFrags[id])         }         else if(PlayerFrags[id] >= 9)             {             new health = get_cvar_num("amx_3rdhealth")                          set_user_health(id, health)             client_print(id, print_chat, "Your health will be set to %iHP for having %i kills in a row", health, PlayerFrags[id])         }     } }
organizedKaoS is offline