SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 18/03/2008, 08:26 PM   #1
Sandra18[NL]
Gangsta
 
Join Date: Jun 2007
Posts: 807
Reputation: 41
Default [INC] Rank/Level System [Version 2.0]

Rank/Level System

What is it:
With this include you can give players ranks.
There are several ways a player can promote.
You can let players have restrictions or permissions depending on their rank.

Ok, so in what ways can a player promote?
PromotionModes:

Promotionmode 0 = Players can only promote with SetPlayerRank(playerid, rankID);
Promotionmode 1 = Players will promote depending on their time (hours) spend online in the server
Promotionmode 2 = Players will promote depending on their number of people they killed.
Promotionmode 3 = Players will promote depending on their amount of cash (in dollars)
Promotionmode 4 = Players will promote depending on their number of visits to your server
Promotionmode 5 = Players will promote depending on their score

How to instal:
- Download Ranks.inc
- Create in your 'scriptfiles'-folder a new folder called 'PlayerFiles' (Note the cApS!!)
- Place on top of your gamemode:
Code:
#include <Ranks>
- Put in your OnPlayerConnect(playerid)-callback the following line:
Code:
S_OnPlayerConnect(playerid);
- Put in your OnPlayerDisconnect(playerid, reason)-callback the following line:
Code:
S_OnPlayerDisconnect(playerid);
- Put in your OnPlayerSpawn(playerid)-callback the following line:
Code:
S_OnPlayerSpawn(playerid);
- Put in your OnPlayerDeath(playerid, killerid, reason)-callback the following line:
Code:
S_OnPlayerDeath(killerid);

Now you can configure some ranks:

Put in your OnGameModeInit-callback the following line:
Code:
SetPromotionMode(0-5);
Use 1 of the 6 diffrent modes.

To add a new rank put in your OnGameModeInit-callback:
Code:
AddRank(rankID, const Name[], Requirement, Startmoney, Float:SpawnHealth, Float:SpawnArmour, SpawnWeapon, SpawnAmmo);
  • rankID: This is the ID of the new rank. Always use a new ID and do not skip an ID!!
  • const Name[]: This will be the name of the new Rank
  • Requirement:
    If your promotionmode is '0', it does't matter what you fill in there.
    If your promotionmode is '1', your have fill in the number of hours the player must play on your server.
    If your promotionmode is '2', your have fill in the number of kills the player must have to promote
    If your promotionmode is '3, your have fill in the amout of dollars the player at least must have
    If your promotionmode is '4', your have fill in the number of visits
    If your promotionmode is '5', your have fill in the score a player must at least must have
  • StartMoney: If the player connects to your server, he/she will recieve this amout of cash
  • SpawnHealth: The player will spawn with this amount of health (1-100)
  • SpawnArmour: The player will spawn with this amount of armour (1-100)
  • SpawnWeapon: When the player spawns, he/she will recieve this weapon (fill in weaponID)
  • SpawnAmmo: The amount of bullets for the SpawnWeapon

Example:
Code:
SetPromotionMode(2);
AddRank(0, "Noob", 0, 5000, 25.0, 0, 0, 0);
AddRank(1, "Newbie", 2, 7500, 50.0, 25.0, 24, 100);
AddRank(2, "Professional", 10, 10000, 75.0, 50.0, 31, 500);
AddRank(3, "Pwner", 20, 15000, 100.0, 100.0, 38, 2000);

Other Functions:
  • GetPlayerRank(playerid); Returns the rank of a player
  • SetPlayerRank(playerid, rankID); Change the players rank
  • GetRankInfo(playerid); Will show ingame info about his/her current Rank
  • GetPlayerStats(playerid); Will show ingame some stats of the player
  • ResetPlayerStats(playerid); Needs no further explanation
For every player a new file will be created. In there some stats will get saved.
You can do an IP-check to prevent people joining on someone elses name and f*uck up their stats.
Risk of IP-check: If the IP of a 'fair' players has been changed, his/hers stats will not get saved anymore!
To toggle this IP-check on/off use:
  • ToggleIpCheck(toggle); (Default = Off)

Commands you can use. (Put these in your gamemode):
Code:
if(strcmp(cmd, "/rankinfo", true) == 0)
{
  GetRankInfo(playerid);
  return 1;
}

if(strcmp(cmd, "/mystats", true) == 0)
{
  GetPlayerStats(playerid);
  return 1;
}
You can also create commands which only players with for example rank 3 can use:
Code:
if(strcmp(cmdtext, "/command", true)==0)
{
  if(GetPlayerRank(playerid) == 3)
  {
    //rest of command
  }
  else
  {
    SendClientMessage(playerid, 0xFF0000AA, "Sorry, this command is only for players with rank 3");
  }
  return 1;
}
Screens:







Update History:
[Version 1.0]:
  • First Release

[Version 2.0]:
  • Added PromotionMode '0' (player can only promote manually with SetPlayerRank)
  • Added SetPlayerRank(playerid, rankID);

Download:

[Version 2.0]:
- Ranks.inc (MediaFire)
- Ranks.inc (SendSpace)
- Ranks.inc (myfreefilehosting.com)

[Version 1.0]:
- Ranks.inc (MediaFire)

You also need dini.inc, dutils.inc and dudb.inc
If you don't have these includes, download this .rar file: (Credits to Dracoblue ofcourse )
- DiniIncludes.rar (Mediafire)

Notes:

- This Include checks only once a minute if a player is ready for promotion!
So if for example a player exeeds the required kills for promotion, he/she might promote 50 seconds later.

- Only use SetPlayerRank when PromotionMode is set to '0'!!!!

- If you're going to use this in your server, please give me credits.
- If you find any bugs, please report them here.

Have fun with it

=>Sandra<=



Sandra18[NL] is offline   Reply With Quote
Old 18/03/2008, 08:27 PM   #2
blewert
Gangsta
 
blewert's Avatar
 
Join Date: Jan 2008
Location: Wales
Posts: 893
Reputation: 134
Default Re: [INC] Rank/Level System

:O i thought it would never come true.... you made another inc which is brilliant!

nice job sandra, keep them coming


DEFINETLY gonna use this
__________________
blewert is offline   Reply With Quote
Old 18/03/2008, 08:46 PM   #3
Marcel
Gangsta
 
Join Date: Nov 2007
Posts: 560
Reputation: 2
Default Re: [INC] Rank/Level System

blewert, it's an include not a filterscript
Marcel is offline   Reply With Quote
Old 18/03/2008, 08:47 PM   #4
blewert
Gangsta
 
blewert's Avatar
 
Join Date: Jan 2008
Location: Wales
Posts: 893
Reputation: 134
Default Re: [INC] Rank/Level System

Quote:
Originally Posted by Marcel
blewert, it's an include not a filterscript
oops, still good though

PS:edited
__________________
blewert is offline   Reply With Quote
Old 18/03/2008, 08:47 PM   #5
Rks25
High-roller
 
Join Date: Jun 2007
Posts: 2,924
Reputation: 4
Default Re: [INC] Rank/Level System

Can you only use 1 promotionmode like SetPromotion(1); or more?
Cuz i want like the visit thing as promotion and kills, that possible?
Rks25 is offline   Reply With Quote
Old 18/03/2008, 08:49 PM   #6
Sandra18[NL]
Gangsta
 
Join Date: Jun 2007
Posts: 807
Reputation: 41
Default Re: [INC] Rank/Level System

Thank you very much

I also added an example how you can make commands for a specific rank only

Example:

Code:
if(strcmp(cmdtext, "/command", true)==0)
{
  if(GetPlayerRank(playerid) == 3)
  {
    //rest of command
  }
  else
  {
    SendClientMessage(playerid, 0xFF0000AA, "Sorry, this command is only for players with rank 3");
  }
  return 1;
}
@ Rks, at the moment only 1 mode at a time
Sandra18[NL] is offline   Reply With Quote
Old 18/03/2008, 08:51 PM   #7
blewert
Gangsta
 
blewert's Avatar
 
Join Date: Jan 2008
Location: Wales
Posts: 893
Reputation: 134
Default Re: [INC] Rank/Level System

Quote:
Originally Posted by =>Sandra<=
Thank you very much

I also added an example how you can make commands for a specific rank only

Example:

Code:
if(strcmp(cmdtext, "/command", true)==0)
{
  if(GetPlayerRank(playerid) == 3)
  {
    //rest of command
  }
  else
  {
    SendClientMessage(playerid, 0xFF0000AA, "Sorry, this command is only for players with rank 3");
  }
  return 1;
}
@ Rks, at the moment only 1 mode at a time
Sorry for offtopicness but happy 500th post
__________________
blewert is offline   Reply With Quote
Old 19/03/2008, 12:17 AM   #8
Sandra18[NL]
Gangsta
 
Join Date: Jun 2007
Posts: 807
Reputation: 41
Default Re: [INC] Rank/Level System

Lol, thanks :P
Sandra18[NL] is offline   Reply With Quote
Old 19/03/2008, 07:18 AM   #9
aroma
Little Clucker
 
Join Date: Feb 2008
Posts: 44
Reputation: 0
Default Re: [INC] Rank/Level System

Im getting these errors

Code:
E:\Games\San Andreas\GTA San Andreas\samp\gamemodes\penlv.pwn(2372) : warning 235: public function lacks forward declaration (symbol "S_OnPlayerConnect")
E:\Games\San Andreas\GTA San Andreas\samp\gamemodes\penlv.pwn(2373) : error 021: symbol already defined: "S_OnPlayerConnect"
E:\Games\San Andreas\GTA San Andreas\samp\gamemodes\penlv.pwn(2594) : warning 235: public function lacks forward declaration (symbol "S_OnPlayerDisconnect")
E:\Games\San Andreas\GTA San Andreas\samp\gamemodes\penlv.pwn(2594) : error 025: function heading differs from prototype
E:\Games\San Andreas\GTA San Andreas\samp\gamemodes\penlv.pwn(2595) : error 021: symbol already defined: "S_OnPlayerDisconnect"
E:\Games\San Andreas\GTA San Andreas\samp\gamemodes\penlv.pwn(2746) : warning 235: public function lacks forward declaration (symbol "S_OnPlayerDeath")
E:\Games\San Andreas\GTA San Andreas\samp\gamemodes\penlv.pwn(2746) : error 025: function heading differs from prototype
E:\Games\San Andreas\GTA San Andreas\samp\gamemodes\penlv.pwn(2747) : error 021: symbol already defined: "S_OnPlayerDeath"
E:\Games\San Andreas\GTA San Andreas\samp\gamemodes\penlv.pwn(3260) : warning 235: public function lacks forward declaration (symbol "S_OnPlayerSpawn")
E:\Games\San Andreas\GTA San Andreas\samp\gamemodes\penlv.pwn(3261) : error 021: symbol already defined: "S_OnPlayerSpawn"
E:\Games\San Andreas\GTA San Andreas\samp\gamemodes\penlv.pwn(6221) : error 047: array sizes do not match, or destination array is too small
E:\Games\San Andreas\GTA San Andreas\samp\gamemodes\penlv.pwn(6222) : error 047: array sizes do not match, or destination array is too small
E:\Games\San Andreas\GTA San Andreas\samp\gamemodes\penlv.pwn(6689) : error 017: undefined symbol "rankID"
E:\Games\San Andreas\GTA San Andreas\samp\gamemodes\penlv.pwn(6689) : error 029: invalid expression, assumed zero
E:\Games\San Andreas\GTA San Andreas\samp\gamemodes\penlv.pwn(6689) : error 017: undefined symbol "Name"
E:\Games\San Andreas\GTA San Andreas\samp\gamemodes\penlv.pwn(6689) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase
aroma is offline   Reply With Quote
Old 19/03/2008, 08:34 AM   #10
Djrasim
Big Clucker
 
Join Date: Aug 2007
Posts: 140
Reputation: 0
Default Re: [INC] Rank/Level System

Nice Very Usefull , Thanks

Regards,

Rasim
Djrasim is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Rank(Level Systeam) Stuff.lv Help Archive 0 29/03/2010 07:55 AM
Rank/Level System hallo31 Help Archive 4 24/11/2009 03:23 PM
Rank (Level System) NOT ADMIN, BUT PLAYER [AG]_Just Help Archive 7 02/10/2009 03:47 PM
Rank/level problem flamethrower Help Archive 1 06/08/2009 12:30 AM
[FilterScript] [FS] Level System Version 1.7 by Oxside (2009) Oxside Filterscripts 12 02/04/2009 06:03 PM


All times are GMT. The time now is 01:29 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.