Code:
/* AMX Mod script.
*
* (c) Copyright 2002, SuicideDog
*
* Plugin changes map when teams are lopsided and
* one side gets skunked
*
* Code gleemed for OLO'S Win Limit plugin
* This file is provided as is (no warranties).
*
*/
#include <amxmodx>
new ct_score = 0
new terrorist_score = 0
new Float:last_timelimit
new winlimit
public change_map(){
last_timelimit = get_cvar_float("mp_timelimit")
set_cvar_float("mp_timelimit",0.01)
}
public back_timelimit()
set_cvar_float("mp_timelimit",last_timelimit)
public new_round(){
winlimit = get_cvar_num("amx_skunk")
set_hudmessage(200, 100, 0, 0.05, 0.5, 0, 6.0, 6.0, 0.5, 0.15, 4)
if (ct_score == winlimit && terrorist_score == 0){
set_task(4.0,"change_map")
show_hudmessage(0,"CT's have SKUNKED T's with score of %d to %d^nChanging map...",ct_score,terrorist_score)
}
else if (terrorist_score == winlimit && ct_score == 0){
set_task(4.0,"change_map")
show_hudmessage(0,"T's have SKUNKED CT's with score of %d to %d^nChanging map...",terrorist_score,ct_score)
}
return PLUGIN_CONTINUE
}
public team_score(){
new team[2]
read_data(1,team,1)
if (team[0]=='C')
ct_score = read_data(2)
else if (team[0]=='T')
terrorist_score = read_data(2)
return PLUGIN_CONTINUE
}
public plugin_init(){
register_plugin("Skunkage","0.2","SuicideDog")
register_event("TeamScore", "team_score", "a")
register_event("RoundTime", "new_round", "bc")
register_event("30", "back_timelimit", "a")
register_cvar("amx_skunk","7")
return PLUGIN_CONTINUE
}
In the first part he is declaring new variables. The first two are set to 0. The third is a float which is a number with a decimal in it. The last, winlimit, is empty at this point.
Next, he declares the function change_map which stores the current time limit to "last_timelimit", and then changes the time limit to 0.01 seconds. The next function sets the time limit back to default.
Under the new_round function he sets winlimit to amx_skunk which is registered below as 7. I know nothing about the hud message formatting (I'll work on that later). Then if the ct_score equals the win limit and the t score equals 0, show the hud mesage globally and then run the change_map in 4 seconds. If not, then check the opposite. If neither are true then keep checking until one or the other becomes true.
In the team_score function he defines a new array named team which holds two numbers. The next part totally looses me
Code:
read_data(1,team,1)
if (team[0]=='C')
ct_score = read_data(2)
else if (team[0]=='T')
terrorist_score = read_data(2)
return PLUGIN_CONTINUE
}
Could I trouble someone to explain to me the last part? I would greatly appreciate it.