Show Players On A Team problem?
#1

okay i have this script that is suppose to show the players on a team... but! instead of showing the players on TEAM_HIDER 0... the command only works for TEAM_HIDER 0 showing the names of all players (i think of all players)
here is the code someone help me fix it please
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{

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

Your code is bad.
Try it:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{

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

Quote:
Originally Posted by cynic
Посмотреть сообщение
Your code is bad.
Try it:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{

if(!strcmp(cmdtext, "/alive", true)) {
     for(new i = 0; i < GetMaxPlayers(); i ++ ) {
           if(!IsPlayerConnected(i)) continue;
           if(gTeam[i] == TEAM_HIDER) {
                 GetPlayerName(i, zzst, 24);
                 SendClientMessage(playerid, 0xFFFFFFA, zzst);
           }
     }
     return 1;
}
return 0;
}
will try
Reply
#4

Quote:
Originally Posted by cynic
Посмотреть сообщение
Your code is bad.
Try it:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{

if(!strcmp(cmdtext, "/alive", true)) {
     for(new i = 0; i < GetMaxPlayers(); i ++ ) {
           if(!IsPlayerConnected(i)) continue;
           if(gTeam[i] == TEAM_HIDER) {
                 GetPlayerName(i, zzst, 24);
                 SendClientMessage(playerid, 0xFFFFFFA, zzst);
           }
     }
     return 1;
}
return 0;
}
WIN!!!!!!!!!
Reply
#5

It is still not right. If a player with ID 5 disconnect, ID 6,7,8 etc. will not count.
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{

if(!strcmp(cmdtext, "/alive", true)) {
     for(new i = 0; i < GetMaxPlayers(); i ++ ) 
     {
           if(IsPlayerConnected(i))
           {
                if(gTeam[i] == TEAM_HIDER)
                {
                     GetPlayerName(i, zzst, 24);
                     SendClientMessage(playerid, 0xFFFFFFA, zzst);
                }
           }
     }
     return 1;
}
return 0;
}
Reply
#6

Quote:
Originally Posted by wups
Посмотреть сообщение
It is still not right. If a player with ID 5 disconnect, ID 6,7,8 etc. will not count.
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{

if(!strcmp(cmdtext, "/alive", true)) {
     for(new i = 0; i < GetMaxPlayers(); i ++ ) 
     {
           if(!IsPlayerConnected(i))
           {
                if(gTeam[i] == TEAM_HIDER)
                {
                     GetPlayerName(i, zzst, 24);
                     SendClientMessage(playerid, 0xFFFFFFA, zzst);
                }
           }
     }
     return 1;
}
return 0;
}
this just makes a big blank space in the chat.
Reply
#7

Fixed...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)