SA-MP Forums Archive
Dialog help - 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: Dialog help (/showthread.php?tid=434869)



Dialog help - mahdi499 - 04.05.2013

Is there anyway to Extract playerid from the inputtext like
pawn Код:
new preport[128];
        format(preport, sizeof(preport), "[PRIVATE-REPORT]%s would like to talk to you", GetPlayerNameEx(playerid));
        SendClientMessage(inputtext, COLOR_REPORT, string);
this message will be sent to the admin name he placed in the dialog input


Re: Dialog help - RajatPawar - 04.05.2013

A better way would be to use OnPlayerClickPlayer.
Then you could do:
pawn Код:
public OnPlayerClickPlayer(playerid, clickedid, source)
{
     // Whatever ifs you used to check if player is ALLOWED TO click, example
     if( is_player_allowed_to_choose_an_admin_to_talk_to[ playerid ] == 1 )
     {
           if( PlayerEnum[ clickedid ][ admin_var ] > 0 )
           {
                // Do all that sending of messages
            }
     }
 return 1;
}
This is way much better, suggesting.


Re: Dialog help - mahdi499 - 04.05.2013

No,this isn't the idea,the idea is i made a report menu,and it has Select a private admin to talk to,and you type in the name in a dialog_input, here's the full code

pawn Код:
if(dialogid == REPORT_TALK)
    {
        new preport[128];
        format(preport, sizeof(preport), "[PRIVATE-REPORT]%s would like to talk to you", GetPlayerNameEx(playerid));
        SendClientMessage(inputtext, COLOR_REPORT, string);
    }



Re: Dialog help - RajatPawar - 04.05.2013

I suggested what I did, because, you can never guess what the player is going to enter. An admin's name may be "H[o]" but he might enter "Talk to h[o]" or "HO" which basically would return him an error. But anyways, you can use:
pawn Код:
if(dialogid == REPORT_TALK)
    {  new name[24];
        foreach( new i:Player )
        {  GetPlayerName(i, name, 24);
            if(strcmp(inputtext, name, true) == 0)
            {
                  new preport[128];
                  format(preport, sizeof(preport), "[PRIVATE-REPORT]%s would like to talk to you",         GetPlayerNameEx(playerid));
                  SendClientMessage(i, -1, preport);
             }
        ..........