01.10.2017, 16:15
Is not possible to increase ammo with my include.
Look at video:
https://www.youtube.com/watch?v=vGGTEn1EQOQ
Look at video:
https://www.youtube.com/watch?v=vGGTEn1EQOQ
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);
}
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;
new weaponid = GetPlayerFirearm(playerid); if(weaponid != WEAPON_TYPE_UNKNOWN) switch(GetWeaponType(weaponid)) { case WEAPON_TYPE_THROWN: { if(HOLDING(KEY_FIRE)) { if(wh_LastThrowTick[playerid] < GetTickCount()) { if(GetPlayerFirearmAmmo(playerid) > 0) { PlayerWeapon[playerid][WeaponAmmo]--; wh_LastThrowTick[playerid] = GetTickCount() + 1000; } } } } }
switch(weaponid) { case 25..34: { PlayerData[playerid][pPrimaryAmmo]--; //format(szString, sizeof(szString), "Weapon: %s Ammo: %d", GetWeaponNameEx(PlayerData[playerid][pPrimaryGun]), PlayerData[playerid][pPrimaryAmmo]); //SendClientMessageEx(playerid, COLOR_WHITE, szString); if(GetPlayerAmmo(playerid) > PlayerData[playerid][pPrimaryAmmo]+10) // Add +10 or +5 it depends on how your server syncing performed. { SetPVarInt(playerid, "AmmoHacking", GetPVarInt(playerid, "AmmoHacking")+1); if(GetPVarInt(playerid, "AmmoHacking") > 2) { ServerSecurityMessage(GetPlayerNameEx(playerid), "Kick", "Ammo Hacking"); KickEx(playerid); return 1; } } if(PlayerData[playerid][pPrimaryAmmo] <= 0) { //SendClientMessage(playerid, COLOR_WHITE, "Out of Ammo"); PlayerData[playerid][pPrimaryGun] = 0; //RemovePlayerAttachedObject(playerid, ATTACH_PRIMARYWEAPON); } } case 22..24: { PlayerData[playerid][pSecondaryAmmo]--; //format(szString, sizeof(szString), "Weapon: %s Ammo: %d", GetWeaponNameEx(PlayerData[playerid][pSecondaryGun]), PlayerData[playerid][pSecondaryAmmo]); //SendClientMessageEx(playerid, COLOR_WHITE, szString); if(GetPlayerAmmo(playerid) > PlayerData[playerid][pSecondaryAmmo]+10) { SetPVarInt(playerid, "AmmoHacking", GetPVarInt(playerid, "AmmoHacking")+1); if(GetPVarInt(playerid, "AmmoHacking") > 2) { ServerSecurityMessage(GetPlayerNameEx(playerid), "Kick", "Ammo Hacking"); KickEx(playerid); return 1; } } if(PlayerData[playerid][pSecondaryAmmo] <= 0) { //SendClientMessage(playerid, COLOR_WHITE, "Out of Ammo"); PlayerData[playerid][pSecondaryGun] = 0; //RemovePlayerAttachedObject(playerid, ATTACH_SECONDARYWEAPON); } } }