Jump to content

createWeapon problem


xTravax

Recommended Posts

Posted

hey i have a problem

if i create a weapon with createWeapon, it will create it only for me, but won't be synced with other players

how to fix this? others can't see my custom weapon

Posted (edited)

You have to use triggerClientEvent to make it visible for everyone.

I had the same problem before some time :D

Edited by Guest
Posted

You will have to run the serverside function. use triggerClientEvent;

E.g:

---SERVER 
addCommandHandler("createweapon",  
function (thePlayer, command) 
    local x,y,z = getElementPosition(thePlayer) 
    x = x + 5 
    triggerClientEvent(thePlayer, "onCreateWeapon", getRootElement(), x, y, z) 
end 
) 
 ---CLIENT 
addEvent("onCreateWeapon", true) 
addEventHandler("onCreateWeapon", getRootElement(),  
function (x, y, z) 
    local weapon = createWeapon("minigun", x, y, z) 
end) 

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...