Problem with GetPlayerWeaponData. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem with GetPlayerWeaponData. (
/showthread.php?tid=570626)
Problem with GetPlayerWeaponData. -
Baltimore - 12.04.2015
Hello !
GetPlayerWeaponData is bugged?
If I have a
Desert Eagle with 30 ammos and I switch for a
Knife (1 ammo), it tell me that the knife has 30 balls for example.
[quote=Baltimore;3427993]
pawn Код:
for(new slot = 0; slot < 13; slot++)
{
new gun,
ammo,
munis;
GetPlayerWeaponData(i, slot, gun, ammo);
new wslot = getSlotByWeaponID(GetPlayerWeapon(i));
if(ammo < WeaponInfos[i][wslot][Ammo])
WeaponInfos[i][wslot][Ammo] = ammo;
new id = -1;
for(new w; w < sizeof(wep_Data); w++)
{
if(wep_Data[w][wep_CustomWeapon] != 0 && wep_Data[w][wep_CustomWeapon] == WeaponInfos[i][wslot][Model])
{
id = w;
}
}
if(WeaponInfos[i][wslot][Ammo] < ammo || wep_Data[id][wep_MaxAmmo] < ammo)
munis = gun;
if(munis > 0)
{
// Detect cheats
}
}
Re: Problem with GetPlayerWeaponData. -
R0 - 12.04.2015
I didnt check all of the code but try this
pawn Код:
for(new slot = 0; slot < 12; slot++)
{
new gun,
ammo,
munis;
GetPlayerWeaponData(i, slot, gun, ammo);
if(ammo < WeaponInfos[i][slot][Ammo])
WeaponInfos[i][slot][Ammo] = ammo;
new id = -1;
for(new w; w < sizeof(wep_Data); w++)
{
if(wep_Data[w][wep_CustomWeapon] != 0 && wep_Data[w][wep_CustomWeapon] == WeaponInfos[i][slot][Model])
{
id = w;
}
}
if(WeaponInfos[i][slot][Ammo] < ammo || wep_Data[id][wep_MaxAmmo] < ammo)
munis = gun;
if(munis > 0)
{
// Detect cheats
}
}