OnDialogResponse[HALP] :)
#1

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

Tried returning 0 in OnDialogResponse?
Reply
#3

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

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!
Reply
#5

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


Forum Jump:


Users browsing this thread: 5 Guest(s)