SA-MP Forums Archive
Dialog Problem - 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: Dialog Problem (/showthread.php?tid=293850)



Dialog Problem - Kostas' - 30.10.2011

All work fine with the dialogs. I add the /rules, "Accept" and "Leave" because I rewrite the gamemode to ZCMD. And I got a problem. When I accept rules, it says You have accepted our rules, and after that SERVER: Unknown command.
The dialog of rules.
pawn Код:
if(dialogid == 2) {
        if(response) {
            SendClientMessage(playerid,0x0096FFFF,"You accepted our rules!");
        }
        else if(response == 0) {
            SendClientMessage(playerid,COLOR_RED,"Therefore leave!");
            Kick(playerid);
        }
    }
    return 1;
}
I had only the /tgoto (disable goto)
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1) {
        if(response) {
            if(listitem == 0) {
                AllowGoto[playerid] = 1;
                SendClientMessage(playerid, COLOR_ORANGE, "You have allowed other players teleporting to you!");
            }
            if(listitem == 1) {
                AllowGoto[playerid] = 0;
                SendClientMessage(playerid, COLOR_ORANGE, "You have disallowed other players teleporting to you!");
            }
        }
        return 1;
    }
    return 1;
}
And when I add the dialog from the rules
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1) {
        if(response) {
            if(listitem == 0) {
                AllowGoto[playerid] = 1;
                SendClientMessage(playerid, COLOR_ORANGE, "You have allowed other players teleporting to you!");
            }
            if(listitem == 1) {
                AllowGoto[playerid] = 0;
                SendClientMessage(playerid, COLOR_ORANGE, "You have disallowed other players teleporting to you!");
            }
        }
        return 1;
    }
    if(dialogid == 2) {
        if(response) {
            SendClientMessage(playerid,0x0096FFFF,"You accepted our rules!");
        }
        else if(response == 0) {
            SendClientMessage(playerid,COLOR_RED,"Therefore leave!");
            Kick(playerid);
        }
    }
    return 1;
}
And I cannot return 1; there. What to do


Re: Dialog Problem - knackworst - 30.10.2011

I had troubles with zcmd too... Are u sure u implented the two new callbacks that ces wity zcmd in ur script?


Re: Dialog Problem - Speed - 30.10.2011

ZCMD commands must at the end have

pawn Код:
return 1;
if they dont have that they will send SERVER: Unknown command

if you dont now how to fix it, pls give me cmd after whos is that message


Re: Dialog Problem - Kostas' - 30.10.2011

Quote:
Originally Posted by knackworst
Посмотреть сообщение
I had troubles with zcmd too... Are u sure u implented the two new callbacks that ces wity zcmd in ur script?
What do you mean, I didn't understand it.

Quote:
Originally Posted by Speed
Посмотреть сообщение
ZCMD commands must at the end have

pawn Код:
return 1;
if they dont have that they will send SERVER: Unknown command

if you dont now how to fix it, pls give me cmd after whos is that message
Well, I will post before and after /rules.
Before:
pawn Код:
CMD:tgoto(playerid, params[])
{
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "{FFFFFF}Toggle Goto", "{00FF00}Enable\n{FF0000}Disable", "Select", "Cancel");
    return 1;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1) {
        if(response) {
            if(listitem == 0) {
                AllowGoto[playerid] = 1;
                SendClientMessage(playerid, COLOR_ORANGE, "You have allowed other players teleporting to you!");
            }
            if(listitem == 1) {
                AllowGoto[playerid] = 0;
                SendClientMessage(playerid, COLOR_ORANGE, "You have disallowed other players teleporting to you!");
            }
        }
        return 1;
    }
    return 1;
}
After:
pawn Код:
CMD:tgoto(playerid, params[])
{
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "{FFFFFF}Toggle Goto", "{00FF00}Enable\n{FF0000}Disable", "Select", "Cancel");
    return 1;
}
CMD:rules(playerid, params[])
{
    ShowPlayerDialog(playerid,2 ,DIALOG_STYLE_MSGBOX,"{00FFFF}Rules","* Do not hack/cheat\n* Do not use Mods that will give you an advantage over other players\n* Do not be offensive to other players and admins\n* Do not use offensive or racist usernames\n* Do not spawnkill at the spawnpoints\n* Do not PM admins with requests for extra features, instead post it on the forum in Suggestions\n* Do not ask for Admin Status","Accept","Don't accept");
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1) {
        if(response) {
            if(listitem == 0) {
                AllowGoto[playerid] = 1;
                SendClientMessage(playerid, COLOR_ORANGE, "You have allowed other players teleporting to you!");
            }
            if(listitem == 1) {
                AllowGoto[playerid] = 0;
                SendClientMessage(playerid, COLOR_ORANGE, "You have disallowed other players teleporting to you!");
            }
        }
        return 1;
    }
    if(dialogid == 2) {
        if(response) {
            SendClientMessage(playerid,0x0096FFFF,"You accepted our rules!");
        }
        else if(response == 0) {
            SendClientMessage(playerid,COLOR_RED,"Therefore leave!");
            Kick(playerid);
        }
    }
    return 1;
}
Because I cannot return 1; on the end on the OnDialogResponse, it appears SERVER: Uknown comman


Re: Dialog Problem - SmiT - 30.10.2011

pawn Код:
CMD:rules(playerid, params[])
{
    ShowPlayerDialog(playerid,2 ,DIALOG_STYLE_MSGBOX,"{00FFFF}Rules","* Do not hack/cheat\n* Do not use Mods that will give you an advantage over other players\n* Do not be offensive to other players and admins\n* Do not use offensive or racist usernames\n* Do not spawnkill at the spawnpoints\n* Do not PM admins with requests for extra features, instead post it on the forum in Suggestions\n* Do not ask for Admin Status","Accept","Don't accept");
    return true;
}



Re: Dialog Problem - Kostas' - 30.10.2011

And If I want to add more Dialogs I cannot under id 2
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1) {
        if(response) {
            if(listitem == 0) {
                AllowGoto[playerid] = 1;
                SendClientMessage(playerid, COLOR_ORANGE, "You have allowed other players teleporting to you!");
            }
            if(listitem == 1) {
                AllowGoto[playerid] = 0;
                SendClientMessage(playerid, COLOR_ORANGE, "You have disallowed other players teleporting to you!");
            }
        }
        return 1;
    }
    if(dialogid == 2) {
        if(response) {
            SendClientMessage(playerid,0x0096FFFF,"You accepted our rules!");
        }
        else if(response == 0) {
            SendClientMessage(playerid,COLOR_RED,"Therefore leave!");
            Kick(playerid);
        }
    }
    return 1;
}
//I can't more and at the end to return 1;
    return 1;
}
To let the dialogid 2 at the end and add all the others before it?
In every dialog isn't it return 1?


Re: Dialog Problem - SmiT - 30.10.2011

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1)
    {
        if(response)
        {
            if(listitem == 0)
            {
                AllowGoto[playerid] = 1;
                SendClientMessage(playerid, COLOR_ORANGE, "You have allowed other players teleporting to you!");
            }
            if(listitem == 1)
            {
                AllowGoto[playerid] = 0;
                SendClientMessage(playerid, COLOR_ORANGE, "You have disallowed other players teleporting to you!");
            }
        }
    }
    if(dialogid == 2)
    {
        if(response)
        {
            SendClientMessage(playerid,0x0096FFFF,"You accepted our rules!");
        }
        else if(response == 0)
        {
            SendClientMessage(playerid,COLOR_RED,"Therefore leave!");
            Kick(playerid);
        }
    }
    if(dialogid == /* Anoter Dialog */)
    {
        // Do your code
    }
    // More dialogs
    return 1;
}



Re: Dialog Problem - Kostas' - 30.10.2011

Thank you SmiT