InVision Posted August 22, 2013 Posted August 22, 2013 addEvent("pizzaReachDestination",true) addEventHandler("pizzaReachDestination",getRootElement(), function (thePlayer) if not isPedInVehicle(thePlayer) then return end theVehicle = getPedOccupiedVehicle(thePlayer) if not getElementModel(theVehicle) == "448" then return end outputChatBox("You have delivered the pizza, and received $25", thePlayer, 0, 255, 0) exports.global:giveMoney(thePlayer, 25) if getElementData(thePlayer,"pizzaStop") == #pizzaRoute[getElementData(thePlayer,"pizzaRoute")] then setElementData(thePlayer,"pizzaStop",1) else setElementData(thePlayer,"pizzaStop",tonumber(getElementData(thePlayer,"pizzaStop"))+1) end GGgetNewDDestination(thePlayer, getElementData(thePlayer,"pizzaStop")) end ) The script is not recognizing the Pizza Boy as vehicle? maybe there's something I did wrong? No nudity in signatures -Moderators ( . ) ( . ) <-- Breasts or eyes, use your imagination. Wowzas *childish giggle*
Moderators IIYAMA Posted August 22, 2013 Moderators Posted August 22, 2013 addEvent("pizzaReachDestination",true) addEventHandler("pizzaReachDestination",getRootElement(), function (thePlayer) local theVehicle = getPedOccupiedVehicle(thePlayer) if not theVehicle or getElementModel(theVehicle) ~= 448 then return end -- must be a number, not a string "448" > 448 -- outputChatBox("You have delivered the pizza, and received $25", thePlayer, 0, 255, 0) exports.global:giveMoney(thePlayer, 25) if getElementData(thePlayer,"pizzaStop") == #pizzaRoute[getElementData(thePlayer,"pizzaRoute")] then setElementData(thePlayer,"pizzaStop",1) else setElementData(thePlayer,"pizzaStop",tonumber(getElementData(thePlayer,"pizzaStop"))+1) end GGgetNewDDestination(thePlayer, getElementData(thePlayer,"pizzaStop")) end) Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
InVision Posted August 22, 2013 Author Posted August 22, 2013 It's suppose to be a string, I have this script set up with other vehicles, but it just won't work with the Pizza Boy But here's the second part of the script, maybe I did something wrong on it... addEventHandler("onVehicleEnter", getRootElement(), function (thePlayer) theVehicle = getPedOccupiedVehicle(thePlayer) if getVehicleName(theVehicle) == "pizzaboy" then if getPedOccupiedVehicleSeat(thePlayer) == 0 then setElementData(thePlayer,"pizzaStop",1 ) setElementData(thePlayer,"pizzaRoute",math.random(1, 5)) thepizzaRoute = getElementData(thePlayer,"pizzaRoute") outputChatBox("Drive to the Flag Blips and drive through the Blue Markers to deliver the pizzas, and receive your pay.", thePlayer, 255, 194, 15) outputChatBox("*If you exit the vehicle, you'll have to restart the whole route over again*", thePlayer, 255, 0, 0) outputDebugString("Driving on route ".. tonumber(pizzaRoute[thepizzaRoute][0][1]) .. " towards " .. pizzaRoute[thepizzaRoute][0][2]) local name, size, x, y, z = GGgetNewDDestination(thePlayer, 1) end end end ) No nudity in signatures -Moderators ( . ) ( . ) <-- Breasts or eyes, use your imagination. Wowzas *childish giggle*
Moderators IIYAMA Posted August 22, 2013 Moderators Posted August 22, 2013 no no no, now you post another script. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
InVision Posted August 22, 2013 Author Posted August 22, 2013 (edited) if getVehicleName(theVehicle) == "pizzaboy" then --> "pizzaboy" apparently I had to make it capitalized "Pizzaboy" :facepalm: Edited August 22, 2013 by Guest No nudity in signatures -Moderators ( . ) ( . ) <-- Breasts or eyes, use your imagination. Wowzas *childish giggle*
InVision Posted August 22, 2013 Author Posted August 22, 2013 no no no, now you post another script. It's the second part of the script... No nudity in signatures -Moderators ( . ) ( . ) <-- Breasts or eyes, use your imagination. Wowzas *childish giggle*
Moderators IIYAMA Posted August 23, 2013 Moderators Posted August 23, 2013 oh didn't not read that part, is everything fixed now? Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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