Weapons loading problem
#1

So I have somewhere in my database weapons and ammo for each slot saved like this:

Code:
0 0 0 0 32 0 0 0 0 0 0 0 0
and for ammo
Code:
0 0 0 0 328 0 0 0 0 0 0 0 0
This is the code
Code:
Public:OnCWeaponsLoad(playerid)
{
	new string1[256], string2[256], c[1];
	new rows;
	cache_get_row_count(rows);
	if(rows)
	{
		cache_get_value_name(0, "pWeapons", string1, 256);
		cache_get_value_name(0, "pWeaponsAmmo", string2, 256);
		
		for(new i = 0; i < 13; i++)
		{
		   c[0] = string1[2*i];
		   C_Weapons[playerid][cWeaponID][i] = c[0];
		}
		
		for(new i = 0; i < 13; i++)
		{
		   c[0] = string2[2*i];
		   C_Weapons[playerid][cWeaponAmmo][i] = c[0];
		}
	}
	return 1;
}
At first I tried to use sscanf but failed cause it would just look ugly with a long line for 13 arguments, so I tried somewhat a clever aproach and it almost did the trick but not quite it seems, I gave myself a deagle just for test purposes and instead it changed it into a tec weapon with some random ammo.
Reply


Messages In This Thread
Weapons loading problem - by XStormiest - 25.09.2018, 18:56
Re: Weapons loading problem - by Calisthenics - 25.09.2018, 19:19
Re: Weapons loading problem - by XStormiest - 25.09.2018, 19:33
Re: Weapons loading problem - by Calisthenics - 25.09.2018, 19:56
Re: Weapons loading problem - by XStormiest - 25.09.2018, 20:02

Forum Jump:


Users browsing this thread: 1 Guest(s)