02.10.2017, 17:32
Why don't you debug?
may you try these codes and post the result?
may you try these codes and post the result?
PHP код:
GivePlayerWeaponEx(playerid, weaponid, ammo) {
new slot = GetWeaponSlot(weaponid);
//SetPlayerArmedWeapon(playerid, weaponid); <- not necessary!
if(GetWeaponSlot(weaponid) == slot) { // o.o this should be weaponid D:
gPlayerWeapon[playerid][slot] = true;
gPlayerAmmo[playerid][slot] += ammo;
printf("Player already has the weapon and now has the ammmo -> %d",PlayerAmmo[playerid][slot]);
}
else {
gPlayerWeapon[playerid][slot] = true;
gPlayerAmmo[playerid][slot] = ammo;
printf("Player didn't have the weapon and now has the ammmo -> %d",PlayerAmmo[playerid][slot]);
}
return GivePlayerWeapon(playerid, weaponid, ammo);
}
PHP код:
new slot = GetWeaponSlot(weaponid);
gPlayerAmmo[playerid][slot]--;
new playerammo = GetPlayerAmmo(playerid);
printf("player started shooting by the weapon %d and now has %d shots left | %d | ", weaponid, playerammo, gPlayerAmmo[playerid][slot]);
if(playerammo > 0 && playerammo > gPlayerAmmo[playerid][slot] + 15) {
printf("was true and kicked that mofo");
RemovePlayerWeapon(playerid, weaponid);
format(string, sizeof string, "{FF0000}<!> {CC6699}%s has been kicked for ammo hack", GetName(playerid));
SendClientMessageToAll(red, string);
return DelayKick(playerid);
}
else gPlayerAmmo[playerid][slot] = playerammo;