-
Posts
21,935 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Castillo
-
WHATS WRONG IN THIS SCRIPT? SAVING CARS/INTERIORS/DIMENSIONS
Castillo replied to HeavyMetal's topic in Scripting
Well, your column name is called "Interior" and "Dimension", and you are doing "v.interior" lowercase "i". setElementInterior ( vehicle, v.Interior ) -
WHATS WRONG IN THIS SCRIPT? SAVING CARS/INTERIORS/DIMENSIONS
Castillo replied to HeavyMetal's topic in Scripting
That's strange, because you are setting to load them all on interior 1, this line: setElementInterior(vehicle, 1 ,v.px, v.py, v.pz) -
WHATS WRONG IN THIS SCRIPT? SAVING CARS/INTERIORS/DIMENSIONS
Castillo replied to HeavyMetal's topic in Scripting
I changed the following lines: executeSQLQuery ( "CREATE TABLE IF NOT EXISTS vehiclesaverb (VehicleID INT, px REAL, py REAL, pz REAL, rx REAL, ry REAL, rz REAL, Color1 INT, Color2 INT, Health REAL, upgrades TEXT, paintjob INT, Hood INT, Trunk INT, FrontLeft INT, FrontRight INT,RearLeft INEGER, RearRight INEGER, FrontLeftPanel INT, FrontRightPanel INT, RearLeftPanel INT, RearRightPanel INT,Windscreen INT,FrontBumper INT, RearBumper INT,FLL INT,FRL INT,RLL INT, RRL INT, VehOvL INT, HR Real,TR Real,FLR Real,FRR Real, RLR Real, RRR Real,WFL INT, WRL Intger, WFR INT, WRR INT, VehSirena INT, EngineState INT, XTUR Real, YTUR Real, Interior INT, Dimension INT)" ) executeSQLInsert ( "vehiclesaverb","'"..model.."','"..px.."','"..py.."','"..pz.."','"..rx.."','"..ry.."','"..rz.."','"..color1.."','"..color2.."','"..health.."','"..upgrades.."','"..paintjob.."','"..hood.."','"..trunk.."','"..frontleft.."','"..frontright.."','"..rearleft.."','"..rearright.."','"..frontleftpanel.."','"..frontrightpanel.."','"..rearleftpanel.."','"..rearrightpanel.."','"..windscreen.."','"..frontbumper.."','"..rearbumper.."','"..fll.."','"..frl.."','"..rll.."','"..rrl.."','"..VehOvL.."','"..hr.."','"..tr.."','"..flr.."','"..frr.."','"..rlr.."','"..rrr.."','"..wfl.."','"..wrl.."','"..wfr.."','"..wrr.."','"..sirena.."','"..tengine.."','"..xtur.."','"..ytur.."','"..interior.."','"..dimension.."'") -
split is a funciton, you aren't using it as a function, seriously, pay more attention to what you are doing.
-
You must split it then, use: split
-
getColor is a string? like this: "255, 0, 0"?
-
WHATS WRONG IN THIS SCRIPT? SAVING CARS/INTERIORS/DIMENSIONS
Castillo replied to HeavyMetal's topic in Scripting
You had many problems, first is that you aren't creating the table, you are executing a query which has no "CREATE TABLE" inside it, also, you had a problem on dimension/interior saving. function saveVehicles() executeSQLDropTable ( "vehiclesaverb" ) --i added the interior and dimension INT at the end executeSQLQuery ( "CREATE TABLE IF NOT EXISTS vehiclesaverb (VehicleID INT, px REAL, py REAL, pz REAL, rx REAL, ry REAL, rz REAL, Color1 INT, Color2 INT, Health REAL, upgrades TEXT, paintjob INT, Hood INT, Trunk INT, FrontLeft INT, FrontRight INT,RearLeft INEGER, RearRight INEGER, FrontLeftPanel INT, FrontRightPanel INT, RearLeftPanel INT, RearRightPanel INT,Windscreen INT,FrontBumper INT, RearBumper INT,FLL INT,FRL INT,RLL INT, RRL INT, VehOvL INT, HR Real,TR Real,FLR Real,FRR Real, RLR Real, RRR Real,WFL INT, WRL Intger, WFR INT, WRR INT, VehSirena INT, EngineState INT, XTUR Real, YTUR Real, Interior INT, Dimension INT)" ) for i, vehicle in pairs (getElementsByType("vehicle")) do local px, py, pz = getElementPosition(vehicle) local rx, ry, rz = getElementRotation(vehicle) local color1, color2, color3, color4 = getVehicleColor(vehicle) local model = getElementModel(vehicle) local health = getElementHealth (vehicle) local tableUpgrades = getVehicleUpgrades(vehicle) local upgrades = table.concat(tableUpgrades, ",") local paintjob = getVehiclePaintjob(vehicle) local hood = getVehicleDoorState(vehicle,0) local trunk = getVehicleDoorState(vehicle,1) local frontleft = getVehicleDoorState(vehicle,2) local frontright = getVehicleDoorState(vehicle,3) local rearleft = getVehicleDoorState(vehicle,4) local rearright = getVehicleDoorState(vehicle,5) local frontleftpanel = getVehiclePanelState(vehicle,0) local frontrightpanel = getVehiclePanelState(vehicle,1) local rearleftpanel = getVehiclePanelState(vehicle,2) local rearrightpanel = getVehiclePanelState(vehicle,3) local windscreen = getVehiclePanelState(vehicle,4) local frontbumper = getVehiclePanelState(vehicle,5) local rearbumper = getVehiclePanelState(vehicle,6) local fll = tostring(getVehicleLightState(vehicle, 0)) local frl = tostring(getVehicleLightState(vehicle, 1)) local rll = tostring(getVehicleLightState(vehicle, 2)) local rrl = tostring( getVehicleLightState(vehicle, 3)) local VehOvL = getVehicleOverrideLights(vehicle) local hr = getVehicleDoorOpenRatio(vehicle,0) local tr = getVehicleDoorOpenRatio(vehicle,1) local flr = getVehicleDoorOpenRatio(vehicle,2) local frr = getVehicleDoorOpenRatio(vehicle,3) local rlr = getVehicleDoorOpenRatio(vehicle,4) local rrr = getVehicleDoorOpenRatio(vehicle,5) local wfl, wrl, wfr, wrr = getVehicleWheelStates ( vehicle ) if getVehicleSirensOn(vehicle)==true then getsirena=1 elseif getVehicleSirensOn(vehicle)==false then getsirena=0 else getsirena=2 end local sirena = getsirena if getVehicleEngineState ( vehicle )==true then estate=1 else estate=0 end local tengine=estate local xtur, ytur = getVehicleTurretPosition ( vehicle ) local interior = getElementInterior(vehicle) -- i added this line local dimension = getElementDimension(vehicle) -- and this one --added the interior and dimension again executeSQLInsert ( "vehiclesaverb","'"..model.."','"..px.."','"..py.."','"..pz.."','"..rx.."','"..ry.."','"..rz.."','"..color1.."','"..color2.."','"..health.."','"..upgrades.."','"..paintjob.."','"..hood.."','"..trunk.."','"..frontleft.."','"..frontright.."','"..rearleft.."','"..rearright.."','"..frontleftpanel.."','"..frontrightpanel.."','"..rearleftpanel.."','"..rearrightpanel.."','"..windscreen.."','"..frontbumper.."','"..rearbumper.."','"..fll.."','"..frl.."','"..rll.."','"..rrl.."','"..VehOvL.."','"..hr.."','"..tr.."','"..flr.."','"..frr.."','"..rlr.."','"..rrr.."','"..wfl.."','"..wrl.."','"..wfr.."','"..wrr.."','"..sirena.."','"..tengine.."','"..xtur.."','"..ytur.."','"..interior.."','"..dimension.."'") end end addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), saveVehicles) period=get("Period") if (period > 0) then setTimer(saveVehicles,period,0) end function createDatabase() -- added the same interior and dimension INTs here too executeSQLCreateTable ( "vehiclesaverb", "VehicleID INT, px REAL, py REAL, pz REAL, rx REAL, ry REAL, rz REAL, Color1 INT, Color2 INT, Health REAL, upgrades TEXT, paintjob INT, Hood INT, Trunk INT, FrontLeft INT, FrontRight INT,RearLeft INEGER, RearRight INEGER, FrontLeftPanel INT, FrontRightPanel INT, RearLeftPanel INT, RearRightPanel INT,Windscreen INT,FrontBumper INT, RearBumper INT,FLL INT,FRL INT,RLL INT, RRL INT, VehOvL INT, HR Real,TR Real,FLR Real,FRR Real, RLR Real, RRR Real,WFL INT, WRL Intger, WFR INT, WRR INT,VehSirena INT,EngineState INT, XTUR Real, YTUR Real,Interior INT,Dimension INT" ) --Getting datas local vehicles = executeSQLQuery("SELECT * FROM vehiclesaverb") --Spawning the vehicles for i, v in pairs (vehicles) do --i changed the spawn to a specific cord to avoid having the car falling before it interior is set --because the interior i pretend to use is z = 1000 local vehicle = createVehicle( v.VehicleID, -2102, 411, 94, v.rx, v.ry, v.rz ) setElementHealth ( vehicle, v.Health ) setVehicleColor ( vehicle, v.Color1, v.Color2, 0, 0 ) if ( v.paintjob ) then setVehiclePaintjob( vehicle, v.paintjob ) end local upgrades = split( v.upgrades, 44 ) for index, upgrade in pairs (upgrades) do addVehicleUpgrade( vehicle, upgrade ) end setVehicleDoorState ( vehicle, 0, v.Hood ) setVehicleDoorState ( vehicle, 1, v.Trunk ) setVehicleDoorState ( vehicle, 2, v.FrontLeft ) setVehicleDoorState ( vehicle, 3, v.FrontRight ) setVehicleDoorState ( vehicle, 4, v.RearLeft ) setVehicleDoorState ( vehicle, 5, v.RearRight ) setVehiclePanelState (vehicle,0,v.FrontLeftPanel) setVehiclePanelState (vehicle,1,v.FrontRightPanel) setVehiclePanelState (vehicle,2,v.RearLeftPanel) setVehiclePanelState (vehicle,3,v.RearRightPanel) setVehiclePanelState (vehicle,4,v.Windscreen) setVehiclePanelState (vehicle,5,v.FrontBumper) setVehiclePanelState (vehicle,6,v.RearBumper) setVehicleLightState (vehicle,0,v.FLL) setVehicleLightState (vehicle,1,v.FRL) setVehicleLightState (vehicle,2,v.RLL) setVehicleLightState (vehicle,3,v.RRL) setVehicleOverrideLights(vehicle, v.VehOvL) setVehicleDoorOpenRatio (vehicle,0,v.HR,0) setVehicleDoorOpenRatio (vehicle,1,v.TR,0) setVehicleDoorOpenRatio (vehicle,2,v.FLR,0) setVehicleDoorOpenRatio (vehicle,3,v.FRR,0) setVehicleDoorOpenRatio (vehicle,4,v.RLR,0) setVehicleDoorOpenRatio (vehicle,5,v.RRR,0) setVehicleWheelStates ( vehicle, v.WFL, v.WRL, v.WFR, v.WRR ) -- added this too setElementDimension(vehicle, v.Dimension) setElementInterior(vehicle, 1 ,v.px, v.py, v.pz) -- i added the saved cords here, so it go to the right place after spawned, but this is not happening too --. if v.VehSirena==1 then vsirena=true elseif v.VehSirena==0 then vsirena=false end if (v.VehSirena~=2) then setVehicleSirensOn(vehicle,vsirena) end if v.EngineState==1 then setVehicleEngineState(vehicle,true) else setVehicleEngineState(vehicle,false) end setVehicleTurretPosition ( vehicle, v.XTUR, v.YTUR ) end outputChatBox( #vehicles.." vehicles were created by Garage Master", getRootElement(), 0, 255, 0 ) outputDebugString ( #vehicles.." vehicles were created by Garage Master" ) end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), createDatabase) addCommandHandler("cleargarages", function() destroyElement(getResourceRootElement()) executeSQLDropTable ( "vehiclesaverb" ) end ) -
viewtopic.php?f=148&t=40809
-
Change: triggerServerEvent("rog:modshop:color:setColor",localPlayer,getColor) to: triggerServerEvent ( "rog:modshop:color:setColor", localPlayer, localPlayer, getColor )
-
Use: onClientPlayerWeaponFire playSound3D https://wiki.multitheftauto.com/wiki/Set ... undEnabled
-
local screenWidth, screenHeight = guiGetScreenSize ( ) function createText ( ) dxDrawText ( "Panda is awesome.", 44, screenHeight-43, screenWidth, screenHeight, tocolor ( 111, 155, 0, 255 ), 1, "bankgothic" ) end addEventHandler ( "onClientRender",root, createText ) setTimer ( function ( ) removeEventHandler ( "onClientRender", root, createText ) end ,2500, 1, ) Is that what you wanted?
-
You created it server side? if so, I had that problem too, isElementInWater returns true even when not in water, I had to do it client side instead.
-
That's wrong, the marker won't be visible on all dimensions. @HeavyMetal: There's no easy way to create a marker in all dimensions.
-
The problem was here: guiSetPosition(rog_modshop_main_window,0,3,true) last argument should of been: "false".
-
setCameraInterior setCameraMatrix
-
When the resource starts ( server side ), and triggers the client side event, it outputs that error because the client side is not yet loaded. Also, you need onClientRender to draw the the text, also, you would need to check if the "nemsi" element exists.
-
On same line and same error?