|
|||||||
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Big Clucker
![]() ![]() Join Date: May 2012
Posts: 97
Reputation: 6
|
Hey guys I am writing this tutorial of making a VIP system with saving.
First of all I use dini and sscanf because they are veey easy to use. So we will need dini,ZCMD and sscanf. You can find them on google .So lets start.. pawn Code:
Here is the starting of our script. As you all must be knowing that these are the most important parts of script because these files within the brackets have very inportant functions we will be using. Now lets begin coding!! pawn Code:
Add this to the to of the script just below the #includes.In this we use enum to have variable-vipdata in one head variable-vip.Then we declare a new variable "name" and evipdata[MAX_PLAYERS][vip] we have used this so that it can be used on all players and [vip] is the main variable as given above. We then we create a new variable file and format it to the settings file which should be located in /scriptfiles/vipsys/settings.ini Now, pawn Code:
In here we first call the OnGamemodeInit function and then using fexists we check that if the file(defined above) exists. If it does not, as in first case, we use dini_Create to create that file and then feed the max lvl a vip can be. If the file already exists then we put the value of maxlevel in the maxlvl variable using dini_Int.Then we return 1; for successful completion of this task. Now for next part. pawn Code:
So here we have used OnPlayerConnect function.In this we created a new variable "ufile" and formatted it to the player's vip file in /scriptfiles/vipsys/users. Then again using fexists we check if the file exists. If not like this case, we created the file of the player and then feeded the vip level to 0 using dini_Create and dini_IntSet. If the file exists then we assign the value of vip level to our new variable using dini_Int. Now the main controlling is done now we will make /setvip command. pawn Code:
Now we are at the last part of our script. Here we make 2 more variables.Then we check if the player is rcon admin. If he is not the script would not show anything.Then we see if he has typed the parameters needed for the comand to work. If he has it will check if the parameter is greater than the max permitted. If it is also true a new variable will be made that is name2 and then it will find the players file and edit it. Now you guys can try tweaking it. and for this one to work you will need two folders. One inside scriptfiles/vipsys and other in scriptfiles/users.. Have fun and if you find a problem just ask me.. ![]() So guys thats it i will update it for more new things.
Last edited by electrux; 25/07/2012 at 10:03 AM. |
|
|
|
|
|
#2 |
|
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Feb 2010
Posts: 1,306
Reputation: 86
|
It's good, but why not use something faster like Y_ini or DJson?
|
|
|
|
|
|
#3 |
|
Big Clucker
![]() ![]() Join Date: May 2012
Posts: 97
Reputation: 6
|
because dini and sscanf are veryyy easy to use
Last edited by electrux; 25/07/2012 at 09:59 AM. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Tutorial] Making a simple PM system with ZCMD & sscanf | Toni | Tutorials | 27 | 18/05/2013 05:10 PM |
| [Tutorial] Making /vw (virtualworld) command using ZCMD and sscanf | electrux | Tutorials | 19 | 24/07/2012 10:51 AM |
| [Tutorial] How to make a easy /setvip command (zcmd & sscanf) | Tanush123 | Tutorials | 18 | 23/07/2012 12:59 PM |