SA-MP Forums Archive
[Include] [INC] Rank/Level System [Version 2.0] - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] [INC] Rank/Level System [Version 2.0] (/showthread.php?tid=30650)

Pages: 1 2 3 4


[INC] Rank/Level System [Version 2.0] - Sandra18[NL] - 18.03.2008

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);
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: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: 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]: [Version 2.0]: 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<=






Re: [INC] Rank/Level System - blewert - 18.03.2008

: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


Re: [INC] Rank/Level System - Marcel - 18.03.2008

blewert, it's an include not a filterscript


Re: [INC] Rank/Level System - blewert - 18.03.2008

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

PS:edited


Re: [INC] Rank/Level System - Rks25 - 18.03.2008

Can you only use 1 promotionmode like SetPromotion(1); or more?
Cuz i want like the visit thing as promotion and kills, that possible?


Re: [INC] Rank/Level System - Sandra18[NL] - 18.03.2008

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



Re: [INC] Rank/Level System - blewert - 18.03.2008

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


Re: [INC] Rank/Level System - Sandra18[NL] - 19.03.2008

Lol, thanks :P


Re: [INC] Rank/Level System - aroma - 19.03.2008

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 © 1997-2006, ITB CompuPhase



Re: [INC] Rank/Level System - Djrasim - 19.03.2008

Nice Very Usefull , Thanks

Regards,

Rasim


Re: [INC] Rank/Level System - Sandra18[NL] - 19.03.2008

@Aroma,

You properbly already have functions called
S_OnPlayerConnect
S_OnPlayerDisconnect
S_OnPlayerSpawn
and S_OnPlayerDeath


Re: [INC] Rank/Level System - russo666 - 19.03.2008

nice.


Re: [INC] Rank/Level System - aroma - 19.03.2008

Quote:
Originally Posted by =>Sandra<=
@Aroma,

You properbly already have functions called
S_OnPlayerConnect
S_OnPlayerDisconnect
S_OnPlayerSpawn
and S_OnPlayerDeath
No i have it called public OnPlayerConnect


Re: [INC] Rank/Level System - Zh3r0 - 19.03.2008

[size=12pt] well =>Sandra<= i can't believe you are doing Such as beatiful [fs] Thx a lot Sandra THX
i have to ask you something are you a GIRL?? becouse you are GREAT on [FS] if yes well i Never seen something Like That
BtW:: Nice work On all th [fs] Keep Up =>Sandra<= be the Best Cya


Re: [INC] Rank/Level System - P1nd3r - 19.03.2008

wow this is another excellent INC.


Re: [INC] Rank/Level System - Binebik - 19.03.2008

Hey i got a question, i want multiples lvles, this is for my RPG server, also for the beginning, somthing like 30 lvles, how do i do it then?


Re: [INC] Rank/Level System - Sandra18[NL] - 19.03.2008

I already gave an example in the first post:

Код:
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);
You can add as many as you want.


Re: [INC] Rank/Level System - Binebik - 19.03.2008

Ok thanks, but do u have a SetPlayerLevel command? also to remove/set a lvl to a player, this is for the admins..


Re: [INC] Rank/Level System - Binebik - 19.03.2008

Sry for so many questions, but heres an other

In my server i have that TAB, shows the players money as score, how can i do that so it shows player rank/lvl?


Re: [INC] Rank/Level System [Version 2.0] - Sandra18[NL] - 19.03.2008

I made a new version:

I added:

PromotionMode '0'
With this mode, players can only promote manually with SetPlayerRank(playerid, rankID);

SetPlayerRank(playerid, rankID);
With this function you can promote a player manually

Note: Only use SetPlayerRank when PromotionMode is set to '0'!!!!


Quote:
Originally Posted by Binebik
Sry for so many questions, but heres an other

In my server i have that TAB, shows the players money as score, how can i do that so it shows player rank/lvl?
You can add this in your Gamemode:

@ OnGameModeInit():
Код:
SetTimer("UpdateScores", 10000, 1);
And somewhere else in your script (for example at the bottom of the script):
Код:
forward UpdateScores();
public UpdateScores()
{
  for(new i; i<MAX_PLAYERS; i++)
  {
    if(IsPlayerConnected(i))
    {
      SetPlayerScore(i, GetPlayerRank(i));
    }
  }
}