AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   problem with team checking/setting (https://forums.alliedmods.net/showthread.php?t=28728)

shino 05-21-2006 09:49

problem with team checking/setting
 
so, i made this code:

Code:
public round_start() {     set_task(0.4,"SetZombieBotCheck") } public SetZombieBotCheck(players[]) {     new players[32],num,i     get_players(players,num)     for(i = 0; i <= num; i++) {         new id = players[i]         if (is_user_connected(id) && is_user_alive(id)) {             if (cs_get_user_team(id) == CS_TEAM_T) {                 cs_set_user_team(id,CS_TEAM_CT)             }         }         if (is_user_bot(id) && is_user_alive(id)) {             if (cs_get_user_team(id) == CS_TEAM_CT) {                 cs_set_user_team(id,CS_TEAM_T)                 set_cvar_num("sv_restartround", 1)             }         }     } }

in play, if i join CT team and one bot is with me and one at T team, bot in CT team doesn't get thrown to Ts. if i go to T team, i don't get thrown to CTs. so i think that it might be a problem in code, and if someone could help me.

thanks!

Hawk552 05-21-2006 11:13

Try this:

Code:
public round_start() {     set_task(0.4,"SetZombieBotCheck") } public SetZombieBotCheck(players[]) {     new players[32],num,i     get_players(players,num)     for(i = 0; i <= num; i++) {         new id = players[i]         if (is_user_alive(id) && !is_user_bot(id)) {             if (cs_get_user_team(id) == CS_TEAM_T) {                 cs_set_user_team(id,CS_TEAM_CT)             }         }         if (is_user_bot(id) && is_user_alive(id)) {             if (cs_get_user_team(id) == CS_TEAM_CT) {                 cs_set_user_team(id,CS_TEAM_T)                 set_cvar_num("sv_restartround", 1)             }         }     } }

v3x 05-21-2006 12:09

Code:
public round_start() {     set_task(0.4,"SetZombieBotCheck") } public SetZombieBotCheck(/* players[] */) {     new players[32],num,i     get_players(players,num)     new CsTeams:team; // <-     for(i = 0; i <= num; i++) {         new id = players[i]         if (is_user_alive(id) && !is_user_bot(id)) {             team = cs_get_user_team(id); // <-             if (team == CS_TEAM_T) {                 cs_set_user_team(id,CS_TEAM_CT)             }         }         if (is_user_bot(id) && is_user_alive(id)) {             if (team == CS_TEAM_CT) {                 cs_set_user_team(id,CS_TEAM_T)                 set_cvar_num("sv_restartround", 1)             }         }     } }

shino 05-21-2006 15:27

none of these work :x

since i'm quite new to plugin writing, i don't know if your codes would make an effect i like:
i like to separate bots from real players, so bots would be terrorists and real players counter-terrorists. i apologise if your codes give this effect.

shino 05-21-2006 15:45

don't mind any more, fixed it :D


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

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