How To: Log if a player has accepted my server rules connect message...
#1

Okay, so I have made this dialog appear when a player connects to my server:

pawn Code:
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Some Simple Rules You Need To Follow...", "Cheating Will Result In An IP Ban. In This Case, You Will Not Be Un-Banned!\nRespect Everyone and Everyones' Property!\nAdministators Are The Boss, Do Not Second Guess Them!\nIf You Ignore An Admin, The Admin Can/Will Ban You, It's Up To Them!\nDo Not Ask The Admins/Moderators' To Do Things For You!\nConsider Yourself Warned!", "I Agree", "I Disagree");
This is what happens when the choose "I Agree" or "I Disagree":

pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1)
    {
        if(response)
        {
        new string[250];
        format(string, sizeof(string), "~g~Welcome ~w~To The ~p~Future ~w~Of ~r~SA:MP ~w~Gaming!");
        GameTextForPlayer(playerid, string, 5000, 4);
        }
        else
        {
        new string[300];
        format(string, sizeof(string), "/n/n~w~You Selected ~b~Quit, ~w~Therefore You Were ~r~Kicked! ~w~Goodbye!");
        GameTextForPlayer(playerid, string, 999999999, 4);
        Kick(playerid);
        }
        return 1;
    }
    return 0;
}
How could I make it so if they click "I Agree", they do not have to click it every time they join the server? Also how to add a command that only Admins can use that will make that player read that dialog box again... Thanks!
Reply
#2

You need to add a variable that checks if the player agreed the rules.
I'm assuming you're using use The Godfather gamemode, so just add the varaible in the player's array [PlayerInfo],
Then give it back when a player joins your server.

pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1)
    {

        if(response)
        {
        new string[250];
        format(string, sizeof(string), "~g~Welcome ~w~To The ~p~Future ~w~Of ~r~SA:MP ~w~Gaming!");
        GameTextForPlayer(playerid, string, 5000, 4);
        PlayerInfo[pAgreedTerms][playerid] = 1;
        }
        else
        {
        new string[300];
        format(string, sizeof(string), "/n/n~w~You Selected ~b~Quit, ~w~Therefore You Were ~r~Kicked! ~w~Goodbye!");
        GameTextForPlayer(playerid, string, 999999999, 4);
        Kick(playerid);
        PlayerInfo[pAgreedTerms][playerid] = 0;
        }
        return 1;
    }
    return 0;
}
You need to change this line:
pawn Code:
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Some Simple Rules You Need To Follow...", "Cheating Will Result In An IP Ban. In This Case, You Will Not Be Un-Banned!\nRespect Everyone and Everyones' Property!\nAdministators Are The Boss, Do Not Second Guess Them!\nIf You Ignore An Admin, The Admin Can/Will Ban You, It's Up To Them!\nDo Not Ask The Admins/Moderators' To Do Things For You!\nConsider Yourself Warned!", "I Agree", "I Disagree");
With this:
pawn Code:
if(PlayerInfo[playerid][pAgreedTerms] != 1)
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Some Simple Rules You Need To Follow...", "Cheating Will Result In An IP Ban. In This Case, You Will Not Be Un-Banned!\nRespect Everyone and Everyones' Property!\nAdministators Are The Boss, Do Not Second Guess Them!\nIf You Ignore An Admin, The Admin Can/Will Ban You, It's Up To Them!\nDo Not Ask The Admins/Moderators' To Do Things For You!\nConsider Yourself Warned!", "I Agree", "I Disagree");
}
About the admins, just make a command that will change the pAgreedTerms to 0, and just show him the dialog again ;p
Reply
#3

Well, I am not using God Father, I am making a script from scratch... Can you still help me out?
Reply
#4

I'm going to try to make a little thing for you, it will create a file for every player who connected and saves if he/she did accept:
pawn Code:
#include <dini>

new PlayerFile[128];
new PlayerAgree[MAX_PLAYERS];
new PlayerName[24];
pawn Code:
public OnPlayerConnect(playerid)
{
  GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
  format(PlayerFile, sizeof(PlayerFile), "%s.txt", PlayerName);
  if(!dini_Exists(PlayerFile))
  {
   dini_Create(PlayerFile);
   dini_IntSet(PlayerFile, "agree", 0);
  }
  PlayerAgree[playerid] = dini_Int(PlayerFile, "agree");
  if(PlayerAgree[playerid] == 0) return ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Some Simple Rules You Need To Follow...", "Cheating Will Result In An IP Ban. In This Case, You Will Not Be Un-Banned!\nRespect Everyone and Everyones' Property!\nAdministators Are The Boss, Do Not Second Guess Them!\nIf You Ignore An Admin, The Admin Can/Will Ban You, It's Up To Them!\nDo Not Ask The Admins/Moderators' To Do Things For You!\nConsider Yourself Warned!", "I Agree", "I Disagree");
  return 1;
}
And the response:
pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
  GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
  format(PlayerFile, sizeof(PlayerFile), "%s.txt", PlayerName);
  if(dialogid == 1)
  {
    if(response)
    {
     new string[250];
     format(string, sizeof(string), "~g~Welcome ~w~To The ~p~Future ~w~Of ~r~SA:MP ~w~Gaming!");
     GameTextForPlayer(playerid, string, 5000, 4);
     PlayerAgree[playerid] = 1;
     dini_IntSet(PlayerFile, "agree", 1);
   }
   else
   {
     new string[300];
     format(string, sizeof(string), "/n/n~w~You Selected ~b~Quit, ~w~Therefore You Were ~r~Kicked! ~w~Goodbye!");
     GameTextForPlayer(playerid, string, 5000, 4);
     PlayerAgree[playerid] = 0;
     dini_IntSet(PlayerFile, "agree", 0);
     Kick(playerid);
   }
   return 1;
  }
  return 1;
}
Reply
#5

When I get the chance, I will test that. Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)