abdalbaset Posted January 31, 2014 Posted January 31, 2014 i got problem with this script i can see the marker but i cant spawn the airplane local x=1984.3034 local y=-2316.9780 local z=13.5468 shmal_v=createMarker(x,y,z, "Cylinder", 1.5, 255,255,0,240) function scriptCreatesmal ( ) local playerp = getLocalPlayer() local x, y, z = getElementPosition (playerp ) createVehicle (519, x, y, z ) end addEventHandler( "onMarkerHit",shmal_v,scriptCreatesmal)
Karuzo Posted January 31, 2014 Posted January 31, 2014 You have to use "onClientMarkerHit", cause it is cientside. try this : local x=1984.3034 local y=-2316.9780 local z=13.5468 shmal_v=createMarker(x,y,z, "Cylinder", 1.5, 255,255,0,240) function scriptCreatesmal (hitPlayer) local x, y, z = getElementPosition (hitPlayer) createVehicle (519, x, y, z ) end addEventHandler( "onClientMarkerHit",shmal_v,scriptCreatesmal)
TAPL Posted January 31, 2014 Posted January 31, 2014 You can't enter client side vehicle. Server Side: shmal_v = createMarker(1984.3034, -2316.9780, 13.5468, "cylinder", 1.5, 255, 255, 0, 240) function scriptCreatesmal(player) if getElementType(player) == "player" then local x, y, z = getElementPosition(player) createVehicle(519, x, y, z) end end addEventHandler("onMarkerHit", shmal_v, scriptCreatesmal)
abdalbaset Posted January 31, 2014 Author Posted January 31, 2014 thanx its working but one more thing i want the player can creat only one vehicle if the vehicle destored he can spown another one
TAPL Posted January 31, 2014 Posted January 31, 2014 shmal_v = createMarker(1984.3034, -2316.9780, 13.5468, "cylinder", 1.5, 255, 255, 0, 240) vehicle = {} function scriptCreatesmal(player) if getElementType(player) == "player" then if isElement(vehicle[player]) then destroyElement(vehicle[player]) vehicle[player] = nil end local x, y, z = getElementPosition(player) vehicle[player] = createVehicle(519, x, y, z) end end addEventHandler("onMarkerHit", shmal_v, scriptCreatesmal) addEventHandler("onPlayerQuit", root, function() if isElement(vehicle[source]) then destroyElement(vehicle[source]) vehicle[source] = nil end end)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now