SA-MP Forums Archive
if(response) - 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: if(response) (/showthread.php?tid=412361)



if(response) - RieTzz - 01.02.2013

Hey there guys,
I need some help, I've created a dialog which "Credits is dedicted to RieTzz" etc
And when the guy presses "Thanks" or anything I want it to sendclientmessagetoall.. I'll show you the code, and if you could help me, I would appreciate it rly much.

pawn Код:
CMD:credits(playerid)
{
    new string[128];
    format(string,sizeof(string),"Credits for this server is dedicated to RieTzz.\n And Ron for his helping and support!");
    ShowPlayerDialog(playerid,154,DIALOG_STYLE_MSGBOX,"Credits:",string,"Thanks","Cancel");
    format(string,sizeof(string), "%s has thanked for this server!",pName(playerid));
    if(!response){
    SendClientMessageToAll(playerid,COLOR_LIGHTBLUE,string);
    return 1;
}



Re: if(response) - Alternative112 - 01.02.2013

Код:
CMD:credits(playerid)
{
    new string[128];
    format(string,sizeof(string),"Credits for this server is dedicated to RieTzz.\n And Ron for his helping and support!");
    ShowPlayerDialog(playerid,154,DIALOG_STYLE_MSGBOX,"Credits:",string,"Thanks","Cancel");
    return 1;
}
Then

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	switch(dialogid) 
	{
		case 154: //MUST be the dialogid you used in the command above (second argument)
		{
			if (response) {
                               format(string,sizeof(string), "%s has thanked for this server!",pName(playerid));
                               SendClientMessageToAll(playerid,COLOR_LIGHTBLUE,string);
                        }
                }
        }
    return 1;
}



Re: if(response) - RieTzz - 01.02.2013

Thank you very much!


Re: if(response) - Accord - 01.02.2013

It's the same ID which has been setted in the command(154).


Re: if(response) - RieTzz - 01.02.2013

I did that, and I got these error line
pawn Код:
G:\Server info\Mein - Kopia\gamemodes\gys.pwn(399) : error 035: argument type mismatch (argument 2)
on this line

pawn Код:
if(dialogid == 154)
    {
        if(response)
        {
         new string[128];
         format(string,sizeof(string), "%s has thanked for this server!",pName(playerid));
         SendClientMessageToAll(playerid,COLOR_LIGHTBLUE,string);
         return 1;
     }
 }



Re: if(response) - Naruto_Emilio - 01.02.2013

SendClientMessageToAll(COLOR_LIGHTBLUE,string);


Re: if(response) - [swat]dragon - 01.02.2013

[QUOTE=RieTzz;2360107]I did that, and I got these error line
pawn Код:
G:\Server info\Mein - Kopia\gamemodes\gys.pwn(399) : error 035: argument type mismatch (argument 2)
thats the correct format of the code, it should be fine with this

Код:
if(dialogid == 154)
    {
        if(response)
        {
         new string[128];
         format(string,sizeof(string), "%s has thanked for this server!",pName(playerid));
         SendClientMessageToAll(COLOR_LIGHTBLUE,string);  //SendClientMessageToAll it doesnt use PlayerID
         return 1;
     }
 }
As i commented, SendClientMessageToAll it doesnt use PlayerID


Re: if(response) - Jewell - 02.02.2013

Quote:
Originally Posted by RieTzz
Посмотреть сообщение
I did that, and I got these error line
pawn Код:
G:\Server info\Mein - Kopia\gamemodes\gys.pwn(399) : error 035: argument type mismatch (argument 2)
on this line

pawn Код:
if(dialogid == 154)
    {
        if(response)
        {
         new string[128];
         format(string,sizeof(string), "%s has thanked for this server!",pName(playerid));
         SendClientMessageToAll(playerid,COLOR_LIGHTBLUE,string);
         return 1;
     }
 }
You have to change to...

pawn Код:
if(dialogid == 154)
{
        if(response)
        {
            new string[128];
            new PlayerName[MAX_PLAYER_NAME];
            GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
            format(string,sizeof(string), "%s has thanked for this server!",PlayerName);
            SendClientMessageToAll(COLOR_LIGHTBLUE,string);
            return 1;
        }
}



Re: if(response) - Jewell - 02.02.2013

oo ^^i didn't saw your post, sorry


Re: if(response) - RieTzz - 02.02.2013

Oh thank you! That was the only thing I forgot to remove! I had SendClientMessage before, and forgot to remove "playerid"

Fail by me... Thanks once again.