[Include] [INC] Rank/Level System [Version 2.0]
#1

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<=



Reply


Messages In This Thread
[INC] Rank/Level System [Version 2.0] - by Sandra18[NL] - 18.03.2008, 20:26
Re: [INC] Rank/Level System - by blewert - 18.03.2008, 20:27
Re: [INC] Rank/Level System - by Marcel - 18.03.2008, 20:46
Re: [INC] Rank/Level System - by blewert - 18.03.2008, 20:47
Re: [INC] Rank/Level System - by Rks25 - 18.03.2008, 20:47
Re: [INC] Rank/Level System - by Sandra18[NL] - 18.03.2008, 20:49
Re: [INC] Rank/Level System - by blewert - 18.03.2008, 20:51
Re: [INC] Rank/Level System - by Sandra18[NL] - 19.03.2008, 00:17
Re: [INC] Rank/Level System - by aroma - 19.03.2008, 07:18
Re: [INC] Rank/Level System - by Djrasim - 19.03.2008, 08:34
Re: [INC] Rank/Level System - by Sandra18[NL] - 19.03.2008, 12:02
Re: [INC] Rank/Level System - by russo666 - 19.03.2008, 12:30
Re: [INC] Rank/Level System - by aroma - 19.03.2008, 14:18
Re: [INC] Rank/Level System - by Zh3r0 - 19.03.2008, 14:21
Re: [INC] Rank/Level System - by P1nd3r - 19.03.2008, 14:37
Re: [INC] Rank/Level System - by Binebik - 19.03.2008, 17:17
Re: [INC] Rank/Level System - by Sandra18[NL] - 19.03.2008, 17:19
Re: [INC] Rank/Level System - by Binebik - 19.03.2008, 17:24
Re: [INC] Rank/Level System - by Binebik - 19.03.2008, 17:27
Re: [INC] Rank/Level System [Version 2.0] - by Sandra18[NL] - 19.03.2008, 17:41
Re: [INC] Rank/Level System [Version 2.0] - by aroma - 19.03.2008, 17:46
Re: [INC] Rank/Level System [Version 2.0] - by Binebik - 19.03.2008, 17:51
Re: [INC] Rank/Level System [Version 2.0] - by [LDT]LuxurY - 19.03.2008, 17:52
Re: [INC] Rank/Level System [Version 2.0] - by Sandra18[NL] - 19.03.2008, 17:58
Re: [INC] Rank/Level System [Version 2.0] - by BioFreeze - 19.03.2008, 18:04
Re: [INC] Rank/Level System [Version 2.0] - by Binebik - 19.03.2008, 18:10
Re: [INC] Rank/Level System [Version 2.0] - by Sandra18[NL] - 19.03.2008, 18:13
Re: [INC] Rank/Level System [Version 2.0] - by Binebik - 19.03.2008, 18:20
Re: [INC] Rank/Level System [Version 2.0] - by Binebik - 19.03.2008, 18:37
Re: [INC] Rank/Level System [Version 2.0] - by Sandra18[NL] - 25.03.2008, 17:56
Re: [INC] Rank/Level System [Version 2.0] - by Zero_MC - 25.03.2008, 17:59
Re: [INC] Rank/Level System [Version 2.0] - by Nakash - 26.03.2008, 13:06
Re: [INC] Rank/Level System [Version 2.0] - by Sandra18[NL] - 26.03.2008, 13:08
Re: [INC] Rank/Level System [Version 2.0] - by Nakash - 26.03.2008, 14:39
Re: [INC] Rank/Level System [Version 2.0] - by Sandra18[NL] - 26.03.2008, 16:15
Re: [INC] Rank/Level System [Version 2.0] - by Nakash - 26.03.2008, 17:01
Re: [INC] Rank/Level System [Version 2.0] - by spt10pd - 26.03.2008, 18:25
Re: [INC] Rank/Level System [Version 2.0] - by Sandra18[NL] - 26.03.2008, 18:48
Re: [INC] Rank/Level System [Version 2.0] - by Zero_MC - 27.03.2008, 12:39
Re: [INC] Rank/Level System [Version 2.0] - by agustito37 - 26.05.2008, 14:15
Re: [INC] Rank/Level System [Version 2.0] - by Cajak - 31.05.2008, 16:10
Re: [INC] Rank/Level System [Version 2.0] - by Hernaner28 - 30.06.2008, 15:24
Re: [INC] Rank/Level System [Version 2.0] - by winker2k6 - 09.07.2008, 08:01
Re: [INC] Rank/Level System [Version 2.0] - by Basss - 10.07.2008, 08:22
Re: [INC] Rank/Level System [Version 2.0] - by cedryk_cedryk - 30.07.2008, 17:55
Re: [INC] Rank/Level System [Version 2.0] - by lsrp - 07.09.2008, 21:21
Re: [INC] Rank/Level System [Version 2.0] - by Don_Vito - 20.10.2008, 13:43
Re: [INC] Rank/Level System [Version 2.0] - by Toad - 20.10.2008, 18:32
Re: [INC] Rank/Level System [Version 2.0] - by GORE - 05.02.2009, 11:51
Re: [INC] Rank/Level System [Version 2.0] - by MaykoX - 28.02.2010, 11:00
Re: [INC] Rank/Level System [Version 2.0] - by hardstop - 06.03.2010, 22:41
Re: [INC] Rank/Level System [Version 2.0] - by aircombat - 07.03.2010, 00:32
Re: [INC] Rank/Level System [Version 2.0] - by Postalityjr - 27.03.2010, 05:31
Re: [INC] Rank/Level System - by N1n0 - 29.04.2010, 16:15
Re: [INC] Rank/Level System [Version 2.0] - by Kasis - 12.01.2011, 12:41
Re: [INC] Rank/Level System [Version 2.0] - by [nB]Flow - 18.01.2011, 05:15
Re : [INC] Rank/Level System [Version 2.0] - by Amine_Mejrhirrou - 31.01.2011, 20:25
Re: [INC] Rank/Level System [Version 2.0] - by [nL]W0rfleR - 09.02.2011, 06:24
Re: [INC] Rank/Level System [Version 2.0] - by Kyro - 18.02.2011, 12:09
Re: [INC] Rank/Level System [Version 2.0] - by Zh3r0 - 18.02.2011, 12:12
Re: [INC] Rank/Level System [Version 2.0] - by Kyro - 18.02.2011, 13:04
Re: [INC] Rank/Level System [Version 2.0] - by Zh3r0 - 18.02.2011, 13:12
Re: [INC] Rank/Level System [Version 2.0] - by Kyro - 18.02.2011, 15:25
Re: [INC] Rank/Level System [Version 2.0] - by Zh3r0 - 18.02.2011, 15:36
Re: [INC] Rank/Level System [Version 2.0] - by Davz*|*Criss - 13.03.2011, 16:19
Re: [INC] Rank/Level System [Version 2.0] - by Bliitzz - 13.03.2011, 18:19
Re: [INC] Rank/Level System [Version 2.0] - by SpiderWalk - 15.05.2011, 15:39
Re: [INC] Rank/Level System [Version 2.0] - by [M.A]Angel[M.A] - 16.05.2011, 10:46
Re: [INC] Rank/Level System [Version 2.0] - by [BP]Tony - 24.06.2011, 21:50
AW: [INC] Rank/Level System [Version 2.0] - by Forbidden - 24.06.2011, 22:21
Re: [INC] Rank/Level System [Version 2.0] - by misho1 - 03.08.2011, 11:34
Re: [INC] Rank/Level System [Version 2.0] - by Ratzu - 04.08.2011, 08:08
Re: [INC] Rank/Level System [Version 2.0] - by suhrab_mujeeb - 09.08.2011, 08:52
Re: [INC] Rank/Level System [Version 2.0] - by FireWol - 10.08.2011, 14:53
Re: [INC] Rank/Level System [Version 2.0] - by xMaGmOtAnEtHx - 21.09.2012, 01:10
Re: [INC] Rank/Level System [Version 2.0] - by Jason_Statham - 22.09.2012, 10:35

Forum Jump:


Users browsing this thread: 16 Guest(s)