/rules help
#1

hi all i would like to no ,that if a player types /rules then they recieve some money,but so it doesnt get abused how i make it so it can only be used once per account

my command is

pawn Code:
if(!strcmp(command, "/rules", true))
    {
        new str[1111];
        str = "{FF9900}No cheating, glitching or using any script exploit! Every cheater or bug MUST be reported by /report or on forum\nNo ramming or blocking\nNo carjacking! Locking vehicles not owned by you\nNo killing, punching, carkilling or running over\nNo Spamming\nNo flaming, racism or disrespecting other players\nNo asking for admin level";
        ShowPlayerDialog(playerid,0,DIALOG_STYLE_MSGBOX,"{FF0000}Server Rules",str,"Ok","Back");
        return 1;
    }
Reply
#2

Use a timer https://sampwiki.blast.hk/wiki/SetTimer
Reply
#3

create a new variable, and check if they already viewed the rules with it.
like :

top of script.
pawn Code:
new viewedRules[MAX_PLAYERS] = 0;
/rules
pawn Code:
if(!strcmp(command, "/rules", true))
    {
        new str[1111];
        if(viewedRules[playerid] != 0)
        {
            str = "{FF9900}No cheating, glitching or using any script exploit! Every cheater or bug MUST be reported by /report or on forum\nNo ramming or blocking\nNo carjacking! Locking vehicles not owned by you\nNo killing, punching, carkilling or running over\nNo Spamming\nNo flaming, racism or disrespecting other players\nNo asking for admin level";
            ShowPlayerDialog(playerid,0,DIALOG_STYLE_MSGBOX,"{FF0000}Server Rules",str,"Ok","Back");
        }
        else if(viewedRules[playerid] == 0)
        {
            str = "{FF9900}No cheating, glitching or using any script exploit! Every cheater or bug MUST be reported by /report or on forum\nNo ramming or blocking\nNo carjacking! Locking vehicles not owned by you\nNo killing, punching, carkilling or running over\nNo Spamming\nNo flaming, racism or disrespecting other players\nNo asking for admin level";
            ShowPlayerDialog(playerid,0,DIALOG_STYLE_MSGBOX,"{FF0000}Server Rules",str,"Ok","Back");
            // Add the money here.
            viewedRules[playerid] = 1;
        }
        return 1;
    }
He can still view the rules, but he won't get the money.
Reply
#4

Quote:
Originally Posted by KeeDee
View Post
This is not needed at all!

Create a new variable, and when you do /rules for the first time, it changes the variable to 1. Then when he disconnects save the variable in a file. Then check when a player does /rules, if the variable is 1, and when its 1, DONT give him the money. Kinda fuzzy explained, i know, but (i hope so atleast) you can get started with it.

Edit:
Read above, that will get you started,, lol
Also save the variable in a file, so it doenst get abused when you re-connect
Reply
#5

but how will it workif they havent clicked accept ? becuase it works in the gm you dont have to accept them so if they click back it will just give them money ?
Reply
#6

you can do this with another variable

top:
pawn Code:
new getsMoney[MAX_PLAYERS] = 0;
OnDialogResponse....

pawn Code:
if(dialogid == 0)
{
       if(response)
       {
              if(getsMoney[playerid] == 1)
              {
                     // Add the money here.
              }
       }
}
edit the /rules too to this :

pawn Code:
if(!strcmp(command, "/rules", true))
    {
        new str[1111];
        if(viewedRules[playerid] != 0)
        {
            str = "{FF9900}No cheating, glitching or using any script exploit! Every cheater or bug MUST be reported by /report or on forum\nNo ramming or blocking\nNo carjacking! Locking vehicles not owned by you\nNo killing, punching, carkilling or running over\nNo Spamming\nNo flaming, racism or disrespecting other players\nNo asking for admin level";
            ShowPlayerDialog(playerid,0,DIALOG_STYLE_MSGBOX,"{FF0000}Server Rules",str,"Ok","Back");
            getsMoney[playerid] = 0;
        }
        else if(viewedRules[playerid] == 0)
        {
            str = "{FF9900}No cheating, glitching or using any script exploit! Every cheater or bug MUST be reported by /report or on forum\nNo ramming or blocking\nNo carjacking! Locking vehicles not owned by you\nNo killing, punching, carkilling or running over\nNo Spamming\nNo flaming, racism or disrespecting other players\nNo asking for admin level";
            ShowPlayerDialog(playerid,0,DIALOG_STYLE_MSGBOX,"{FF0000}Server Rules",str,"Ok","Back");
            // Add the money here.
            viewedRules[playerid] = 1;
            getsMoney[playerid] = 1;
        }
        return 1;
    }
Reply
#7

how would i make the variable tho im just learning with pawn, i guess it would save to a text file of some sort in scriptfiles.

and at last post im just getting confused now.
Reply
#8

i've added the functions to my last post.
Reply
#9

do you have teamviewer ? or join me ? to show u what i mean
Reply
#10

You have to make it saving in the users file, like

RulesViewed=1

You can see an example in the godfather script
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)