SA-MP Forums Archive
problem :( - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: problem :( (/showthread.php?tid=275987)



problem :( - muhib777 - 11.08.2011

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/Wanted", cmdtext, true, 10) == 0)
	{
	if (GetPlayerTeam(playerid) == TEAM_GANG)
	{
	    SendClientMessage(playerid, -1, "You are not part of the police");
	}
	else if (GetPlayerTeam(playerid) == TEAM_POLICE)
	{
    new count, namestr[MAX_PLAYER_NAME], string[128];//64 is too much since the max length of a name is like ~20
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerWantedLevel(i)!=0)
            {
                count++;
                GetPlayerName(i,namestr,MAX_PLAYER_NAME);
                if(!strlen(string))
                {
                    format(string,sizeof(string),"%s level: %d",namestr,GetPlayerWantedLevel(i));
                    format(string,sizeof(string),"\n%s level: %d",namestr,GetPlayerWantedLevel(i));
                }
            }
        }
    }
//also you'd use ShowPlayerDialog outside of the loop, just after it's finished
    ShowPlayerDialog(playerid,500, DIALOG_STYLE_MSGBOX, "Wanted List.",string,"Ok", "Cancel");
    if(count == 0)return SendClientMessage(playerid,-1,"There are no wanted Players");
    }
    return 1;
	}
	return 1;
}
So I want only TEAM_POLICE to be able to see this cmd and so all other classes are not able to see this.


Re: problem :( - =WoR=Varth - 12.08.2011

https://sampwiki.blast.hk/wiki/GetPlayerTeam