SA-MP Forums Archive
Server Rules - 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: Server Rules (/showthread.php?tid=345646)



Server Rules - x96664 - 25.05.2012

Can somebody tell me what I must to do on OnDialogResponse:
-to kick automatically players if they click on "decline" on server rules dialog and show message to all players in the server that the player has declined the rules and has been automatically kicked?
-also to show to the player SendClientMessage(playerid,COLOR,"You have accepted the rules, Welcome to the server") if he click on "accept".

I made this to the moment, but I don't know what I must to do about previous things which I told about:
pawn Код:
#define Dialog_Rules 1 //Rules dialog

public OnPlayerConnect(playerid)
{
    ShowPlayerDialog(playerid,Dialog_Rules,0,"Server Rules:","1.Accept the rules if you want to play in the server!","Accept", "Decline");
    return 1;
}



Re: Server Rules - Kindred - 25.05.2012

Untested, should work fine:

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case Dialog_Rules:
        {
            if(!response)
            {
                new string[128], name[40];
                GetPlayerName(playerid, name, sizeof(name));
                format(string, sizeof(string), "%s has been kicked for declining the server rules!", name);
                return 1;
            }
            SendClientMessageToAll(-1,"You have accepted the rules, Welcome to the server");
        }
    }
    return 1;
}
Change -1 to the color you want ((i.g. COLOR_WHITE (if defined) or 0xFFFFFFFF)).

EDIT: If you need this to be explained, please, feel free to ask. I'd rather not do it if it is not needed.

EDIT: @Ken97, thanks. I saw that at first, but when I began scripting this, I completely forgot he wanted it for everyone. Edited my code as-well.


Re: Server Rules - Neil. - 25.05.2012

What he said, is if he declines, it should send the message to all, should have SendClientMessageToAll added

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch(
dialogid)
    {
        case 
Dialog_Rules:
        {
            if(!
response)
            {
                new 
string[128], name[40];
                
GetPlayerName(playeridnamesizeof(name));
                
format(stringsizeof(string), "%s has been kicked for declining the server rules!"name);
                
SendClientMessageToAll(0xFF0000FFstring); // Added
                
return 1;
            }
            
SendClientMessage(playerid,-1,"You have accepted the rules, Welcome to the server");
        }
    }
    return 
1;




Re: Server Rules - x96664 - 26.05.2012

Ok,that you scripted for me works, but I want to kick the player who decline the server rules .


Re: Server Rules - skullmuncher1337 - 26.05.2012

underneath of
pawn Код:
SendClientMessageToAll(0xFF0000FF, string); // Added
Add the line
pawn Код:
Kick(playerid);



Re: Server Rules - x96664 - 26.05.2012

Quote:
Originally Posted by skullmuncher1337
Посмотреть сообщение
underneath of
pawn Код:
SendClientMessageToAll(0xFF0000FF, string); // Added
Add the line
pawn Код:
Kick(playerid);
Thank you, it works.