SA-MP Forums Archive
OnDialogResponse[HALP] :) - 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: OnDialogResponse[HALP] :) (/showthread.php?tid=399271)



OnDialogResponse[HALP] :) - [CG]Milito - 13.12.2012

PHP код:
    if(dialogid == rules)
    {
    switch(
listitem)
        {
        case 
0//Agree with the rules
        
{
        new 
pname[24];
        new 
string[128];
        
GetPlayerName(playerid,pname,sizeof(pname));
        
format(string,sizeof(string),"%s(%d) Has readed the server rules by typing /showrules{FFFFFF}!",pname,playerid);
        
SendClientMessageToAll(COLOR_GREEN,string);
        for(new 
0MAX_PLAYERSi++)
        {
            
TogglePlayerControllable(i1);
        }
        }
        case 
1//Disagree with the rules
        
{
        new 
pname[24];
        new 
string[128];
        
GetPlayerName(playerid,pname,sizeof(pname));
        
Kick(playerid);
        
format(string,sizeof(string),"%s(%d) Has been kicked Reason:Disagreeing with server-rules{FFFFFF}, you can check it by typing /showrules!",pname,playerid);
        
SendClientMessageToAll(COLOR_GREEN,string);
        for(new 
0MAX_PLAYERSi++)
        {
            
TogglePlayerControllable(i1);
        }
        }
       }
      } 
Whats wrong with that code? It doesn't work properly. Nothing happens when i press Disagree, same with Agree

Thanks in advance


Re: OnDialogResponse[HALP] :) - Mean - 13.12.2012

Tried returning 0 in OnDialogResponse?


Re: OnDialogResponse[HALP] :) - DaRk_RaiN - 13.12.2012

Check that the dialog is defined as rules.else it won't work, better show the rules dialog.


Re: OnDialogResponse[HALP] :) - Patrick - 13.12.2012

why not try this

pawn Код:
new rules;//put it anywhere you want

      if(dialogid == rules)
      {
        if(response)
        {
        if(listitem == 0) //Agree with the rules
        {
        new pname[24];
        new string[128];
        GetPlayerName(playerid,pname,sizeof(pname));
        format(string,sizeof(string),"%s(%d) Has readed the server rules by typing /showrules{FFFFFF}!",pname,playerid);
        SendClientMessageToAll(COLOR_GREEN,string);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            TogglePlayerControllable(i, 1);
        }
        }
        if(listitem == 1) //Disagree with the rules
        {
        new pname[24];
        new string[128];
        GetPlayerName(playerid,pname,sizeof(pname));
        Kick(playerid);
        format(string,sizeof(string),"%s(%d) Has been kicked Reason:Disagreeing with server-rules{FFFFFF}, you can check it by typing /showrules!",pname,playerid);
        SendClientMessageToAll(COLOR_GREEN,string);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            TogglePlayerControllable(i, 1);
        }
        }
       }
instead of case!


Re: OnDialogResponse[HALP] :) - Konstantinos - 13.12.2012

First of all, return false at the end of the callback if it's filterscript, otherwise true.
Why do you make a /showrules command with listitem? Change it to a msgBox and use:
pawn Код:
if(dialogid == rules)
{
    if(response)
    {
        new pname[24];
        new string[128];
        GetPlayerName(playerid,pname,sizeof(pname));
        format(string,sizeof(string),"%s(%d) Has readed the server rules by typing /showrules{FFFFFF}!",pname,playerid);
        SendClientMessageToAll(COLOR_GREEN,string);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            TogglePlayerControllable(i, 1);
        }
    }
    else
    {
        new pname[24];
        new string[128];
        GetPlayerName(playerid,pname,sizeof(pname));
        Kick(playerid);
        format(string,sizeof(string),"%s(%d) Has been kicked Reason:Disagreeing with server-rules{FFFFFF}, you can check it by typing /showrules!",pname,playerid);
        SendClientMessageToAll(COLOR_GREEN,string);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            TogglePlayerControllable(i, 1);
        }
     }
     return 1;
}