New Scripter
#5

Ok, does this look ok?
Код HTML:
GetWeaponAmmo(playerid,weapon)
{
    new weapons[13][2];
	for (new i = 0; i < 13; i++)
	{
	    GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
	    if(weapons[i][0] == weapon)
	    return weapons[i][1];
	}
	return 0;
}
Saving:
Код HTML:
	dini_IntSet(playerfile, "PrimWep_Ammo", GetWeaponAmmo(playerid,GetPVarInt(playerid,"PrimWep")));
	dini_IntSet(playerfile, "SubWep_Ammo", GetWeaponAmmo(playerid,GetPVarInt(playerid,"SubWep_Ammo")));
	dini_IntSet(playerfile, "MeleeWep_Ammo",  GetWeaponAmmo(playerid,GetPVarInt(playerid,"MeleeWep_Ammo")));
Edit:
PrimWep_Ammo=198
SubWep_Ammo=100
MeleeWep_Ammo=1
turns into:
PrimWep_Ammo=197
SubWep_Ammo=0
MeleeWep_Ammo=0

I'm guessing it only gets the ammo of the weapon im using?
Edit:
Nvm it sitll only saves prim weapon, even when i use the sub.
Edit:
Oh, I'm dumb.
I had it as:
Код HTML:
	dini_IntSet(playerfile, "PrimWep_Ammo", GetWeaponAmmo(playerid,GetPVarInt(playerid,"PrimWep")));
	dini_IntSet(playerfile, "SubWep_Ammo", GetWeaponAmmo(playerid,GetPVarInt(playerid,"SubWep_Ammo")));
	dini_IntSet(playerfile, "MeleeWep_Ammo", GetWeaponAmmo(playerid,GetPVarInt(playerid,"MeleeWep_Ammo")));
Instead of:
Код HTML:
	dini_IntSet(playerfile, "PrimWep_Ammo", GetWeaponAmmo(playerid,GetPVarInt(playerid,"PrimWep")));
	dini_IntSet(playerfile, "SubWep_Ammo", GetWeaponAmmo(playerid,GetPVarInt(playerid,"SubWep")));
	dini_IntSet(playerfile, "MeleeWep_Ammo", GetWeaponAmmo(playerid,GetPVarInt(playerid,"MeleeWep")));
Reply


Messages In This Thread
New Scripter - by ViperSniper - 02.01.2011, 01:44
Re: New Scripter - by Anthonyx3' - 02.01.2011, 02:06
Re: New Scripter - by ViperSniper - 02.01.2011, 02:07
Re: New Scripter - by Anthonyx3' - 02.01.2011, 02:10
Re: New Scripter - by ViperSniper - 02.01.2011, 02:21
Re: New Scripter - by ViperSniper - 02.01.2011, 02:47

Forum Jump:


Users browsing this thread: 1 Guest(s)