Wiki

Clone wiki

EFLC-MP LUA / onPlayerSwitchWeapons

Description

This function is triggered once the player scrolls to a different weapon

Parameters

Int playerId, Int weaponId, Int ammo
Int playerId

Int weaponId

Int ammo

Return values

Bool allowSwitch
allowSwitch: return True for standard behavior. Or return False and the server won't sync this new weapon to other players.

Example

#!lua
function myPlayerSwitchWeapons(playerid, weapon, ammo)
    if(weapon == 18) then
        --In case you wanna disable RPG from your server
        return false
    end
    return true
end
registerEvent("myPlayerSwitchWeapons", "onPlayerSwitchWeapons")

Updated