[help] Player Clickeng, Dialog Response!
#1

hey all,

i want to know how can i make this:
when i click on a player in the list (TAB), the server shows me another list (Dialog) , that can i choose between:
Player Stats
Private Message

just tell me how, i have the PlayerStats + PrivateMessage Functions ready.

thanks!
Reply
#2

pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    /*if(clickedplayerid == playerid)
    {
      ShowPlayerDialog(playerid,123,DIALOG_STYLE_MSGBOX,"Console:","You can not choose your own name!","Ok","..");
      return 1;
    }*/

    ShowPlayerDialog(playerid,143,DIALOG_STYLE_LIST,"Choose an option:","Send Message\nGet Stats","Select","Cancel");
    ClickedPlayerID[playerid] = clickedplayerid;
return 1;
}
add to top of script

pawn Код:
new ClickedPlayerID[MAX_PLAYERS];
add to OnPlayerConnect for a security measure

pawn Код:
ClickedPlayerID[playerid] = -1;
here is Repsonse

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(!response) return 0;
    if(dialogid == 143)//CLICKED PLAYER MENU
    {
        if(!response) return 0;
        if(response)
        {
          if(listitem == 0)//SEND MESSAGE
          {
                new name[MAX_PLAYER_NAME], dstr[128], otherid;
                otherid = ClickedPlayerID[playerid];
                GetPlayerName(otherid,name,sizeof(name));
                format(dstr,sizeof(dstr),"Send a message to %s(%d):",name,otherid);
                ShowPlayerDialog(playerid,152,DIALOG_STYLE_INPUT,"Send Message:",dstr,"Send","Cancel");
            }
            if(listitem == 1)//GET STATS
            {
              new title[128],name[MAX_PLAYER_NAME], otherid;
              otherid = ClickedPlayerID[playerid];
              GetPlayerName(otherid,name,sizeof(name));
              format(title,sizeof(title),"Console/Stats/%s(%d):",name,playerid);
              new stats[128];
              format(stats,sizeof(stats),"Name: %s\nID: %d\nScore: %d\nMoney: %d",name,otherid,GetPlayerScore(otherid),GetPlayerMoney(otherid));
              ShowPlayerDialog(playerid,14,DIALOG_STYLE_MSGBOX,title,stats,"Ok","..");
            }
}
}
return 1;
}
pawn Код:
if(dialogid == 152)//SEND MESSAGE INPUT
    {
      if(!response) return 0;
      if(response)
        {
          if(!strlen(inputtext)) return ShowPlayerDialog(playerid,152,DIALOG_STYLE_INPUT,"Console:","Please enter text to send","Send","Cancel");
          new message[128], otherid, playername[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
          otherid = ClickedPlayerID[playerid];
          GetPlayerName(playerid,playername,sizeof(playername));
          GetPlayerName(otherid,name,sizeof(name));
          new string[128], str[128], str2[128];
          format(string,sizeof(string),"Message from %s(%d):",playername, playerid);
          format(message,sizeof(message),"%s",inputtext);
          SendClientMessage(otherid, YELLOW, string);
          SendClientMessage(otherid,YELLOW,message);
          format(str,sizeof(str),"Message sent to %s(%d)",name,otherid);
          format(str2,sizeof(str2),"%s",message);
          ShowPlayerDialog(playerid,123,DIALOG_STYLE_MSGBOX,str,str2,"Ok","..");
            printf("MSG - %s(%d) to %s(%d) - %s",playername, playerid, name, otherid, inputtext);
            ClickedPlayerID[playerid] = -1;
        }
        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)