SA-MP Forums Archive
Player ranks. - 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: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Player ranks. (/showthread.php?tid=481682)



Player ranks. - iOxide - 17.12.2013

Hey guys, can anyone tell me how can i make a rank system for players? I don't need any special commands for each ranks, just want the rank 3DTextabel appear on their name always after reaching the selected score. +rep for one who can help me


Re: Player ranks. - Sawalha - 17.12.2013

Quote:
Originally Posted by iOxide
Посмотреть сообщение
Hey guys, can anyone tell me how can i make a rank system for players? I don't need any special commands for each ranks, just want the rank 3DTextabel appear on their name always after reaching the selected score. +rep for one who can help me
pawn Код:
//at the top
#define MAJOR        0
#define PRIVATE      1// defining a simple ranks
// and
new gRank[MAX_PLAYERS]; // making a varb for player's rank
now we have defined them , we gonna make a function for the player when he reachs a rank:
pawn Код:
forward OnPlayerReachRank(playerid);
public OnPlayerReachRank(playerid)
{
      new Float:X , Float:Y , Float:Z; // the coordinates of text
      if(GetPlayerScore(playerid) => 50 && GetPlayerScore(playerid) < 100) // if his score is 50 and under 100
      {
            SendClientMessage(playerid, green, "Congratulations!, You have been promoted to private!");
            gRank[playerid] = PRIVATE; // setting his rank
            GetPlayerPos(playerid, X , Y , Z); // getting player pos for the 3dtext
            Create3DTextLabel("Major", -1, X, Y, 20.0, 10.0, 0, 0); // text is major, color is -1, 20.0 is at head of the player(i guess so), 10.0 is the distance if it's able to see from, 0 is the world and 0 is the testLOS( if it can be seen through objects
      }
      if(GetPlayerScore(playerid) => 100 && GetPlayerScore(playerid) < 300) // if his score is 100 and under 300
      {
            SendClientMessage(playerid, green, "You have been promoted to major!");
            gRank[playerid] = MAJOR; // setting his rank
      }
      return 1;
}
not tested, but i think it will work.. hope so


Re: Player ranks. - iOxide - 17.12.2013

How do i attach the 3DTexLabel on player which stays after he/she leave or join again? I know how to create the 3DTextLabel but don't know how to make them permanent after reaching 200 score.


Re: Player ranks. - Sawalha - 17.12.2013

Quote:
Originally Posted by iOxide
Посмотреть сообщение
How do i attach the 3DTexLabel on player which stays after he/she leave or join again? I know how to create the 3DTextLabel but don't know how to make them permanent after reaching 200 score.
save them in player's file, use Y_INI, mysql or sqlite, which one you are using?


Re: Player ranks. - iOxide - 17.12.2013

Well, i am using PPC Trucking and i don't know how to save it


Re: Player ranks. - Sawalha - 17.12.2013

well, i don't know that include, but i suggest you to use y_ini include, more faster in saving and reading files, search a tutorial of how to save with it, and you will learn, P.S when you can save with it, replay here again to give you rank saving code with it, good luck