Jump to content

[HELP] createVehicle / triggerServerEvent


opnaiC

Recommended Posts

client

        function fbirancherp () 
        triggerServerEvent ( "fbi", getLocalPlayer(), fbirancherp ) 
        end 
        addEventHandler ("onClientDXClick", fbirancher, fbirancherp) 

server

function fbiscript ( target ) 
      local x, y, z = getElementPosition( target ) 
      rancher = createVehicle ( 490, x, y, z+2 ) 
end 
addEvent ("fbi", true) 
addEventHandler ("fbi", getRootElement(), fbiscript) 
  

Error:

ACmhZtd.png

Link to comment

try this

function fbiscript () 
      local x, y, z = getElementPosition( source ) 
      rancher = createVehicle ( 490, x, y, z+2 ) 
end 
addEvent ("fbi", true) 
addEventHandler ("fbi", getRootElement(), fbiscript) 
  
--or 
  
function fbiscript (thePlayer) 
      local x, y, z = getElementPosition( thePlayer ) 
      rancher = createVehicle ( 490, x, y, z+2 ) 
end 
addEvent ("fbi", true) 
addEventHandler ("fbi", getRootElement(), fbiscript) 

Link to comment
--Server Side 
function fbiscript(thePlayer) 
      local x, y, z = getElementPosition(thePlayer) 
      rancher = createVehicle(490, x, y, z+2) 
end 
addEvent("fbi", true) 
addEventHandler("fbi", root, fbiscript) 
  
--Client Side 
function fbirancherp() 
       triggerServerEvent("fbi", localPlayer) 
end 
addEventHandler("onClientDxClick", fbirancher, fbirancherp) 

Link to comment
try this
function fbiscript () 
      local x, y, z = getElementPosition( source ) 
      rancher = createVehicle ( 490, x, y, z+2 ) 
end 
addEvent ("fbi", true) 
addEventHandler ("fbi", getRootElement(), fbiscript) 
  
--or 
  
function fbiscript (thePlayer) 
      local x, y, z = getElementPosition( thePlayer ) 
      rancher = createVehicle ( 490, x, y, z+2 ) 
end 
addEvent ("fbi", true) 
addEventHandler ("fbi", getRootElement(), fbiscript) 

Its working this way but it spawns 4 fbi rancher ... Idk why 4 of them ...

function fbiscript () 
      local x, y, z = getElementPosition(source) 
      rancher = createVehicle ( 490, x, y, z + 10 ) 
end 
addEvent ("fbi", true) 
addEventHandler ("fbi", getRootElement(), fbiscript) 
  

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