Help With showing players on team
#1

how can i script a command that when a player types /alive it shows the people on TEAM_HIDER 0 please help.
Reply
#2

Run a loop to check for players that are on TEAM_HIDER
Reply
#3

like this:
Код:
// top
#define SLOTS yourslotsfortheserver

// in your command
new aname[20],str[32];
for(new i=0;i<SLOTS;i++) // loops through all slots on the server
{
if(IsPlayerConnected(i) && Teamvar[playerid] ==TEAM_HIDER) // if player is connected and player is in team_hider
// replace Teamvar with your variable for teams, like gTeam
{
GetPlayerName(i,aname,20); // get a name of an alive player
format(string,32,"[ALIVE] %s",aname); // set str's value to "[ALIVE] aname"
SendClientMessage(playerid,COLOR,str); // send str to the player, who typed the command..:D have fun!
}
}
Reply
#4

Quote:
Originally Posted by r0b
Посмотреть сообщение
like this:
Код:
// top
#define SLOTS yourslotsfortheserver

// in your command
new aname[20],str[32];
for(new i=0;i<SLOTS;i++) // loops through all slots on the server
{
if(IsPlayerConnected(i) && Teamvar[playerid] ==TEAM_HIDER) // if player is connected and player is in team_hider
// replace Teamvar with your variable for teams, like gTeam
{
GetPlayerName(i,aname,20); // get a name of an alive player
format(string,32,"[ALIVE] %s",aname); // set str's value to "[ALIVE] aname"
SendClientMessage(playerid,COLOR,str); // send str to the player, who typed the command..:D have fun!
}
}
Uhm, lets try something simple.

pawn Код:
if(!strcmp(cmdtext, "/alive", true)) {
     new zzst[24];
     for(new i = 0; i < GetMaxPlayers(); i ++ ) {
           if(!IsPlayerConnected(i)) continue;
           if(GetPlayerTeam(i) == TEAM_HIDER) {
                 GetPlayerName(i, zzst, 24);
                 SendClientMessage(playerid, 0xFFFFFFA, zzst);
           }
     }
}
Reply
#5

Quote:
Originally Posted by CarltonTheGG
Посмотреть сообщение
Uhm, lets try something simple.

pawn Код:
if(!strcmp(cmdtext, "/alive", true)) {
     new zzst[24];
     for(new i = 0; i < GetMaxPlayers(); i ++ ) {
           if(!IsPlayerConnected(i)) continue;
           if(GetPlayerTeam(i) == TEAM_HIDER) {
                 GetPlayerName(i, zzst, 24);
                 SendClientMessage(playerid, 0xFFFFFFA, zzst);
           }
     }
}
dude when i add this on it says unkown command can you please help
Reply
#6

pawn Код:
if(!strcmp(cmdtext, "/alive", true)) {
     new zzst[24];
     for(new i = 0; i < GetMaxPlayers(); i ++ ) {
           if(!IsPlayerConnected(i)) continue;
           if(GetPlayerTeam(i) == TEAM_HIDER) {
                 GetPlayerName(i, zzst, 24);
                 SendClientMessage(playerid, 0xFFFFFFA, zzst);
           }
     }
     return 1;
}
Reply
#7

loose inden is just bad indentification you can indent it with tab

pawn Код:
if(!strcmp(cmdtext, "/alive", true))
{
    new zzst[24];
    for(new i = 0; i < GetMaxPlayers(); i ++ ) {
        if(!IsPlayerConnected(i)) continue;
        if(GetPlayerTeam(i) == TEAM_HIDER) {
            GetPlayerName(i, zzst, 24);
            SendClientMessage(playerid, 0xFFFFFFA, zzst);
        }
    }
    return 1;
}

or here

http://dracoblue.net/tidy/pawn/
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)