14.06.2010, 03:04
Код:
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); }
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); } } } }