Quote:
Originally Posted by fysiks
First off, you have an odd number of braces. You end your function half way through the posted code.
g_num will blow up (i.e. go to infinity)
I think you should use something like this:
PHP Code:
new g_punish[33][2]
public client_putinserver(id)
{
g_punish[id][0] = 0 // Number of Punishes?
g_punish[id][1] = get_timeleft() // Timeleft at last punish
}
And if your playerpunish function is supposed to be for a single player (which seems to be because of punishPlayer(id)) you should use g_punish[id][#] when getting or setting the info.
Also, no where in your code do you use "authID". authID will be something like: STEAM_0:1:132334.
Also,
PHP Code:
server_cmd("amx_slap #%d %d",name,5)
server_cmd("amx_slap #%d %d",id,40)
are used incorrectly.
Use one of:
PHP Code:
server_cmd("amx_slap %s %d",name,5)
server_cmd("amx_slap #%d %d",userid,40)
where userid = get_user_userid(id)
EDIT:
Ok, I came up with something. You can check it out in the attached file. Basically with my code: if a player is punished 4 times within 5 minutes they get banned. If they don't get banned in that 5 minutes punishes and the time is reset.
|
normally this should do the trick but it isn't working
i mean that from some reasons the g_punish[id][0] ( nr of punishments ) goes crazy and is still rising
i think that it could be done by this
PHP Code:
public checkOrigin() { // tu sprawdza czy rashujesz
if (round_start<1) return
if (get_gametime() > g_time)
{
free_the_world()
return
}
new players[32], num,tt_num,ct_num
get_players(players,num)
for(new i=0;i<num;i++)
{
if(is_user_alive(players[i]))
{
if(cs_get_user_team(players[i])==CS_TEAM_T) tt_num++
else if(cs_get_user_team(players[i])==CS_TEAM_CT) ct_num++
}
}
if (tt_num<MIN_PLAYERS)
{
free_the_world()
return
}
if (ct_num<MIN_PLAYERS)
{
free_the_world()
return
}
get_players(players,num)
set_task(TEST_TIME, "checkOrigin", TASK_LOOP)
for(new i = 0; i < num; i++)
{
if(is_user_alive(players[i]))
{
if((equal(g_team,"T")&&(cs_get_user_team(players[i])==CS_TEAM_T))||(equal(g_team,"CT")&&(cs_get_user_team(players[i])==CS_TEAM_CT))||equal(g_team,"XX"))
{
get_user_origin(players[i],g_origin)
if ((map_cors_origin[0] < g_origin[0] < map_cors_origin[1]) && (map_cors_origin[2] < g_origin[1] < map_cors_origin[3]) && (map_cors_origin[4] < g_origin[2] < map_cors_origin[5]) ||
(map_cors_origin[6] < g_origin[0] < map_cors_origin[7]) && (map_cors_origin[8] < g_origin[1] < map_cors_origin[9]) && (map_cors_origin[10] < g_origin[2] < map_cors_origin[11]) ||
(map_cors_origin[12] < g_origin[0] < map_cors_origin[13]) && (map_cors_origin[14] < g_origin[1] < map_cors_origin[15]) && (map_cors_origin[16] < g_origin[2] < map_cors_origin[17]) ||
(map_cors_origin[18] < g_origin[0] < map_cors_origin[19]) && (map_cors_origin[20] < g_origin[1] < map_cors_origin[21]) && (map_cors_origin[22] < g_origin[2] < map_cors_origin[23]) ||
(map_cors_origin[24] < g_origin[0] < map_cors_origin[25]) && (map_cors_origin[26] < g_origin[1] < map_cors_origin[27]) && (map_cors_origin[28] < g_origin[2] < map_cors_origin[29]) ||
(map_cors_origin[30] < g_origin[0] < map_cors_origin[31]) && (map_cors_origin[32] < g_origin[1] < map_cors_origin[33]) && (map_cors_origin[34] < g_origin[2] < map_cors_origin[35])){
punishPlayer(players[i])
raszer[players[i]]=1
}
else{
free_the_man(players[i])
}
}
}
}
}
any ideas?

thanks for all of the help