Jump to content

[HELP] Create weapon on client side and attach it on server sided vehicle


Recommended Posts

Hi i have a problem with my script.

So i write the script "nice" but i dont get it clientevent is why didnt work for me.

And i want to create weapon and attach to the server side created vehicle(raindance)

Error:

ERROR: Server triggered clientside event createMinigun, but event is not added clientside

 

Server Side:

function createMinigunWeapon()
    triggerClientEvent("createMinigun", resourceRoot)
end
addEventHandler("onResourceStart", resourceRoot, createMinigunWeapon)

 


 

Client side:

function createMinigunWeapon()
    -- Create the weapon 1 meter above the player
    local x, y, z = getElementPosition(localPlayer)
    local weapon = createWeapon("minigun", x, y, z + 1)
    -- Give it some ammo and fire it
    setWeaponClipAmmo(weapon, 99999)
    setWeaponState(weapon, "firing")
    
    setWeaponProperty(weapon, "fire_rotation", 0, 0, 0)
end
addEventHandler("createMinigun", localPlayer, createMinigunWeapon)
addEvent("createMinigun", true)

 

Edited by SphinxDev
wrong information
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...