• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Don't Destroy the weapon when ammo is 0
#1
Its possible to make that?.. when somebody dont have more ammo, the weapon dont dissapear?
  Reply
#2
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;
}
  Reply


Forum Jump: