SA-MP Forums Archive
GetPlayerWantedLevel. - 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)
+--- Thread: GetPlayerWantedLevel. (/showthread.php?tid=365404)



GetPlayerWantedLevel. - TaLhA XIV - 02.08.2012

Hello,
I wanted to ask that how can we get a players wanted level by typing his name in the dialog message box.
It would be a real help please.


Re: GetPlayerWantedLevel. - DeathTone - 02.08.2012

Put this at the top of your script
pawn Код:
#define FINDPLAYER 553
Put this where ever you want some one to get the message box (maybe a CMD)
pawn Код:
ShowPlayerDialog(playerid, FINDPLAYER, DIALOG_STYLE_INPUT, "Find player's wanted level", "Type in the player's name to see their wanted level", "Enter", "");
Then put this under OnDialogResponse
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == FINDPLAYER)
    {
        new name[24];
        foreach(Player, targetid)
        {
            GetPlayerName(targetid, name, 24);
            if(strfind(name, inputtext, true) != -1)
            {
                new string[50];
                format(string, 50, "%s's Wanted level is %d", name, GetPlayerWantedLevel(targetid));
                SendClientMessage(playerid, -1, string);
                return 1;
            }
        }
        return SendClientMessage(playerid, -1, "Name not found!");
    }
}