ShowPlayerDialog Don't work
#1

Hello , i have the following code to detect the players of Team 1 . I already defined teams but this code don't work.
PHP код:
CMD:team(playerid, params[])
{
   new 
String[256] = " ", yname[MAX_PLAYER_NAME];
    for(new 
i = 0; i < MAX_PLAYERS; i ++)
    {
        if(
IsPlayerConnected(i) && GetPlayerTeam(i) == 1)
        {
            
GetPlayerName(i, yname, sizeof(yname));
            
format(String, sizeof(String), "%s%s (%d)\n", String, yname, i);
        }
    }
    
ShowPlayerDialog(playerid, 5555, DIALOG_STYLE_MSGBOX,"Team:",String ,"Ok","");
    return 
1;
} 
There was a code given to me by Schneider (SA-MP forum member) . and i change it to the above code to have function of only 1 gang . Following is the code that i got from Schneider.
PHP код:
CMD:team(playerid, params[])
{
    new 
String[256] = " ", yname[MAX_PLAYER_NAME], team;
    if(
sscanf(params, "i", team)) team = GetPlayerTeam(playerid);
    if((
team < 0) || (team > 4))  return SendClientMessage(playerid, -1, "Error: Invalid team-ID");  // change his to highest team ID.
    
for(new i = 0; i < MAX_PLAYERS; i ++)
    {
        if(
IsPlayerConnected(i) && GetPlayerTeam(i) == team)
        {          
            
GetPlayerName(i, yname, sizeof(yname));
            
format(String, sizeof(String), "%s%s (%d)\n", String, yname, i);
        }
    }
    
ShowPlayerDialog(playerid, 5555, DIALOG_STYLE_MSGBOX,"Team:",String ,"Ok","");
    return 
1;
} 
I want to have this function for only gang no 1. If i use the 2nd code then it is working but if i use the 1st one then it don't work .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)