-
Posts
642 -
Joined
-
Last visited
Everything posted by Lloyd Logan
-
It works! Thank you, it is now released on the community! (Don't worry, you're in there too!
-
I've fixed it now and it is now released on the community! Thanks anyway!
-
Do you know what is wrong Castillo?
-
[PROJECT] Gamemode Creation (paying) [HIRING]
Lloyd Logan replied to BrightLiteFilms's topic in Scripting
I can help you with Intermediate stuff, but as Anderl said it would be easier to learn it yourself. (Anderl is a much more advanced and experienced scripter than me!) -
It is now creating two pickup markers after you drop a customer off and doesn't create a drop off marker local pickups = { [1]={ 2060.7685546875, -1941.1181640625, 13.14103603363 }, [2]={ 2114.5068359375, -1611.302734375, 13.167269706726 }, [3]={ 1932.9521484375, -1776.1259765625, 13.16081237793 }, [4]={ 1057.41796875, -1568.4853515625, 13.166387557983 } } local dropoffss = { [1]={ 1965.54296875 , -1883.013671875, 13.160305023193 }, [2]={ 1467.3916015625, -1736.419921875, 13.242918014526 }, [3]={ 2376.1064453125, -1728.4091796875, 13.162055015564 }, [4]={ 1066.5029296875, -1200.86328125, 18.405519485474 } } local pedCus = { [1]={ 9 }, [2]={ 10 }, [3]={ 14 }, [4]={ 15 }, [5]={ 37 } } Teame = createTeam("Taxi Driver", 0, 255, 0) taxiTeams = { [Teame] = true } taxiVehs = { [420] = true } function startJob ( thePlayer ) local x, y, z = unpack ( pickups [ math.random ( #pickups ) ] ) markers [ thePlayer ] = createMarker ( x, y, z, "cylinder", 5.0, 255, 0, 0, 0 ) local skins = unpack ( pedCus [ math.random ( #pedCus ) ] ) peds [ thePlayer ] = createPed( skins, x, y, z ) blips [ thePlayer ] = createBlipAttachedTo ( markers [ thePlayer ], 41 ) addEventHandler ( "onMarkerHit", markers [ thePlayer ], warpit ) end function teamSet ( ) local team = getTeamFromName ( "Taxi Driver" ) if team then setPlayerTeam ( source, team ) setPlayerNametagColor ( source, 0, 255, 0 ) setElementModel(source, 57) outputChatBox("You are now employed as a Taxi Driver!", thePlayer) else local teamw = getTeamFromName ( "Taxi Driver" ) if teamw then cancelEvent() outputChatBox("You are already a Taxi driver!", source) end end end addEvent ( "sTeame", true) addEventHandler ( "sTeame", root, teamSet ) function enterVehicle ( thePlayer, seat, jacked ) -- when a player enters a vehicle if getElementType ( thePlayer ) == "player" then if ( taxiVehs[getElementModel ( source )] ) and ( not taxiTeams[getPlayerTeam( thePlayer )] ) then -- if the vehicle is one of 4 police cars, and the skin is not a police skin removePedFromVehicle( thePlayer )-- force the player out of the vehicle outputChatBox("Only Taxi Drivers can drive this vehicle!", thePlayer) end end end addEventHandler ( "onVehicleEnter", getRootElement(), enterVehicle ) markers = { } blips = { } peds = { } function inVEH ( thePlayer ) if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then if ( getElementModel ( source ) == 420 ) then startJob ( thePlayer ) addEventHandler ( "onMarkerHit", markers [ thePlayer ], dropoff ) end end end addEvent("onVehicleEnter", true) addEventHandler ( "onVehicleEnter", getRootElement(), inVEH ) function warpit ( thePlayer ) if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then local vehicle = getPedOccupiedVehicle ( thePlayer ) if ( getElementModel ( vehicle ) == 420 ) then setTimer(warpPedIntoVehicle, 2000, 1, peds [ thePlayer ], vehicle, 2 ) pickMeUp ( thePlayer ) end end end function dropoff( thePlayer ) if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then local vehiclee = getPedOccupiedVehicle ( thePlayer ) if ( getElementModel ( vehiclee ) == 420 ) then local x, y, z = unpack ( dropoffss [ math.random ( #dropoffss ) ] ) markers [ thePlayer ] = createMarker ( x, y, z - 1, "cylinder", 5.0, 255, 0, 0, 50 ) blips [ thePlayer ] = createBlipAttachedTo ( markers [ thePlayer ], 41 ) addEventHandler("onMarkerHit", markers [ thePlayer ], pickmeup) end end end function pickmeup( thePlayer ) givePlayerMoney( thePlayer, 500 ) setTimer(destroyElement, 3000, 1, peds [ thePlayer ]) setTimer(outputChatBox, 1000, 1, "You have earned $500!", thePlayer, 255, 124, 0) destroyElement( blips [ thePlayer ] ) destroyElement( markers [ thePlayer ] ) if outputChatBox ( "Destination reached.", thePlayer ) then if startJob ( thePlayer ) then removeEventHandler("onMarkerHit", getRootElement(), dropoff) end end end function deleteOnExit( thePlayer ) destroyElement( blips [ thePlayer ] ) destroyElement( markers [ thePlayer ] ) destroyElement( peds [ thePlayer ] ) end addEventHandler("onVehicleExit", getRootElement(), deleteOnExit) function pickMeUp ( thePlayer ) if ( isElement ( markers [ thePlayer ] ) ) then destroyElement ( markers [ thePlayer ] ) end if ( isElement ( blips [ thePlayer ] ) ) then destroyElement( blips [ thePlayer ] ) end end
-
I got it! Thank you very much, problem was it was destroying the Elements before the were created!
-
I have this so far function startJob ( thePlayer ) local x, y, z = unpack ( pickups [ math.random ( #pickups ) ] ) markers [ thePlayer ] = createMarker ( x, y, z, "cylinder", 3.5, 255, 0, 0 ) local skins = unpack ( pedCus [ math.random ( #pedCus ) ] ) peds [ thePlayer ] = createPed( skins, x, y, z ) blips [ thePlayer ] = createBlipAttachedTo ( markers [ thePlayer ], 41 ) addEventHandler ( "onMarkerHit", markers [ thePlayer ], warpit ) end function teamSet ( ) local team = getTeamFromName ( "Taxi Driver" ) if team then setPlayerTeam ( source, team ) setPlayerNametagColor ( source, 0, 255, 0 ) setElementModel(source, 57) outputChatBox("You are now employed as a Taxi Driver!", thePlayer) else local teamw = getTeamFromName ( "Taxi Driver" ) if teamw then cancelEvent() outputChatBox("You are already a Taxi driver!", source) end end end addEvent ( "sTeame", true) addEventHandler ( "sTeame", root, teamSet ) function enterVehicle ( thePlayer, seat, jacked ) -- when a player enters a vehicle if getElementType ( thePlayer ) == "player" then if ( taxiVehs[getElementModel ( source )] ) and ( not taxiTeams[getPlayerTeam( thePlayer )] ) then -- if the vehicle is one of 4 police cars, and the skin is not a police skin removePedFromVehicle( thePlayer )-- force the player out of the vehicle outputChatBox("Only Taxi Drivers can drive this vehicle!", thePlayer) end end end addEventHandler ( "onVehicleEnter", getRootElement(), enterVehicle ) markers = { } blips = { } peds = { } function inVEH ( thePlayer ) if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then if ( getElementModel ( source ) == 420 ) then addEventHandler ( "onMarkerHit", markers [ thePlayer ], dropoff ) end else if ( isElement ( markers [ thePlayer ] ) ) then destroyElement ( markers [ thePlayer ] ) end if ( isElement ( blips [ thePlayer ] ) ) then destroyElement( blips [ thePlayer ] ) end end end addEvent("onVehicleEnter", true) addEventHandler ( "onVehicleEnter", getRootElement(), inVEH ) function warpit ( thePlayer ) if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then local vehicle = getPedOccupiedVehicle ( thePlayer ) if ( getElementModel ( vehicle ) == 420 ) then warpPedIntoVehicle ( peds [ thePlayer ], vehicle, 2 ) pickMeUp ( thePlayer ) end end end function dropoff( thePlayer ) if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then local vehiclee = getPedOccupiedVehicle ( thePlayer ) if ( getElementModel ( vehiclee ) == 420 ) then local x, y, z = unpack ( dropoffss [ math.random ( #dropoffss ) ] ) markers [ thePlayer ] = createMarker ( x, y, z - 1, "cylinder", 3.5, 255, 0, 0, 50 ) blips [ thePlayer ] = createBlipAttachedTo ( markers [ thePlayer ], 41 ) addEventHandler("onMarkerHit", markers [ thePlayer ], pickmeup) end end end function pickmeup( thePlayer ) givePlayerMoney( thePlayer, 500 ) setTimer(destroyElement, 3000, 1, peds [ thePlayer ]) setTimer(outputChatBox, 1000, 1, "Customer : Thank you very much!", thePlayer) setTimer(outputChatBox, 1000, 1, "You have eaerned $500!", thePlayer, 255, 124, 0) destroyElement( blips [ thePlayer ] ) destroyElement( markers [ thePlayer ] ) outputChatBox ( "Destination reached.", thePlayer ) triggerEvent("nowLie", getRootElement()) end function deleteOnExit( thePlayer ) destroyElement( blips [ thePlayer ] ) destroyElement( markers [ thePlayer ] ) destroyElement( peds [ thePlayer ] ) end addEventHandler("onVehicleExit", getRootElement(), deleteOnExit) function pickMeUp ( thePlayer ) if ( isElement ( markers [ thePlayer ] ) ) then destroyElement ( markers [ thePlayer ] ) end if ( isElement ( blips [ thePlayer ] ) ) then destroyElement( blips [ thePlayer ] ) end end
-
I edited my previous post.
-
You must have the Utmost patience with people. Do I remove local x, y, z = unpack ( pickups [ math.random ( #pickups ) ] ) markers [ thePlayer ] = createMarker ( x, y, z, "cylinder", 3.5, 255, 0, 0 ) local skins = unpack ( pedCus [ math.random ( #pedCus ) ] ) peds [ thePlayer ] = createPed( skins, x, y, z ) blips [ thePlayer ] = createBlipAttachedTo ( markers [ thePlayer ], 41 ) addEventHandler ( "onMarkerHit", markers [ thePlayer ], warpit ) From my other functions?
-
Okay, i give up , I have no idea any more
-
Hey, i made a script which creates a marker when the player enters a vehicle, how do i trigger this event again when another marker is hit, so the player doesn't need to exit then enter the vehicle again?
-
) expected near ',' line 5
-
Hey can I ask why this doesn't save the Elements position? function saved( thePlayer ) local playerName = getPlayerAccount( thePlayer ) if (playerName) then local position = getElementPosition( thePlayer ) if (position) then setAccountData( playerName, "positions", position) end end end function set( thePlayer, playerName ) if (playerName) then positions = getAccountData( thePlayer, "positions" ) if (positions) then setElementPosition( thePlayer, positions) end end end addEventHandler("onPlayerQuit", getRootElement(), saved) addEventHandler("onPlayerLogin", getRootElement(), set)
-
If i have created my function how would I execute it when they enter the vehicle the finish the job?
-
A quick question Castillo, how do I make the script happen again, I tried triggerEvent("onVehicleEnter", root) But it didn't trigger it?
-
Sarcastic or not, it is scary what you find in Google!
-
I'm sorry Castillo, I'm so confused, I attempted what you said and, local pickups = { [1]={ 2060.7685546875, -1941.1181640625, 13.14103603363 }, [2]={ 2114.5068359375, -1611.302734375, 13.167269706726 }, [3]={ 1932.9521484375, -1776.1259765625, 13.16081237793 }, [4]={ 1057.41796875, -1568.4853515625, 13.166387557983 } } local dropoffs = { [1]={ 1965.54296875 , -1883.013671875, 13.160305023193 }, [2]={ 1467.3916015625, -1736.419921875, 13.242918014526 }, [3]={ 2376.1064453125, -1728.4091796875, 13.162055015564 }, [4]={ 1066.5029296875, -1200.86328125, 18.405519485474 } } local pedCus = { [1]={ 9 }, [2]={ 10 }, [3]={ 14 }, [4]={ 15 }, [5]={ 37 } } Team = createTeam("Taxi Driver", 0, 255, 0) busTeams = { [Team] = true } busVehs = { [420] = true } function enterVehicle ( thePlayer, seat, jacked ) -- when a player enters a vehicle if getElementType ( thePlayer ) == "player" then if ( busVehs[getElementModel ( source )] ) and ( not busTeams[getPlayerTeam( thePlayer )] ) then -- if the vehicle is one of 4 police cars, and the skin is not a police skin removePedFromVehicle( thePlayer )-- force the player out of the vehicle outputChatBox("Only Taxi Drivers can drive this vehicle!", thePlayer) end end end addEventHandler ( "onVehicleEnter", getRootElement(), enterVehicle ) markers = { } blips = { } peds = { } function inVEH ( thePlayer ) if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then if ( getElementModel ( source ) == 420 ) then local x, y, z = unpack ( pickups [ math.random ( #pickups ) ] ) markers [ thePlayer ] = createMarker ( x, y, z, "cylinder", 3.5, 255, 0, 0 ) local skins = unpack ( pedCus [ math.random ( #pedCus ) ] ) peds [ thePlayer ] = createPed( skins, x, y, z ) blips [ thePlayer ] = createBlipAttachedTo ( markers [ thePlayer ], 41 ) addEventHandler ( "onMarkerHit", markers [ thePlayer ], warpit ) addEventHandler ( "onMarkerHit", markers [ thePlayer ], dropoff ) end else if ( isElement ( markers [ thePlayer ] ) ) then destroyElement ( markers [ thePlayer ] ) end if ( isElement ( blips [ thePlayer ] ) ) then destroyElement( blips [ thePlayer ] ) triggerEvent("onMarkerHit", root, dropoff) end end end addEventHandler ( "onVehicleEnter", getRootElement(), inVEH ) function warpit ( thePlayer ) if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then local vehicle = getPedOccupiedVehicle ( thePlayer ) if ( getElementModel ( vehicle ) == 420 ) then warpPedIntoVehicle ( peds [ thePlayer ], vehicle, 2 ) pickMeUp ( thePlayer ) end end end function dropoff( thePlayer ) if ( getElementModel ( source ) == 420 ) then local x, y, z = unpack ( dropoff [ math.random ( #dropoff ) ] ) markers [ thePlayer ] = createMarker ( x, y, z - 1, "cylinder", 3.5, 255, 0, 0 ) blips [ thePlayer ] = createBlipAttachedTo ( markers [ thePlayer ], 41 ) end end addEvent("onMarkerHit", true) function pickMeUp ( thePlayer ) if ( isElement ( markers [ thePlayer ] ) ) then destroyElement ( markers [ thePlayer ] ) end if ( isElement ( blips [ thePlayer ] ) ) then destroyElement( blips [ thePlayer ] ) end end
-
What are you typing in? Add me on skype : lloydlogan11
-
copy this forumc.lua GUIEditor = { button = {}, window = {}, } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(0, 274, 331, 493, "V.I.P Panel", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetAlpha(GUIEditor.window[1], 1.00) guiSetVisible( GUIEditor.window[1], false ) Turismo = guiCreateButton(17, 80, 130, 59, "Give Turismo", false, GUIEditor.window[1]) Hydra = guiCreateButton(173, 80, 132, 57, "Give Hydra", false, GUIEditor.window[1]) Chainsaw = guiCreateButton(17, 176, 127, 58, "Give Chainsaw", false, GUIEditor.window[1]) RPG = guiCreateButton(163, 176, 138, 53, "Give RPG x20", false, GUIEditor.window[1]) EnableGodmode = guiCreateButton(10, 268, 129, 54, "Enable Godmode", false, GUIEditor.window[1]) DisableGodmode = guiCreateButton(162, 268, 126, 49, "Disable Godmode", false, GUIEditor.window[1]) NRG500 = guiCreateButton(12, 348, 124, 53, "Give NRG-500", false, GUIEditor.window[1]) Close = guiCreateButton(162, 352, 121, 49, "Close Panel", false, GUIEditor.window[1]) showCursor( false ) function buyCar(thePlayer) triggerServerEvent ( "buyVeh", getLocalPlayer(), "greetingHandler" ) end end ) addEventHandler("onClientGUIClick", root, function() if source == Turismo then triggerServerEvent("Turismo", localPlayer) elseif source == Hydra then triggerServerEvent("Hydra", localPlayer) elseif source == Chainsaw then triggerServerEvent("Chainsaw", localPlayer) elseif source == RPG then triggerServerEvent("RPG", localPlayer) elseif source == NRG500 then triggerServerEvent("NRG500", localPlayer) elseif source == Close then guiSetVisible(GUIEditor.window[1], false) showCursor(false) end end ) function showit ( ) guiSetVisible( GUIEditor.window[1], true ) showCursor( true ) end addCommandHandler( "ovp", showit )
-
It says Bad argument at 2, expected element got nil, markers [ thePlayer ] is the element of the marker, yes? function dropoff( thePlayer ) if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then if ( getElementModel ( source ) == 420 ) then local x, y, z = unpack ( sss [ math.random ( #sss ) ] ) markers [ thePlayer ] = createMarker ( x, y, z - 1, "cylinder", 3.5, 255, 0, 0 ) blips [ thePlayer ] = createBlipAttachedTo ( markers [ thePlayer ], 41 ) if ( isElement ( markers [ thePlayer ] ) ) then destroyElement ( markers [ thePlayer ] ) end if ( isElement ( blips [ thePlayer ] ) ) then destroyElement( blips [ thePlayer ] ) end end end end addEvent("onMarkerHit", true) addEventHandler("onMarkerHit", markers [ thePlayer ], dropoff)
-
Thanks, I will try that now Castillo.