[Ajuda] Setando armas in-game
#1

Eu estou com uma funзгo aqui que nгo tб setando as variбveis in-game conforme elas deveriam ser feitas. Nгo sei se й porque eu estou utilizando os cуdigos mysql de forma errada. Enfim. Coloquei na public OnPlayerSpawn (que й lб que carrega e seta todas as coisas do player):

Код:
new strArmas[256];
				format(strArmas, 256, "SELECT `pWeapon1`, `pAmmo1`, `pWeapon2`, `pAmmo2`, `pWeapon3`, `pAmmo3`, `pWeapon4`, `pAmmo4`, `pWeapon5`, `pAmmo5`, `pWeapon6`, `pAmmo6`, `pWeapon7`, `pAmmo7`, `pWeapon8`, `pAmmo8`, `Weapon9`, `pAmmo9`, `pWeapon10`, `pAmmo10`, `pWeapon11`, `pAmmo11`, `pWeapon1`, `pAmmo12`, `pWeapon13`, `pAmmo13` FROM `accounts` WHERE `ID` = '%d'", PlayerInfo[playerid][pID]);
				mysql_tquery(mySqlHandle, strArmas, "SetandoArmas", "d", playerid);
Aн depois na que й chamada, a SetandoArmas eu pus o seguinte:

Код:
forward SetandoArmas(playerid);
public SetandoArmas(playerid)
{
	new rows;

	cache_get_row_count(rows);

	if(rows)
	{
			
		for(new i; i < rows; i++)
		{
			cache_get_value_name_int(i,"pWeapon1", PlayerInfo[playerid][pWeapon1]);
			cache_get_value_name_int(i,"pAmmo1", PlayerInfo[playerid][pAmmo1]);
			cache_get_value_name_int(i,"pWeapon2", PlayerInfo[playerid][pWeapon2]);
			cache_get_value_name_int(i,"pAmmo2", PlayerInfo[playerid][pAmmo2]);
			cache_get_value_name_int(i,"pWeapon3", PlayerInfo[playerid][pWeapon3]);
			cache_get_value_name_int(i,"pAmmo3", PlayerInfo[playerid][pAmmo3]);
			cache_get_value_name_int(i,"pWeapon4", PlayerInfo[playerid][pWeapon4]);
			cache_get_value_name_int(i,"pAmmo4", PlayerInfo[playerid][pAmmo4]);
			cache_get_value_name_int(i,"pWeapon5", PlayerInfo[playerid][pWeapon5]);
			cache_get_value_name_int(i,"pAmmo5", PlayerInfo[playerid][pAmmo5]);
			cache_get_value_name_int(i,"pWeapon6", PlayerInfo[playerid][pWeapon6]);
			cache_get_value_name_int(i,"pAmmo6", PlayerInfo[playerid][pAmmo6]);
			cache_get_value_name_int(i,"pWeapon7", PlayerInfo[playerid][pWeapon7]);
			cache_get_value_name_int(i,"pAmmo7", PlayerInfo[playerid][pAmmo7]);
			cache_get_value_name_int(i,"pWeapon8", PlayerInfo[playerid][pWeapon8]);
			cache_get_value_name_int(i,"pAmmo8", PlayerInfo[playerid][pAmmo8]);
			cache_get_value_name_int(i,"pWeapon9", PlayerInfo[playerid][pWeapon9]);
			cache_get_value_name_int(i,"pAmmo9", PlayerInfo[playerid][pAmmo9]);
			cache_get_value_name_int(i,"pWeapon10", PlayerInfo[playerid][pWeapon10]);
			cache_get_value_name_int(i,"pAmmo10", PlayerInfo[playerid][pAmmo10]);
			cache_get_value_name_int(i,"pWeapon11", PlayerInfo[playerid][pWeapon11]);
			cache_get_value_name_int(i,"pAmmo11", PlayerInfo[playerid][pAmmo11]);
			cache_get_value_name_int(i,"pWeapon12", PlayerInfo[playerid][pWeapon12]);
			cache_get_value_name_int(i,"pAmmo12", PlayerInfo[playerid][pAmmo12]);
			cache_get_value_name_int(i,"pWeapon13", PlayerInfo[playerid][pWeapon13]);
			cache_get_value_name_int(i,"pAmmo13", PlayerInfo[playerid][pAmmo13]);
		}
		GivePlayerWeapon(playerid, PlayerInfo[playerid][pWeapon1], PlayerInfo[playerid][pAmmo1]);
		GivePlayerWeapon(playerid, PlayerInfo[playerid][pWeapon2], PlayerInfo[playerid][pAmmo2]);
		GivePlayerWeapon(playerid, PlayerInfo[playerid][pWeapon3], PlayerInfo[playerid][pAmmo3]);
		GivePlayerWeapon(playerid, PlayerInfo[playerid][pWeapon4], PlayerInfo[playerid][pAmmo4]);
		GivePlayerWeapon(playerid, PlayerInfo[playerid][pWeapon5], PlayerInfo[playerid][pAmmo5]);
		GivePlayerWeapon(playerid, PlayerInfo[playerid][pWeapon6], PlayerInfo[playerid][pAmmo6]);
		GivePlayerWeapon(playerid, PlayerInfo[playerid][pWeapon7], PlayerInfo[playerid][pAmmo7]);
		GivePlayerWeapon(playerid, PlayerInfo[playerid][pWeapon8], PlayerInfo[playerid][pAmmo8]);
		GivePlayerWeapon(playerid, PlayerInfo[playerid][pWeapon9], PlayerInfo[playerid][pAmmo9]);
		GivePlayerWeapon(playerid, PlayerInfo[playerid][pWeapon10], PlayerInfo[playerid][pAmmo10]);
		GivePlayerWeapon(playerid, PlayerInfo[playerid][pWeapon11], PlayerInfo[playerid][pAmmo11]);
		GivePlayerWeapon(playerid, PlayerInfo[playerid][pWeapon12], PlayerInfo[playerid][pAmmo12]);
		GivePlayerWeapon(playerid, PlayerInfo[playerid][pWeapon13], PlayerInfo[playerid][pAmmo13]);
	}
}
Sу que o problema de toda essa merda й que as armas nгo carregam. Nгo hб nenhuma funзгo (ao menos no meu ponto de vista) que estб resetando as armas do player logo apуs que eu seto. E as armas estгo salvando corretamente na DB.
Reply


Messages In This Thread
Setando armas in-game - by Diggie - 03.09.2018, 21:00
Re: Setando armas in-game - by Diggie - 03.09.2018, 23:10
Re: Setando armas in-game - by iHollyZinhO - 03.09.2018, 23:39
Re: Setando armas in-game - by GSantana - 03.09.2018, 23:53
Re: Setando armas in-game - by Diggie - 03.09.2018, 23:56
Re: Setando armas in-game - by GSantana - 03.09.2018, 23:58
Re: Setando armas in-game - by iHollyZinhO - 04.09.2018, 00:06
Re: Setando armas in-game - by Diggie - 04.09.2018, 00:50
Re: Setando armas in-game - by Diggie - 04.09.2018, 00:59
Re: Setando armas in-game - by iHollyZinhO - 04.09.2018, 01:05

Forum Jump:


Users browsing this thread: 2 Guest(s)