AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   how can i change all other players team in that ^ code? (https://forums.alliedmods.net/showthread.php?t=195241)

omer 09-05-2012 04:08

how can i change all other players team in that ^ code?
 
Hello again,

Guys i am having an problem

PHP Code:

register_concmd"amx_chang""Cmd_AdminMode"ADMIN_BAN);

public 
Cmd_AdminMode(idlevelcid)
{
    
cs_set_user_teamidCS_TEAM_CT );


I can change the team of the player who writes the command amx_chang but how can i change all other players team in that ^ code?

simanovich 09-05-2012 04:21

Re: how can i change all other players team in that ^ code?
 
"get_players" and "for" functions

PHP Code:

new iPlayer[32]; 


omer 09-05-2012 04:23

Re: how can i change all other players team in that ^ code?
 
Quote:

Originally Posted by simanovich (Post 1791818)
"get_players" and "for" functions

PHP Code:

new iPlayer[32]; 


Can't understand :(

gogicaa 09-05-2012 04:43

Re: how can i change all other players team in that ^ code?
 
Loop through players and then use cs_set_user_team.

simanovich 09-05-2012 04:53

Re: how can i change all other players team in that ^ code?
 
PHP Code:

new iPlayers[32];
get_playersdont remember the f**** code :( );
 
for (new 
0dont remebmer... ; i++)
if (
cs_get_user_team(i) == CS_TEAM_T)
cs_set_user_team(i,CS_TEAM_CT);
else
cs_set_user_team(i,CS_TEAM_T); 

Please someone fix my code

omer 09-05-2012 05:13

Re: how can i change all other players team in that ^ code?
 
I have tried this but didn't work:

PHP Code:

 new g_Max
    
    g_Max 
get_maxplayers()

    for( new 
<= g_Max i++ )
    {
       
cs_set_user_teamiCS_TEAM_T );
    } 


omer 09-05-2012 05:45

Re: how can i change all other players team in that ^ code?
 
Quote:

Originally Posted by simanovich (Post 1791832)
PHP Code:

new iPlayers[32];
get_playersdont remember the f**** code :( );
 
for (new 
0dont remebmer... ; i++)
if (
cs_get_user_team(i) == CS_TEAM_T)
cs_set_user_team(i,CS_TEAM_CT);
else
cs_set_user_team(i,CS_TEAM_T); 

Please someone fix my code

This?

PHP Code:

new iPlayers[32], inumpid 
get_players
(playersinum"ch")
 
for (new 
0;  inumi++)
if (
cs_get_user_team(i) == CS_TEAM_T)
cs_set_user_team(i,CS_TEAM_CT);
else
cs_set_user_team(i,CS_TEAM_T); 


omer 09-05-2012 07:02

Re: how can i change all other players team in that ^ code?
 
Quote:

Originally Posted by omer (Post 1791849)

PHP Code:

new iPlayers[32], inumpid 
get_players
(playersinum"ch")
 
for (new 
0;  inumi++)
if (
cs_get_user_team(i) == CS_TEAM_T)
cs_set_user_team(i,CS_TEAM_CT);
else
cs_set_user_team(i,CS_TEAM_T); 



When i try this there is errors please can anyone tell me the way!!!

simanovich 09-05-2012 07:04

Re: how can i change all other players team in that ^ code?
 
Quote:

Originally Posted by omer (Post 1791869)
When i try this there is errors please can anyone tell me the way!!!

cuz this code isn't complite and need to be fixed

jimaway 09-05-2012 08:41

Re: how can i change all other players team in that ^ code?
 
Code:
new iPlayers[32], inum, pid get_players(players, inum, "ch")   for (new i = 0;  i < inum; i++) {     pid = players[i]     switch (cs_get_user_team(pid)) {         case CS_TEAM_T: cs_set_user_team(pid, CS_TEAM_CT)         case CS_TEAM_CT: cs_set_user_team(pid, CS_TEAM_T)     } }


All times are GMT -4. The time now is 08:19.

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