22.03.2019, 18:16
pawn Код:
public OnPlayerUpdate(playerid)
{
new iCurWeap = GetPlayerWeapon(playerid); // Return the player's current weapon
if(iCurWeap != GetPVarInt(playerid, "iCurrentWeapon")) // If he changed weapons since the last update
{
// Lets call a callback named OnPlayerChangeWeapon
OnPlayerChangeWeapon(playerid, GetPVarInt(playerid, "iCurrentWeapon"), iCurWeap);
SetPVarInt(playerid, "iCurrentWeapon", iCurWeap);//Update the weapon variable
}
return 1; // Send this update to other players.
}
stock OnPlayerChangeWeapon(playerid, oldweapon, newweapon)
{
new s[128],
oWeapon[24],
nWeapon[24];
GetWeaponName(oldweapon, oWeapon, sizeof(oWeapon));
GetWeaponName(newweapon, nWeapon, sizeof(nWeapon));
format(s, sizeof(s), "You changed weapon from %s to %s!", oWeapon, nWeapon);
SendClientMessage(playerid, 0xFFFFFFFF, s);
}