How to make this possible
#2

Код:
	new tstr[20];
	new tammo, tweap;
	for(new w=0; w<12; w++)
	{
		GetPlayerWeaponData(playerid,w,tweap,tammo);
		format(tstr,sizeof(tstr),"wslot%d",w);
		dini_IntSet(file, tstr, GetPVarInt(playerid,tstr));
		format(tstr,sizeof(tstr),"wammo%d",w);
		if(tammo == -1)
		{
			format(tstr,sizeof(tstr),"sammo%d",w);
			tammo = GetPVarInt(playerid,tstr);
			format(tstr,sizeof(tstr),"wammo%d",w);
		}
		dini_IntSet(file, tstr, tammo);
	}
this is for if you save your weapons to a PVar called wslot[slotid] like wslot1 or wslot3 and ammo to wamma[slotid]
if wammo[slotid] == -1 (meaning it doesn't return properly then it'll put it to 50 ammo.
so I also run a timer to constantly get the ammo so it returns a more precise ammo, that timer saves the ammo data to sammo[slotid]

Код:
public smartammo()
{
	for(new i=0;i<MAX_PLAYERS;i++)
	{
		new tstr[20];
		new tammo, tweap;
		for(new w=0; w<12; w++)
		{
			GetPlayerWeaponData(i,w,tweap,tammo);
			format(tstr,sizeof(tstr),"sammo%d",w);
			if(tammo != -1)
			{
				SetPVarInt(i,tstr,tammo);
			}
			if(tammo == -1 && GetPVarInt(i,tstr) == 0)
			{
				SetPVarInt(i,tstr,50);
			}
		}
	}
}
Reply


Messages In This Thread
How to make this possible - by oNx - 14.06.2010, 02:01
Re: How to make this possible - by cessil - 14.06.2010, 03:04
Re: How to make this possible - by oNx - 14.06.2010, 10:14
Re: How to make this possible - by Naxix - 14.06.2010, 10:52

Forum Jump:


Users browsing this thread: 1 Guest(s)