Dialog PM system 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Dialog PM system help. (
/showthread.php?tid=106857)
Dialog PM system help. -
Striker_Moe - 06.11.2009
Hi there.
Iґve been trying to create a dialog PM system. But unfortunately, the should-be receiver doesnt get any message box. Why?
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/pm", true))
{
ShowPlayerDialog(playerid,755,DIALOG_STYLE_INPUT,"Private Message System","Enter the receiverґs ID or name","Done","Cancel");
return 1;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new recid;
new s1[94],s2[94],name[20];
if(dialogid == 755)
{
recid = strval(inputtext);
ShowPlayerDialog(playerid,756,DIALOG_STYLE_INPUT,"Private Message System","Enter the text you want to send:","Done","Cancel");
return 1;
}
if(dialogid == 756)
{
GetPlayerName(recid, name, sizeof(name));
format(s1, sizeof(s1), "You have received a new PM from %s\n\n%s",name,inputtext);
format(s2, sizeof(s2), "New PM from %s (%d)",name,recid);
ShowPlayerDialog(recid,757,DIALOG_STYLE_MSGBOX,s2,s1,"Reply","Cancel");
return 1;
}
if(dialogid == 757)
{
GetPlayerName(recid, name, sizeof(name));
format(s1, sizeof(s1), "You have received a reply from %s\n\n%s",name,inputtext);
format(s2, sizeof(s2), "New reply from %s (%d)",name,recid);
ShowPlayerDialog(recid,757,DIALOG_STYLE_MSGBOX,s2,s1,"Reply","Cancel");
return 1;
}
return 0;
}
Re: Dialog PM system help. -
Gergo1352 - 06.11.2009
The receiver's ID should be stored in a global variable.
Fixed code:
Код:
new ReceiverID[MAX_PLAYERS];
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/pm", true))
{
ShowPlayerDialog(playerid,755,DIALOG_STYLE_INPUT,"Private Message System","Enter the receiverґs ID or name","Done","Cancel");
return 1;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new s1[94],s2[94],name[20];
if(dialogid == 755)
{
ReceiverID[playerid] = strval(inputtext);
ShowPlayerDialog(playerid,756,DIALOG_STYLE_INPUT,"Private Message System","Enter the text you want to send:","Done","Cancel");
return 1;
}
if(dialogid == 756)
{
GetPlayerName(playerid, name, sizeof(name));
format(s1, sizeof(s1), "You have received a new PM from %s\n\n%s",name,inputtext);
format(s2, sizeof(s2), "New PM from %s (%d)",name,playerid);
ShowPlayerDialog(ReceiverID[playerid],757,DIALOG_STYLE_MSGBOX,s2,s1,"Reply","Cancel");
return 1;
}
if(dialogid == 757)
{
GetPlayerName(playerid, name, sizeof(name));
format(s1, sizeof(s1), "You have received a reply from %s\n\n%s",name,inputtext);
format(s2, sizeof(s2), "New reply from %s (%d)",name,playerid);
ShowPlayerDialog(ReceiverID[playerid],757,DIALOG_STYLE_MSGBOX,s2,s1,"Reply","Cancel");
return 1;
}
return 0;
}