Server Rules
#1

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

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

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;

Reply
#4

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)