Rules help - 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: Rules help (
/showthread.php?tid=296078)
Rules help -
Trucker[UK] - 09.11.2011
Hey,
Can anyone help me with this
Код:
// Display a message if the player hasn't accepted the rules yet
if (APlayerData[playerid][RulesRead] == false)
SendClientMessage(playerid, 0xFFFFFFFF, "{FFFF00}Please Read Our {FF0000}/rules{FFFF00} Before Playing");
next
Код:
APlayerData[playerid][RulesRead] = false;
case DialogRules: Dialog_Rules(playerid, response);
Playercommands.inc file
Код:
// This command displays the rules of the server
COMMAND:rules(playerid, params[])
{
// Setup local variables
new Msg[2000];
// Send the command to all admins so they can see it
SendAdminText(playerid, "/rules", params);
// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
// Construct the rules
format(Msg, 2000, "%s1. Always drive on the right side of the road\n", Msg);
format(Msg, 2000, "%s2. No flaming or disrespecting other players\n", Msg);
format(Msg, 2000, "%s3. Main language is english in main chat. others use /pm\n", Msg);
format(Msg, 2000, "%s4. Don't use any hacks, you'll be banned\n", Msg);
format(Msg, 2000, "%s5. No spamming on the chat\n", Msg);
format(Msg, 2000, "%s6. No car-jacking allowed\n", Msg);
format(Msg, 2000, "%s7. No Deathmatching police can only use weapons to disable suspects cars\n", Msg);
format(Msg, 2000, "%s8. Do NOT ask to be admin apply on the forums and wait for a reply\n", Msg);
format(Msg, 2000, "%s9. Stay Out of the Admin Area\n", Msg);
// Show a dialog that shows the rules
ShowPlayerDialog(playerid, DialogRules, DIALOG_STYLE_MSGBOX, "Rules of the server:", Msg, "Accept", TXT_DialogButtonCancel);
}
else
return 0;
// Let the server know that this was a valid command
return 1;
}
I would like to make it that when a new player joins the server that has not been with the server, i want to make it that when u connect the rules dialog automatically appears and you have to accept the rules first before you can play on the server and if you hit decline it automatic's kick you.
Thanks
Re: Rules help -
SmiT - 09.11.2011
pawn Код:
public OnPlayerConnect( playerid )
{
if ( APlayerData[ playerid ][ RulesRead ] == false )
{
new
Msg[ 2000 ];
format(Msg, 2000, "%s1. Always drive on the right side of the road\n", Msg);
format(Msg, 2000, "%s2. No flaming or disrespecting other players\n", Msg);
format(Msg, 2000, "%s3. Main language is english in main chat. others use /pm\n", Msg);
format(Msg, 2000, "%s4. Don't use any hacks, you'll be banned\n", Msg);
format(Msg, 2000, "%s5. No spamming on the chat\n", Msg);
format(Msg, 2000, "%s6. No car-jacking allowed\n", Msg);
format(Msg, 2000, "%s7. No Deathmatching police can only use weapons to disable suspects cars\n", Msg);
format(Msg, 2000, "%s8. Do NOT ask to be admin apply on the forums and wait for a reply\n", Msg);
format(Msg, 2000, "%s9. Stay Out of the Admin Area\n", Msg);
ShowPlayerDialog(playerid, DialogRules, DIALOG_STYLE_MSGBOX, "Rules of the server:", Msg, "Accept", TXT_DialogButtonCancel);
}
return ( true );
}
public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[])
{
switch ( dialogid )
{
case DialogRules:
{
if ( !response )
{
SendClientMessage( playerid, -1, #You didnt accept the rules and you have been kicked );
Kick ( playerid );
}
if ( response )
{
SendClientMessage( playerid, -1, #You have accepted the rules );
APlayerData[ playerid ][ RulesRead ] = true;
}
}
}
return ( false );
}