albers14 Posted April 22, 2013 Posted April 22, 2013 Hey all I tried to make this script for outputting all the information about all siren points at my vehicle but unsuccesfull function getSirens(thePlayer) if thePlayer and isPedInVehicle(thePlayer) then sirenData = getVehicleSirens(getPedOccupiedVehicle(thePlayer)) parm = getVehicleSirenParams(getPedOccupiedVehicle(thePlayer)) int = parm.SirenCount for i = 1,int do outputChatBox("setVehicleSirens(getPedOccupiedVehicle(thePlayer),"..i..","..tostring(sirenData[i][4])..","..tostring(sirenData[i][5])..","..tostring(sirenData[i][6])..","..tostring(sirenData[i][1])..","..tostring(sirenData[i][2])..","..tostring(sirenData[i][3])..")") end end end addCommandHandler("specs", getSirens) The outputchatbox 6 last arguments outputs nil where they should give me a number. Any solution? The for i = 1, int do works fine as it outputs the number find
funstein Posted April 22, 2013 Posted April 22, 2013 (edited) function getSirens(thePlayer) if thePlayer and isPedInVehicle(thePlayer) then sirenData = getVehicleSirens(getPedOccupiedVehicle(thePlayer)) for i,siren in ipairs(sirenData) do outputChatBox("setVehicleSirens(getPedOccupiedVehicle(thePlayer),"..i..","..tostring(siren[4])..","..tostring(siren[5])..","..tostring(siren[6])..","..tostring(siren[1])..","..tostring(siren[2])..","..tostring(siren[3])..")") end end end addCommandHandler("specs", getSirens) Edited April 22, 2013 by Guest
Jaysds1 Posted April 22, 2013 Posted April 22, 2013 try this: addCommandHandler("specs",function(thePlayer) if not isPedInVehicle(thePlayer)then return end local pVeh = getPedOccupiedVehicle(thePlayer) local sirenData = getVehicleSirens(pVeh) local parm = getVehicleSirenParams(pVeh) if not sirenData or not parm then return end local int = parm.SirenCount for i = 0,int do outputChatBox("setVehicleSirens(getPedOccupiedVehicle(thePlayer),"..i..","..tostring(sirenData[i][4])..","..tostring(sirenData[i][5])..","..tostring(sirenData[i][6])..","..tostring(sirenData[i][1])..","..tostring(sirenData[i][2])..","..tostring(sirenData[i][3])..")") end end)
albers14 Posted April 22, 2013 Author Posted April 22, 2013 getVehicleSirens is bugged it returns nil.
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