toptional Posted March 28, 2013 Share Posted March 28, 2013 (edited) I get no debug errors, What im trying to do is it checks if the player has a vehicle and it outputs the chatbox someone it toggle's off all controls and freezes the vehicle then after 5 seconds everything is reversed thats not working though. function SpawnDodo () triggerServerEvent ( "spawnDodo", localPlayer ) guiSetVisible(Window2, false) showCursor(false) destroyElement ( DestinationBlip ) destroyElement ( DestinationMarker ) PasengerMarker = createMarker (1574.69788, 1503.02808, 10.8363, "checkpoint",5,9,233,213,105 ) addEventHandler ( "onClientMarkerHit", PasengerMarker, mainFunction ) end addEventHandler ( 'onClientGUIClick', Button2, SpawnDodo, false ) function mainFunction( player ) if ( getPedOccupiedVehicle (player) ) then outputChatBox ("Your passengers are being loaded please stand by.",255, 50, 0, false ) toggleAllControls ( false ) setElementFrozen ( player, true ) setTimer(function (player) outputChatBox ("Your passengers now loaded please make your way to the runway to depart.", 255, 50, 0, false ) toggleAllControls ( true ) setElementFrozen (player, false ) destroyElement ( PasengerMarker ) end, 5000, 1,player ) end end Edited March 28, 2013 by Guest Link to comment
iPrestege Posted March 28, 2013 Share Posted March 28, 2013 function mainFunction( player ) if ( getPedOccupiedVehicle (player) ) then outputChatBox ("Your passengers are being loaded please stand by.",player,255, 50, 0, false ) toggleAllControls ( player,false ) setElementFrozen ( player, true ) setTimer(function (player) outputChatBox ("Your passengers now loaded please make your way to the runway to depart.",player,255, 50, 0, false ) toggleAllControls ( player,true ) setElementFrozen (player, false ) destroyElement ( PasengerMarker ) end,5000,1,player) end end Link to comment
iPrestege Posted March 28, 2013 Share Posted March 28, 2013 You modified your topic code, but I do not see a problem in this script maybe the marker you want to destroy it? or in the server side? Link to comment
toptional Posted March 28, 2013 Author Share Posted March 28, 2013 The problem is everything that happens in mainFunction happens to everyone i need it local and i can't figure it out Link to comment
iPrestege Posted March 28, 2013 Share Posted March 28, 2013 What?Do you mean when player hit the marker all players in the server will be frozen? Link to comment
toptional Posted March 28, 2013 Author Share Posted March 28, 2013 Yes that happens but i don't want that only the person who entered the marker to be frozen. Link to comment
iPrestege Posted March 28, 2013 Share Posted March 28, 2013 Hmm... try this : function SpawnDodo () PasengerMarker = createMarker (1574.69788, 1503.02808, 10.8363, "checkpoint",5,9,233,213,105 ) addEventHandler ( "onClientMarkerHit", PasengerMarker, mainFunction ) triggerServerEvent ( "spawnDodo", localPlayer ) guiSetVisible(Window2, false) showCursor(false) destroyElement ( DestinationBlip ) destroyElement ( DestinationMarker ) end addEventHandler ( 'onClientGUIClick', Button2, SpawnDodo, false ) function mainFunction( player ) if ( player ~= localPlayer ) then return end if ( getPedOccupiedVehicle (player) ) then outputChatBox ("Your passengers are being loaded please stand by.",255, 50, 0, false ) toggleAllControls ( false ) setElementFrozen ( player, true ) setTimer(function (player) outputChatBox ("Your passengers now loaded please make your way to the runway to depart.", 255, 50, 0, false ) toggleAllControls ( true ) setElementFrozen (player, false ) destroyElement ( PasengerMarker ) end, 5000, 1,player ) end end Link to comment
toptional Posted March 28, 2013 Author Share Posted March 28, 2013 Thanks it works! But i have another issue there is another part of the script where you go into a marker with this other vehicle and get warped into the dodo, but the other vehicle doesn't go away here is that part of the script addEvent ( "spawnPlane", true ) addEventHandler ( "spawnPlane", root, function ( vehicleName ) local vehicleModel = getVehicleModelFromName ( vehicleName ) if ( vehicleModel ) then -- add this to get spawn the vehicle in your exact position of the maker local x, y, z = getElementPosition ( source ) local vehicle = createVehicle ( vehicleModel, 1690.14868, 1453.82971, 10.76650, 0, 0, 0 ) warpPedIntoVehicle ( source, vehicle ) outputChatBox ("#1874CDMake your way to Las Venturas Airport to pick up your plane!", source,24,116,205, true) end end ) Link to comment
iPrestege Posted March 28, 2013 Share Posted March 28, 2013 Try to use if not that model then return end i think that what you want? if not that model then return false or end . Link to comment
codeluaeveryday Posted March 28, 2013 Share Posted March 28, 2013 You need to destroy the other vehicle: addEvent ( "spawnPlane", true ) addEventHandler ( "spawnPlane", root, function ( vehicleName, oldVehicle ) local vehicleModel = getVehicleModelFromName ( vehicleName ) if ( vehicleModel ) then -- add this to get spawn the vehicle in your exact position of the maker local x, y, z = getElementPosition ( source ) local vehicle = createVehicle ( vehicleModel, 1690.14868, 1453.82971, 10.76650, 0, 0, 0 ) warpPedIntoVehicle ( source, vehicle ) outputChatBox ("#1874CDMake your way to Las Venturas Airport to pick up your plane!", source,24,116,205, true) end end ) You will also need to pass the oldVehicle element in the triggerServerEvent. Link to comment
toptional Posted March 28, 2013 Author Share Posted March 28, 2013 It's just not working, this is really fustrating me, the element doesn't freeze! Link to comment
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