Rank help
#1

I made a rank system, everything works, im just having some problems with saving and loading.

This is the rank variable:

Код:
new const gRank[][e_RANK] =
{
	{"Private",				0,		MAX_HEALTH,	0.0},
	{"Private First Class",	50,		MAX_HEALTH,	0.0},
	{"Specialist",			100,	75.0,	0.0},
	{"Corporal",			500,	MAX_HEALTH,	5.0},
	{"Sergeant",			1000,	MAX_HEALTH,	5.0},
	{"Staff Sergeant",		1500,	MAX_HEALTH,	15.0},
	{"Master Sergeant",		2500,	MAX_HEALTH,	15.0},
	{"Sergeant Major",		4500,	MAX_HEALTH,	40.0},
	{"Officer",				6000,	MAX_HEALTH,	50.0},
	{"Warrant Officer",		7500,	MAX_HEALTH,	60.0},
	{"Chief Warrant Officer",9000,	MAX_HEALTH,	70.0},
	{"Lieutenant",			10000,	MAX_HEALTH,	70.0},
	{"First Lieutenant",	12500,	MAX_HEALTH,	85.0},
	{"Second Lieutenant",	15000,	MAX_HEALTH,	MAX_ARMOUR},
	{"Captain",	 			20000,	MAX_HEALTH,	MAX_ARMOUR},
	{"Major",				25000,	MAX_HEALTH,	MAX_ARMOUR},
	{"Colonel",				30000,	MAX_HEALTH,	MAX_ARMOUR},
	{"Marshall",			33000,	MAX_HEALTH,	MAX_ARMOUR},
	{"Field Marshall",		37000,	MAX_HEALTH,	MAX_ARMOUR},
	{"General",				40000,	MAX_HEALTH,	MAX_ARMOUR},
	{"Brigadier General",	45000,	MAX_HEALTH,	MAX_ARMOUR},
	{"Major General",		50000,	MAX_HEALTH,	MAX_ARMOUR},
	{"Master Of War",		60000,	MAX_HEALTH,	MAX_ARMOUR},
	{"God Of War",			9999999,MAX_HEALTH,	MAX_ARMOUR}
};
This is what i do to load the rank after the login:

Код:
cache_get_value_int(0, "Rank", Player[playerid][Rank]);
And this is what i do after the player quits and i save the data:

Код:
UpdatePlayerData(playerid)
{
	if (Player[playerid][IsLoggedIn] == false) return 0;
	new query[180];
	mysql_format(g_SQL, query, sizeof query, "UPDATE `players` SET `Kills` = %d,`Deaths` = %d,`Score` = %i,`Money` = %i, `Level` = %d,`Cookies` = %d, `Warns`, `Vip` = %d, `Banned` = %d, `Rank` = %s WHERE `id` = %d LIMIT 1",
	Player[playerid][Kills],
	Player[playerid][Deaths],
	GetPlayerScore(playerid),
	GetPlayerMoney(playerid),
	Player[playerid][Level],
	Player[playerid][Cookies],
	Player[playerid][Warns],
	Player[playerid][Vip],
	Player[playerid][Banned],
	gRank[rankName],
	Player[playerid][ID]);
	mysql_tquery(g_SQL, query);
	return 1;
}
Everything ^ from code above works, except from saving and loading ranks.

I want to save the rankname variable in the Player[playerid][Rank].

Yes, i already made the row "Ranks" in mysql as varchar.
Reply


Messages In This Thread
Rank help - by Face9000 - 22.03.2017, 00:58
Re: Rank help - by X337 - 22.03.2017, 01:14
Re: Rank help - by Face9000 - 22.03.2017, 01:24
Re: Rank help - by X337 - 22.03.2017, 01:31
Re: Rank help - by Face9000 - 22.03.2017, 01:42
Re: Rank help - by X337 - 22.03.2017, 01:52
Re: Rank help - by Face9000 - 22.03.2017, 21:00
Re: Rank help - by Flamehaze7 - 23.03.2017, 01:47
Re: Rank help - by X337 - 23.03.2017, 03:07
Re: Rank help - by Face9000 - 23.03.2017, 10:12

Forum Jump:


Users browsing this thread: 2 Guest(s)