[Tutorial] Making A Simple Rank System
#1

This Is A Very Simple Rank System By Me I Only Use SendClientMessage To Make This Rank System.


To Start With Making This Simple System You Need Color Defines So At The Top Of Your Script Put This Defines

STEP 1

Code:
#define COLOR_GREEN 0x008000FF
#define COLOR_BLUE 0x0000FFFF
#define COLOR_BRIGHTRED 0xFF000AAA
#define COLOR_AQUA 0x00FFFFAA
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_BEIGE 0xFFF8DCAA
#define COLOR_BLACK 0x000000AA
#define COLOR_LIGHTERBLUE 0x00BFFFAA
#define COLOR_BLUELIGHT 0x1E90FFAA
#define COLOR_BLUEMEDIUM 0x0000CDAA
#define COLOR_BLUEDARK 0x00008BAA
#define COLOR_PINK 0xFF1493AA
#define COLOR_PINKDARK 0xFF00FFAA
#define COLOR_GREENLIGHT 0x00FF00AA
#define COLOR_GREENDARK 0x006400AA
#define COLOR_MAROON 0x800000AA
#define COLOR_OKER 0x808000AA
#define COLOR_ORANGE 0xFF4500AA
#define COLOR_ORANGELIGHT 0xFF8C00AA
#define COLOR_PURPLE 0x800080AA
#define COLOR_VIOLETDARK 0x9400D3AA
#define COLOR_INDIGO 0xAB0082AA
#define COLOR_RED 0xFF0000AA
#define COLOR_SAND 0xFFDEADAA
#define COLOR_SILVER 0xC0C0C0AA
#define COLOR_TEAL 0x008080AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_GOLD 0xFFD700AA
#define COLOR_BROWN 0x8B4513AA
#define COLOR_BROWNLIGHT 0xA0522DAA
#define COLOR_GRAY 0xA9A9A9AA
#define COLOR_GRAYDARK 0x696969AA
#define COLOR_INVISIBLE 0xFFFFFF00
So As I Told I Will Make A Messaging And Very Simple System Of Rank So I Start Scripting With

Code:
public OnPlayerCommandText(playerid, cmdtext[])
So First Of All I Am Going To Make A myrank Command To See What Is Your Rank As I Am Using ZCMD

I Will Script Like I Have 3 Ranks Suppose Now I Am Doing Like This

Code:
CMD:myrank(playerid, params[])
{
    if (GetPlayerScore(playerid) >= 0 && GetPlayerScore(playerid) <= 100)
    {
    SendClientMessage(playerid, COLOR_RED,"Your Are A Soldier");
    }
    if (GetPlayerScore(playerid) >= 100 && GetPlayerScore(playerid) <= 200)
    {
    SendClientMessage(playerid, COLOR_RED,"Your Are A Colonel");
    }
    if (GetPlayerScore(playerid) >= 200)
    {
    SendClientMessage(playerid, COLOR_RED,"Your Are A Commander");
    }
    return 1;
}
So As You Guys Know You Guys Saw This Variable if

Code:
if (GetPlayerScore(playerid) >= 0 && GetPlayerScore(playerid) <= 100)
As We Are Making Simple Rank System We Should Give Scores For Rank So If Player Score Is 0 They Will Get

The Message From
Code:
SendClientMessage
Variable That That Players Rank Is Soldier With As We Have

Score 0+ But 100 Low We Gave That && 100 To Recognize That If Below 100 And More Than 0 Then Players

Rank Will Be Soldier So Same Thing Goes To The Rest 2 Ranks And Last One You Saw We Only Gave 200 And

Not && Because Over 200+ Score Is Rank Commander To End Rank System We Did This


Step 2


Now In Step 2 We Need To Put A Command So Players Can See How Many Ranks Are There And How Much Score

Is Needed For What Rank For Making That I Am Using A Simple Dialog System Ok Watch


CMD:ranks(playerid, params[])
{
ShowPlayerDialog(playerid, 12516, DIALOG_STYLE_MSGBOX,"{FFFF00}Ranks","{FFF000}Rank 1 Soldier (0 Scores)\n{F235FF}Rank 2 Colonel (100 Scores)\n{00FF32}Rank 3 Colonel (200 Scoores))","Okay","");
return 1;
}

So I Have Used An Advanced Dialog System To Create This As It Makes The Ranks Look Awesome! So I Guess

You Guys Don't Need Any Explanation For It As You Guys Already Know I Just Put In Names For It


Step 3 Final Step


So We Have Finished Our Simple Rank System 90% So Last Step Is This We Are Gonna Add Some Features To

It Like I Am Using On Player Spawn Here See

Code:
public OnPlayerSpawn(playerid)
{
    if (GetPlayerScore(playerid) >= 0 && GetPlayerScore(playerid) <= 100)
    {
    SetPlayerHealth(playerid, 100);
    SendClientMessage(playerid, COLOR_RED,"Your Rank Is Soldier Therefore You Spawn With 100 Health");
    }
    if (GetPlayerScore(playerid) >= 100 && GetPlayerScore(playerid) <= 200)
    {
    SetPlayerHealth(playerid, 100);
    SetPlayerArmour(playerid, 50);
    SendClientMessage(playerid, COLOR_RED,"Your Rank Is Colonel Therefore You Spawn With 100 Health And 50 Armour");
    }
    if (GetPlayerScore(playerid) >= 200)
    {
    SetPlayerHealth(playerid, 100);
    SetPlayerArmour(playerid, 100);
    SendClientMessage(playerid, COLOR_RED,"Your Rank Is Commander Therefore You Spawn With 100 Health And 100 Armour");
    }
	return 1;
}
So As You See I Used
Code:
if (GetPlayerScore(playerid) >= 0 && GetPlayerScore(playerid) <= 100)
Again Because Remember When I Used 0 Score To Mention That It Is Soldier Rank So When Player Spawn He Gets

100 Health As His Score Is Below 100 But Over 0 So He Gets Message When Ever Spawn That As His Rank

Is Soldier He Has 100 Health So Similar For The Next One I Just Gave 50 Armour More Bonus So There Is

Written In The SendClientMessage That Your Rank Is Colonel Therefore You Spawn With 100 Health And 50 Armour

So That Players Know That This 50 Armour Is The Bonus Of Rank Colonel But No One Can Figure Out This Is A Very

Simple Rank System And Similar In The Next We Gave
Code:
if (GetPlayerScore(playerid) >= 200)
Without

No && Because 200+ Score If Player Spawn He Will Get The Same Message For What Ever Score He Has


So When You Have Finished This Your Simple Rank System Is Now Ready And With 1 Feature With It

Here Is The Complete Version Of This Tutorial In Paste Bin http://pastebin.com/XJqAUbNh


THANK YOU! For Reading My Tutorial If It Helped You Please +REP Me
Reply
#2

Why do you define so many color? you only use 1 which is COLOR_RED
Reply
#3

  1. Stop writing every word with a capital letter! That's super retarded.
  2. A switch is way more efficient than a bunch of ifs.
  3. If you were ever to change the score you need to level up, you'd need to change it everywhere. Use a function like GetPlayerRank or something.
2/10 for the effort.
Reply
#4

I already told its simple and i love giving caps i don't know why and i know how to create that system but i just

wanted to make a simple system for players thats all bro @ jaami if other players want to use different colors thats

why i made more colors so they fill easy to do it
Reply
#5

3/10 You need to explain it more good newbie scripters will only copy and past it
Reply
#6

How To Create This
Example
When Player get Scores Of 300
Then It Will Announce Like
me got 300 Scores And his/her Rank is Soldier

how to do that ?
Reply
#7

SendClientMessageToAll
Reply
#8

Good Job !
Reply
#9

Thanks you and btw less reps i am getting
Reply
#10

Quote:
Originally Posted by Nirzor
View Post
Thanks you and btw less reps i am getting
Dont ask for reps,they'll rep if they like.

"At first I thought,tutorials are created for others to learn; but now I think most of the users are creating tutorials for Reputation."
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)