Help needed with rank system?
#1

I downloaded a rank system, modified it a little, and it uses textdraw to show your rank.

Only problem is when I die, and spawn again, it doesn't show up....
I tried downloading and using the original version and even when I didn't modify it, still, when you die it goes away.

My modified version:

Код:
#include <a_samp>
// #include <dutils>

#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0x80000096
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_PINK 0xFF66FFAA
#define COLOR_BLUE 0x0000BBAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_DARKRED 0xFF000096
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_PURPLE 0x800080AA
#define COLOR_BROWN 0x371D0996
#define COLOR_BLUE2 0x40808096
#define COLOR_RED2 0x80004096
#define COLOR_GOLD 0xB7B70096

new playerlastrank[MAX_PLAYERS];

new Text:Textdrawr2;
new Text:Textdrawr3;
new Text:Textdrawr4;
new Text:Textdrawr5;
new Text:Textdrawr6;
new Text:Textdrawr7;
new Text:Textdrawr8;
new Text:Textdrawr9;
new Text:Textdrawr10;
new Text:Textdrawr11;
new Text:Textdrawr12;

new Timer;

public OnFilterScriptInit()
{
print("Rank System Loaded!");
Textdrawr2 = TextDrawCreate(505.000000,99.000000,"Rank: Private");
TextDrawAlignment(Textdrawr2,0);
TextDrawBackgroundColor(Textdrawr2,0x000000ff);
TextDrawFont(Textdrawr2,1);
TextDrawLetterSize(Textdrawr2,0.499999,1.000000);
TextDrawColor(Textdrawr2,0xffffffff);
TextDrawSetOutline(Textdrawr2,1);
TextDrawSetProportional(Textdrawr2,1);
TextDrawSetShadow(Textdrawr2,1);
Textdrawr3 = TextDrawCreate(505.000000,99.000000,"Rank: Chief");
TextDrawAlignment(Textdrawr3,0);
TextDrawBackgroundColor(Textdrawr3,0x000000ff);
TextDrawFont(Textdrawr3,1);
TextDrawLetterSize(Textdrawr3,0.499999,1.000000);
TextDrawColor(Textdrawr3,0xffffffff);
TextDrawSetOutline(Textdrawr3,1);
TextDrawSetProportional(Textdrawr3,1);
TextDrawSetShadow(Textdrawr3,1);
Textdrawr4 = TextDrawCreate(505.000000,99.000000,"Rank: Officer");
TextDrawAlignment(Textdrawr4,0);
TextDrawBackgroundColor(Textdrawr4,0x000000ff);
TextDrawFont(Textdrawr4,1);
TextDrawLetterSize(Textdrawr4,0.499999,1.000000);
TextDrawColor(Textdrawr4,0xffffffff);
TextDrawSetOutline(Textdrawr4,1);
TextDrawSetProportional(Textdrawr4,1);
TextDrawSetShadow(Textdrawr4,1);
Textdrawr5 = TextDrawCreate(499.000000,99.000000,"Rank: Sergeant");
TextDrawAlignment(Textdrawr5,0);
TextDrawBackgroundColor(Textdrawr5,0x000000ff);
TextDrawFont(Textdrawr5,1);
TextDrawLetterSize(Textdrawr5,0.499999,1.000000);
TextDrawColor(Textdrawr5,0xffffffff);
TextDrawSetOutline(Textdrawr5,1);
TextDrawSetProportional(Textdrawr5,1);
TextDrawSetShadow(Textdrawr5,1);
Textdrawr6 = TextDrawCreate(499.000000,99.000000,"Rank: Sergeant - Major");
TextDrawUseBox(Textdrawr6,1);
TextDrawBoxColor(Textdrawr6,0x00000000);
TextDrawTextSize(Textdrawr6,640.000000,0.000000);
TextDrawAlignment(Textdrawr6,0);
TextDrawBackgroundColor(Textdrawr6,0x000000ff);
TextDrawFont(Textdrawr6,1);
TextDrawLetterSize(Textdrawr6,0.499999,1.000000);
TextDrawColor(Textdrawr6,0xffffffff);
TextDrawSetOutline(Textdrawr6,1);
TextDrawSetProportional(Textdrawr6,1);
TextDrawSetShadow(Textdrawr6,1);
Textdrawr7 = TextDrawCreate(489.000000,99.000000,"Rank: Lieutenant");
TextDrawUseBox(Textdrawr7,1);
TextDrawBoxColor(Textdrawr7,0x00000000);
TextDrawTextSize(Textdrawr7,653.000000,0.000000);
TextDrawAlignment(Textdrawr7,0);
TextDrawBackgroundColor(Textdrawr7,0x000000ff);
TextDrawFont(Textdrawr7,1);
TextDrawLetterSize(Textdrawr7,0.499999,1.000000);
TextDrawColor(Textdrawr7,0xffffffff);
TextDrawSetOutline(Textdrawr7,1);
TextDrawSetProportional(Textdrawr7,1);
TextDrawSetShadow(Textdrawr7,1);
Textdrawr8 = TextDrawCreate(500.000000,99.000000,"Rank: Major");
TextDrawUseBox(Textdrawr8,1);
TextDrawBoxColor(Textdrawr8,0x00000000);
TextDrawTextSize(Textdrawr8,653.000000,0.000000);
TextDrawAlignment(Textdrawr8,0);
TextDrawBackgroundColor(Textdrawr8,0x000000ff);
TextDrawFont(Textdrawr8,1);
TextDrawLetterSize(Textdrawr8,0.499999,1.000000);
TextDrawColor(Textdrawr8,0xffffffff);
TextDrawSetOutline(Textdrawr8,1);
TextDrawSetProportional(Textdrawr8,1);
TextDrawSetShadow(Textdrawr8,1);
Textdrawr9 = TextDrawCreate(500.000000,99.000000,"Rank: Colonel");
TextDrawUseBox(Textdrawr9,1);
TextDrawBoxColor(Textdrawr9,0x00000000);
TextDrawTextSize(Textdrawr9,653.000000,0.000000);
TextDrawAlignment(Textdrawr9,0);
TextDrawBackgroundColor(Textdrawr9,0x000000ff);
TextDrawFont(Textdrawr9,1);
TextDrawLetterSize(Textdrawr9,0.499999,1.000000);
TextDrawColor(Textdrawr9,0xffffffff);
TextDrawSetOutline(Textdrawr9,1);
TextDrawSetProportional(Textdrawr9,1);
TextDrawSetShadow(Textdrawr9,1);
Textdrawr10 = TextDrawCreate(488.000000,99.000000,"Rank: Lieutenant Colonel");
TextDrawUseBox(Textdrawr10,1);
TextDrawBoxColor(Textdrawr10,0x00000000);
TextDrawTextSize(Textdrawr10,653.000000,0.000000);
TextDrawAlignment(Textdrawr10,0);
TextDrawBackgroundColor(Textdrawr10,0x000000ff);
TextDrawFont(Textdrawr10,1);
TextDrawLetterSize(Textdrawr10,0.499999,1.000000);
TextDrawColor(Textdrawr10,0xffffffff);
TextDrawSetOutline(Textdrawr10,1);
TextDrawSetProportional(Textdrawr10,1);
TextDrawSetShadow(Textdrawr10,1);
Textdrawr11 = TextDrawCreate(498.000000,99.000000,"Rank: General");
TextDrawUseBox(Textdrawr11,1);
TextDrawBoxColor(Textdrawr11,0x00000000);
TextDrawTextSize(Textdrawr11,653.000000,0.000000);
TextDrawAlignment(Textdrawr11,0);
TextDrawBackgroundColor(Textdrawr11,0x000000ff);
TextDrawFont(Textdrawr11,1);
TextDrawLetterSize(Textdrawr11,0.499999,1.000000);
TextDrawColor(Textdrawr11,0xffffffff);
TextDrawSetOutline(Textdrawr11,1);
TextDrawSetProportional(Textdrawr11,1);
TextDrawSetShadow(Textdrawr11,1);
Textdrawr12 = TextDrawCreate(498.000000,99.000000,"Rank: General Of TDM");
TextDrawUseBox(Textdrawr12,1);
TextDrawBoxColor(Textdrawr12,0x00000000);
TextDrawTextSize(Textdrawr12,642.000000,0.000000);
TextDrawAlignment(Textdrawr12,0);
TextDrawBackgroundColor(Textdrawr12,0x000000ff);
TextDrawFont(Textdrawr12,1);
TextDrawLetterSize(Textdrawr12,0.499999,1.000000);
TextDrawColor(Textdrawr12,0xffffffff);
TextDrawSetOutline(Textdrawr12,1);
TextDrawSetProportional(Textdrawr12,1);
TextDrawSetShadow(Textdrawr12,1);

return 1;
}


forward rankcheck(playerid);
public rankcheck(playerid)
{
	for(new i=0; i < MAX_PLAYERS; i++)
	{
	  if(GetPlayerScore(playerid)==0)
		{
		TextDrawHideForPlayer(playerid,Textdrawr3);
		TextDrawHideForPlayer(playerid,Textdrawr4);
		TextDrawHideForPlayer(playerid,Textdrawr5);
		TextDrawHideForPlayer(playerid,Textdrawr6);
		TextDrawHideForPlayer(playerid,Textdrawr7);
		TextDrawHideForPlayer(playerid,Textdrawr8);
		TextDrawHideForPlayer(playerid,Textdrawr9);
		TextDrawHideForPlayer(playerid,Textdrawr10);
		TextDrawHideForPlayer(playerid,Textdrawr11);
		TextDrawHideForPlayer(playerid,Textdrawr12);
    TextDrawShowForPlayer(playerid,Textdrawr2);
		}

		if(GetPlayerScore(playerid)==5)
		{
		TextDrawHideForPlayer(playerid,Textdrawr2);
		TextDrawHideForPlayer(playerid,Textdrawr4);
		TextDrawHideForPlayer(playerid,Textdrawr5);
		TextDrawHideForPlayer(playerid,Textdrawr6);
		TextDrawHideForPlayer(playerid,Textdrawr7);
		TextDrawHideForPlayer(playerid,Textdrawr8);
		TextDrawHideForPlayer(playerid,Textdrawr9);
		TextDrawHideForPlayer(playerid,Textdrawr10);
		TextDrawHideForPlayer(playerid,Textdrawr11);
		TextDrawHideForPlayer(playerid,Textdrawr12);
 		TextDrawShowForPlayer(playerid,Textdrawr3);
		}

	  if(GetPlayerScore(playerid)==10)
		{
		TextDrawHideForPlayer(playerid,Textdrawr2);
		TextDrawHideForPlayer(playerid,Textdrawr3);
		TextDrawHideForPlayer(playerid,Textdrawr5);
		TextDrawHideForPlayer(playerid,Textdrawr6);
		TextDrawHideForPlayer(playerid,Textdrawr7);
		TextDrawHideForPlayer(playerid,Textdrawr8);
		TextDrawHideForPlayer(playerid,Textdrawr9);
		TextDrawHideForPlayer(playerid,Textdrawr10);
		TextDrawHideForPlayer(playerid,Textdrawr11);
		TextDrawHideForPlayer(playerid,Textdrawr12);
		TextDrawShowForPlayer(playerid,Textdrawr4);
		}

		if(GetPlayerScore(playerid)==20)
		{
		TextDrawHideForPlayer(playerid,Textdrawr2);
		TextDrawHideForPlayer(playerid,Textdrawr3);
		TextDrawHideForPlayer(playerid,Textdrawr4);
		TextDrawHideForPlayer(playerid,Textdrawr6);
		TextDrawHideForPlayer(playerid,Textdrawr7);
		TextDrawHideForPlayer(playerid,Textdrawr8);
		TextDrawHideForPlayer(playerid,Textdrawr9);
		TextDrawHideForPlayer(playerid,Textdrawr10);
		TextDrawHideForPlayer(playerid,Textdrawr11);
		TextDrawHideForPlayer(playerid,Textdrawr12);
		TextDrawShowForPlayer(playerid,Textdrawr5);
		}

 	  if(GetPlayerScore(playerid)==30)
		{
		TextDrawHideForPlayer(playerid,Textdrawr2);
		TextDrawHideForPlayer(playerid,Textdrawr3);
		TextDrawHideForPlayer(playerid,Textdrawr4);
		TextDrawHideForPlayer(playerid,Textdrawr5);
		TextDrawHideForPlayer(playerid,Textdrawr7);
		TextDrawHideForPlayer(playerid,Textdrawr8);
		TextDrawHideForPlayer(playerid,Textdrawr9);
		TextDrawHideForPlayer(playerid,Textdrawr10);
		TextDrawHideForPlayer(playerid,Textdrawr11);
		TextDrawHideForPlayer(playerid,Textdrawr12);
		TextDrawShowForPlayer(playerid,Textdrawr6);
		}

    if(GetPlayerScore(playerid)==40)
		{
		TextDrawHideForPlayer(playerid,Textdrawr2);
		TextDrawHideForPlayer(playerid,Textdrawr3);
		TextDrawHideForPlayer(playerid,Textdrawr4);
		TextDrawHideForPlayer(playerid,Textdrawr5);
		TextDrawHideForPlayer(playerid,Textdrawr6);
		TextDrawHideForPlayer(playerid,Textdrawr8);
		TextDrawHideForPlayer(playerid,Textdrawr9);
		TextDrawHideForPlayer(playerid,Textdrawr10);
		TextDrawHideForPlayer(playerid,Textdrawr11);
		TextDrawHideForPlayer(playerid,Textdrawr12);
		TextDrawShowForPlayer(playerid,Textdrawr7);
		}

	  if(GetPlayerScore(playerid)==50)
		{
		TextDrawHideForPlayer(playerid,Textdrawr2);
		TextDrawHideForPlayer(playerid,Textdrawr3);
		TextDrawHideForPlayer(playerid,Textdrawr4);
		TextDrawHideForPlayer(playerid,Textdrawr5);
		TextDrawHideForPlayer(playerid,Textdrawr6);
		TextDrawHideForPlayer(playerid,Textdrawr7);
		TextDrawHideForPlayer(playerid,Textdrawr9);
		TextDrawHideForPlayer(playerid,Textdrawr10);
		TextDrawHideForPlayer(playerid,Textdrawr11);
		TextDrawHideForPlayer(playerid,Textdrawr12);
		TextDrawShowForPlayer(playerid,Textdrawr8);
		}

		if(GetPlayerScore(playerid)==60)
		{
		TextDrawHideForPlayer(playerid,Textdrawr2);
		TextDrawHideForPlayer(playerid,Textdrawr3);
		TextDrawHideForPlayer(playerid,Textdrawr4);
		TextDrawHideForPlayer(playerid,Textdrawr5);
		TextDrawHideForPlayer(playerid,Textdrawr6);
		TextDrawHideForPlayer(playerid,Textdrawr7);
		TextDrawHideForPlayer(playerid,Textdrawr8);
		TextDrawHideForPlayer(playerid,Textdrawr10);
		TextDrawHideForPlayer(playerid,Textdrawr11);
		TextDrawHideForPlayer(playerid,Textdrawr12);
		TextDrawShowForPlayer(playerid,Textdrawr9);
		}

 		if(GetPlayerScore(playerid)==70)
		{
		TextDrawHideForPlayer(playerid,Textdrawr2);
		TextDrawHideForPlayer(playerid,Textdrawr3);
		TextDrawHideForPlayer(playerid,Textdrawr4);
		TextDrawHideForPlayer(playerid,Textdrawr5);
		TextDrawHideForPlayer(playerid,Textdrawr6);
		TextDrawHideForPlayer(playerid,Textdrawr7);
		TextDrawHideForPlayer(playerid,Textdrawr8);
		TextDrawHideForPlayer(playerid,Textdrawr9);
		TextDrawHideForPlayer(playerid,Textdrawr11);
		TextDrawHideForPlayer(playerid,Textdrawr12);
		TextDrawShowForPlayer(playerid,Textdrawr10);
		}

    if(GetPlayerScore(playerid)==80)
		{
		TextDrawHideForPlayer(playerid,Textdrawr2);
		TextDrawHideForPlayer(playerid,Textdrawr3);
		TextDrawHideForPlayer(playerid,Textdrawr4);
		TextDrawHideForPlayer(playerid,Textdrawr5);
		TextDrawHideForPlayer(playerid,Textdrawr6);
		TextDrawHideForPlayer(playerid,Textdrawr7);
		TextDrawHideForPlayer(playerid,Textdrawr8);
		TextDrawHideForPlayer(playerid,Textdrawr9);
		TextDrawHideForPlayer(playerid,Textdrawr10);
		TextDrawHideForPlayer(playerid,Textdrawr12);
		TextDrawShowForPlayer(playerid,Textdrawr11);
		}

		if(GetPlayerScore(playerid)==100)
		{
		TextDrawHideForPlayer(playerid,Textdrawr2);
		TextDrawHideForPlayer(playerid,Textdrawr3);
		TextDrawHideForPlayer(playerid,Textdrawr4);
		TextDrawHideForPlayer(playerid,Textdrawr5);
		TextDrawHideForPlayer(playerid,Textdrawr6);
		TextDrawHideForPlayer(playerid,Textdrawr7);
		TextDrawHideForPlayer(playerid,Textdrawr8);
		TextDrawHideForPlayer(playerid,Textdrawr9);
		TextDrawHideForPlayer(playerid,Textdrawr10);
		TextDrawHideForPlayer(playerid,Textdrawr11);
		TextDrawShowForPlayer(playerid,Textdrawr12);
    playerlastrank[playerid]=1;
		}
	}
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	new cmd[256];
	new idx;
	cmd = strtok(cmdtext, idx);

	if (strcmp("/rank", cmdtext, true, 10) == 0)
	{
 	SendClientMessage(playerid,COLOR_ORANGE,"*********************************** Ranking list ***********************************");
  SendClientMessage(playerid,COLOR_YELLOW,"Private : 0 kills. ~ Chief : 5 kills. ~ Officer : 10 kills. ~ Sergeant : 20 kills.");
  SendClientMessage(playerid,COLOR_YELLOW,"Sergeant Major : 30 kills. ~ Lieutenant : 40 kills. ~ Major : 50 kills. ~ Colonel : 60 kills. ");
  SendClientMessage(playerid,COLOR_YELLOW,"Lieutenant Colonel : 70 kills. ~ General : 80 kills. ~ General Of TDM : 100 kills.");
  SendClientMessage(playerid,COLOR_RED,"GENERAL OF TDM (HIGHEST RANK PLAYERS) WILL SPAWN WITH 250 PERCENT HEALTH!");
	return 1;
	}
	return 0;
}

public OnPlayerSpawn(playerid)
{

  Timer = SetTimer("rankcheck",500,true);

  if (playerlastrank[playerid]==1)
  	{
  SetPlayerArmour(playerid, 100.100);
  	return 1;
	}
	return 0;
}

public OnPlayerRequestClass(playerid, classid)
{

  KillTimer(Timer);

	return 0;
}
// =============== BETA ==========================
public OnPlayerDeath(playerid, killerid, reason)
{

  KillTimer(Timer);

	return 0;
}
// ==============================================

strtok(const string[], &index)
{
	new length = strlen(string);
	while ((index < length) && (string[index] <= ' '))
	{
		index++;
	}

	new offset = index;
	new result[20];
	while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = string[index];
		index++;
	}
	result[index - offset] = EOS;
	return result;
}
Original version: http://forum.sa-mp.com/index.php?topic=69830.0
Thanks for your help in advance.
Reply
#2

Ask in the thread you downloaded it off?
Then maybe the creator can help you.
Reply
#3

Quote:
Originally Posted by Miokie*
Ask in the thread you downloaded it off?
Then maybe the creator can help you.
I guess that's my only choice.
Reply
#4

Look at the TextDrawShowForPlayer line..

HINT: every textdraw shows at an amount of score (kills) The rest is up 2 you
Reply
#5

Quote:
Originally Posted by TisjuBoY
Look at the TextDrawShowForPlayer line..

HINT: every textdraw shows at an amount of score (kills) The rest is up 2 you
Uhhh..... that didn't really help me understand what's wrong.....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)