if(response)
#1

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;
}
Reply
#2

Код:
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;
}
Reply
#3

Thank you very much!
Reply
#4

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

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;
     }
 }
Reply
#6

SendClientMessageToAll(COLOR_LIGHTBLUE,string);
Reply
#7

[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
Reply
#8

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;
        }
}
Reply
#9

oo ^^i didn't saw your post, sorry
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)