Dialog response command for a targetid.
#1

Well the title basically explains it all, I would love to know how to a make such commands as /stats [PlayerID] to show the player's stats that you have typed in in a dialog, or execute functions to a targetid with a command, whilst using a dialog.

Example:

:/playermenu [PlayerID] - This would bring up a dialog menu to choose a from a list of things to do to the player you typed in.

'You click the 'Kick' feature on the dialog's list', It'd kick the player from the server.

I have had many struggles with this and using SA-MP as a last resort for my issue, if you have a solution, help please. Post it here.
Reply
#2

You can try something like this:

Lets say you have a stats command, and want to show the stats of someone else, using a command:

pawn Код:
CMD:stats(playerid, params[])
{
    new string[128];
    format(string, 128, "Kills: %i", pInfo[playerid][kills]);
    SendClientMessage(playerid, -1, string);
    //Sends client message saying what your kills are
    return 1;
}

//Whereever you want to show the dialog to see someones stat.
ShowPlayerDialog(playerid,666,DIALOG_STYLE_INPUT, "Stats", "Please type in the id of the player who you'd like to see there stats", "Continue", "Cancel");



public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case 666:
        {
            new targetid, string[128];
            targetid = strval(inputtext); //converts inputtext to an integer for the players id
            if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, -1, "That player is not connected");
            format(string, 128, "Kills: %i", pInfo[targetid][kills]);
            SendClientMessage(playerid, -1, string);
        }
    }
    return 0;
}
Hope you understand, will explain more thoroughly if needed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)