20.01.2013, 12:17
how to send cilent message through dialog box plz help
ShowPlayerDialog(playerid,dialogid, DIALOG_STYLE_MSGBOX,"Message","This is a Message","Ok","");
public OnPlayerConnect(playerid)
{
ShowPlayerDialog(playerid, 0 , DIALOG_STYLE_LIST,"Test","Blah 1\nblah 2","select","cancel");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case 0: // dialog id
{
if(!response) // when he press 'cancel'
{
SendClientMessage(playerid,-1,"Canceled.");
return 1;
}
if(listitem == 0) // when he press 'blah 1'
{
SendClientMessage(playerid, -1,"You pressed blah 1 !");
}
else if(listitem == 1) // when he press 'blah 2'
{
SendClientMessage(playerid, -1,"You pressed blah 2 !");
}
}
return 1;
}
new id;
#define DIALOG_TALK 69
CMD:talk(playerid,params[])
{
if(sscanf(params,"u",id)) return SendClientMessage(playerid,-2,"USAGE: /talk [playerid]");
{
ShowPlayerDialog(playerid, DIALOG_TALK, DIALOG_INPUT, "Talk here","Enter your text below!","Send","Cancel");
}
return 1;
}
// Dialog response:
if(dialogid == DIALOG_TALK)
{
if(response)
{
SendClientMessage(id,-2,inputtext);
}
}