[Pawn] Don't Destroy the weapon when ammo is 0 - Printable Version + open.mp forum (https://forum.open.mp) -- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3) --- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10) --- Thread: [Pawn] Don't Destroy the weapon when ammo is 0 (/showthread.php?tid=2448) |
Don't Destroy the weapon when ammo is 0 - naufalikbal00783 - 2023-08-29 Its possible to make that?.. when somebody dont have more ammo, the weapon dont dissapear? RE: Don't Destroy the weapon when ammo is 0 - zBreno - 2023-08-29 forward BlockWeaponMSG(playerid); #define SystemMSG 99 new msg[MAX_PLAYERS]; public OnPlayerConnect(playerid) { msg[playerid] = 0; return 1; } public OnPlayerUpdate (playerid) { new strcmd [9]; if( GetPlayerAmmo(playerid) == 2) { if(msg[playerid] == 0) { strcat(strcmd, "no ammo", sizeof(strcmd)); ShowPlayerDialog(playerid, SystemMSG, DIALOG_STYLE_MSGBOX, "System", strcmd, "Exit", ""); msg[playerid] = 1; SetTimer("BlockWeaponMSG", 3000, false); } } return 1; } public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ) { new strcmd [9]; if( GetPlayerAmmo(playerid) == 3) { strcat(strcmd, "no ammo", sizeof(strcmd)); ShowPlayerDialog(playerid, SystemMSG, DIALOG_STYLE_MSGBOX, "System", strcmd, "Exit", ""); } if( GetPlayerAmmo(playerid) == 2) { strcat(strcmd, "no ammo", sizeof(strcmd)); ShowPlayerDialog(playerid, SystemMSG, DIALOG_STYLE_MSGBOX, "System", strcmd, "Exit", ""); } return 1; } public BlockWeaponMSG(playerid) { msg[playerid] = 0; return 1; } |