27.12.2015, 21:03
pawn Код:
if(strcmp(cmd, "/wanted2", true) == 0)
{
string[0] = EOS; // clearing string array
new namestr[MAX_PLAYER_NAME];//64 is too much since the max length of a name is like ~20
for(new i, g = GetMaxPlayers(); i < g; i++)
if(IsPlayerConnected(i))
{
if(PlayerData[i][pWantedLevel] != 0)
{
GetPlayerName(i,namestr,MAX_PLAYER_NAME);
format(string,sizeof(string),"\n%s%s level: %d",string,namestr,PlayerData[i][pWantedLevel]);
}
}
if(!string[0]) SendClientMessage(playerid,0xFFFFFFFF,"There are no wanted Players");
else ShowPlayerDialog(playerid,500, DIALOG_STYLE_LIST, "Wanted List.",string,"Ok", "Cancel");
return 1;
}
if(dialogid == 500)
{
if(!response) return 1;
new pos = strfind(inputtext," ",true);
if(pos != -1)
{
inputtext[pos] = EOS;
new giveplayerid;
//giveplayerid = GetPlayerIdFromName(inputtext); you need add/find this function if there is no sscanf in your gamemode
sscanf(inputtext,"u",giveplayerid);
if(giveplayerid != INVALID_PLAYER_ID)
{
if(PlayerData[giveplayerid][pWantedLevel] > 0)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(giveplayerid, x, y, z);
SetPlayerCheckpoint(playerid, x, y, z, 3.0);
}
}
}
return 1;
}