5150 Posted October 3, 2016 Share Posted October 3, 2016 i know this is a really long shot but is there any way to convert this script from SQL to a database or something? it saves all vehicle upgrades on car spawn/despawn but only with SQL, and sadly i dont use SQL but its a great mod.... Spoiler --carMarker1 = createMarker(2200.72729,1390.67089,10.820312,"cylinder",2,100,100,0,200) carMarker2 = createMarker(-1953.26270, 277.09067, 34,"cylinder",2,100,100,0,200) --carMarker3 = createMarker(542.237426,-1290.63793,17.24218,"cylinder",2,100,100,0,200) --createBlipAttachedTo(carMarker1,55,2,0,0,0,255,0,180) createBlipAttachedTo(carMarker2,55,2,0,0,0,255,0,180) --createBlipAttachedTo(carMarker3,55,2,0,0,0,255,0,180) --bikMarker1 = createMarker(1045.79919,1016.98663,11,"cylinder",2,100,0,100,200) bikMarker2 = createMarker(-1883.037597,825.024597,34.5,"cylinder",2,100,0,100,200) --bikMarker3 = createMarker(1108.807250,-1796.07531,16.59375,"cylinder",2,100,0,100,200) --createBlipAttachedTo(bikMarker1,8,2,0,0,0,255,0,180) createBlipAttachedTo(bikMarker2,8,2,0,0,0,255,0,180) --createBlipAttachedTo(bikMarker3,8,2,0,0,0,255,0,180) --planeMarker1 = createMarker(1668.717529,1471.637207,10.77422,"cylinder",2,0,100,100,200) planeMarker2 = createMarker(-1261.489624,39.369747,14.139139,"cylinder",2,0,100,100,200) --planeMarker3 = createMarker(1644.834960,-2286.074951,-1.202478,"cylinder",2,0,100,100,200) --createBlipAttachedTo(planeMarker1,5,2,0,0,0,255,0,180) createBlipAttachedTo(planeMarker2,5,2,0,0,0,255,0,180) --createBlipAttachedTo(planeMarker3,5,2,0,0,0,255,0,180) --boatMarker1 = createMarker(2019.428466,1545.56347,10.8271465,"cylinder",2,100,150,200,200) boatMarker2 = createMarker(-1738.0865478,30.515306,3.55468,"cylinder",2,100,150,200,200) --boatMarker3 = createMarker(154.420471,-1943.23535,3.773437,"cylinder",2,100,150,200,200) --createBlipAttachedTo(boatMarker1,9,2,0,0,0,255,0,180) createBlipAttachedTo(boatMarker2,9,2,0,0,0,255,0,180) --createBlipAttachedTo(boatMarker3,9,2,0,0,0,255,0,180) addEventHandler("onMarkerHit",getRootElement(), function(hitElement) if (source == carMarker1) or (source == carMarker2) or (source == carMarker3) then triggerClientEvent(hitElement,"showcarmarker",hitElement) elseif (source == bikMarker1) or (source == bikMarker2) or (source == bikMarker3) then triggerClientEvent(hitElement,"showbikmarker",hitElement) elseif (source == planeMarker1) or (source == planeMarker2) or (source == planeMarker3) then triggerClientEvent(hitElement,"showplanemarker",hitElement) elseif (source == boatMarker1) or (source == boatMarker2) or (source == boatMarker3) then triggerClientEvent(hitElement,"showboatmarker",hitElement) end end) function createsql () executeSQLQuery("CREATE TABLE IF NOT EXISTS carslot1 (PlayerName TEXT, Model NUMERIC, Cost NUMERIC, Paintjob NUMERIC, Color TEXT, Upgrade0 NUMERIC, Upgrade1 NUMERIC, Upgrade2 NUMERIC, Upgrade3 NUMERIC, Upgrade4 NUMERIC, Upgrade5 NUMERIC, Upgrade6 NUMERIC, Upgrade7 NUMERIC, Upgrade8 NUMERIC, Upgrade9 NUMERIC, Upgrade10 NUMERIC, Upgrade11 NUMERIC, Upgrade12 NUMERIC, Upgrade13 NUMERIC, Upgrade14 NUMERIC, Upgrade15 NUMERIC, Upgrade16 NUMERIC)") executeSQLQuery("CREATE TABLE IF NOT EXISTS carslot2 (PlayerName TEXT, Model NUMERIC, Cost NUMERIC, Paintjob NUMERIC, Color TEXT, Upgrade0 NUMERIC, Upgrade1 NUMERIC, Upgrade2 NUMERIC, Upgrade3 NUMERIC, Upgrade4 NUMERIC, Upgrade5 NUMERIC, Upgrade6 NUMERIC, Upgrade7 NUMERIC, Upgrade8 NUMERIC, Upgrade9 NUMERIC, Upgrade10 NUMERIC, Upgrade11 NUMERIC, Upgrade12 NUMERIC, Upgrade13 NUMERIC, Upgrade14 NUMERIC, Upgrade15 NUMERIC, Upgrade16 NUMERIC)") executeSQLQuery("CREATE TABLE IF NOT EXISTS bikslot1 (PlayerName TEXT, Model NUMERIC, Cost NUMERIC, Paintjob NUMERIC, Color TEXT, Upgrade0 NUMERIC, Upgrade1 NUMERIC, Upgrade2 NUMERIC, Upgrade3 NUMERIC, Upgrade4 NUMERIC, Upgrade5 NUMERIC, Upgrade6 NUMERIC, Upgrade7 NUMERIC, Upgrade8 NUMERIC, Upgrade9 NUMERIC, Upgrade10 NUMERIC, Upgrade11 NUMERIC, Upgrade12 NUMERIC, Upgrade13 NUMERIC, Upgrade14 NUMERIC, Upgrade15 NUMERIC, Upgrade16 NUMERIC)") executeSQLQuery("CREATE TABLE IF NOT EXISTS bikslot2 (PlayerName TEXT, Model NUMERIC, Cost NUMERIC, Paintjob NUMERIC, Color TEXT, Upgrade0 NUMERIC, Upgrade1 NUMERIC, Upgrade2 NUMERIC, Upgrade3 NUMERIC, Upgrade4 NUMERIC, Upgrade5 NUMERIC, Upgrade6 NUMERIC, Upgrade7 NUMERIC, Upgrade8 NUMERIC, Upgrade9 NUMERIC, Upgrade10 NUMERIC, Upgrade11 NUMERIC, Upgrade12 NUMERIC, Upgrade13 NUMERIC, Upgrade14 NUMERIC, Upgrade15 NUMERIC, Upgrade16 NUMERIC)") executeSQLQuery("CREATE TABLE IF NOT EXISTS planeslot1 (PlayerName TEXT, Model NUMERIC, Cost NUMERIC, Paintjob NUMERIC, Color TEXT, Upgrade0 NUMERIC, Upgrade1 NUMERIC, Upgrade2 NUMERIC, Upgrade3 NUMERIC, Upgrade4 NUMERIC, Upgrade5 NUMERIC, Upgrade6 NUMERIC, Upgrade7 NUMERIC, Upgrade8 NUMERIC, Upgrade9 NUMERIC, Upgrade10 NUMERIC, Upgrade11 NUMERIC, Upgrade12 NUMERIC, Upgrade13 NUMERIC, Upgrade14 NUMERIC, Upgrade15 NUMERIC, Upgrade16 NUMERIC)") executeSQLQuery("CREATE TABLE IF NOT EXISTS planeslot2 (PlayerName TEXT, Model NUMERIC, Cost NUMERIC, Paintjob NUMERIC, Color TEXT, Upgrade0 NUMERIC, Upgrade1 NUMERIC, Upgrade2 NUMERIC, Upgrade3 NUMERIC, Upgrade4 NUMERIC, Upgrade5 NUMERIC, Upgrade6 NUMERIC, Upgrade7 NUMERIC, Upgrade8 NUMERIC, Upgrade9 NUMERIC, Upgrade10 NUMERIC, Upgrade11 NUMERIC, Upgrade12 NUMERIC, Upgrade13 NUMERIC, Upgrade14 NUMERIC, Upgrade15 NUMERIC, Upgrade16 NUMERIC)") executeSQLQuery("CREATE TABLE IF NOT EXISTS boatslot1 (PlayerName TEXT, Model NUMERIC, Cost NUMERIC, Paintjob NUMERIC, Color TEXT, Upgrade0 NUMERIC, Upgrade1 NUMERIC, Upgrade2 NUMERIC, Upgrade3 NUMERIC, Upgrade4 NUMERIC, Upgrade5 NUMERIC, Upgrade6 NUMERIC, Upgrade7 NUMERIC, Upgrade8 NUMERIC, Upgrade9 NUMERIC, Upgrade10 NUMERIC, Upgrade11 NUMERIC, Upgrade12 NUMERIC, Upgrade13 NUMERIC, Upgrade14 NUMERIC, Upgrade15 NUMERIC, Upgrade16 NUMERIC)") executeSQLQuery("CREATE TABLE IF NOT EXISTS boatslot2 (PlayerName TEXT, Model NUMERIC, Cost NUMERIC, Paintjob NUMERIC, Color TEXT, Upgrade0 NUMERIC, Upgrade1 NUMERIC, Upgrade2 NUMERIC, Upgrade3 NUMERIC, Upgrade4 NUMERIC, Upgrade5 NUMERIC, Upgrade6 NUMERIC, Upgrade7 NUMERIC, Upgrade8 NUMERIC, Upgrade9 NUMERIC, Upgrade10 NUMERIC, Upgrade11 NUMERIC, Upgrade12 NUMERIC, Upgrade13 NUMERIC, Upgrade14 NUMERIC, Upgrade15 NUMERIC, Upgrade16 NUMERIC)") end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), createsql) addEvent("buycar1",true) addEventHandler("buycar1",getRootElement(), function(id,cost,name) if (getPlayerMoney(client)>= tonumber(cost)) then local account = getPlayerAccount(client) local name = getAccountName(account) local playercar = executeSQLQuery("SELECT Model,Paintjob,Color,Upgrade0,Upgrade1,Upgrade2,Upgrade3,Upgrade4,Upgrade5,Upgrade6,Upgrade7,Upgrade8,Upgrade9,Upgrade10,Upgrade11,Upgrade12,Upgrade13,Upgrade14,Upgrade15,Upgrade16 FROM carslot1 WHERE PlayerName = ?",name) if #playercar > 0 then outputChatBox("You cant buy this car since you already have one in this slot",client) else --[[local c1xml = xmlLoadFile("buyingc1.dat") if not c1xml then c1xml = xmlCreateFile("buyingc1.dat","wang") end local node = xmlCreateChild(c1xml,"buyc1") local msg = name.." tried to buy vehicle "..getVehicleNameFromModel(id) local success1 = xmlNodeSetValue(node,msg)]] local paintjob = 3 local color = "88,88,83,70,89,122" takePlayerMoney(client,tonumber(cost)) local addVehicle = executeSQLQuery("INSERT INTO carslot1 (PlayerName,Model,Cost,Paintjob,Color,Upgrade0,Upgrade1,Upgrade2,Upgrade3,Upgrade4,Upgrade5,Upgrade6,Upgrade7,Upgrade8,Upgrade9,Upgrade10,Upgrade11,Upgrade12,Upgrade13,Upgrade14,Upgrade15,Upgrade16) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", tostring(name), tonumber(id), tonumber(cost), tonumber(paintjob), tostring(color), " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ") if addVehicle then -- local msg2 = name.." succeeded in sale $"..cost --local node2 = xmlCreateChild(c1xml,"buyc1") --local success2 = xmlNodeSetValue(node2,msg2) outputChatBox("Vehicle bought successfully",client) else --local msg2 = name.." failed in sale $"..cost --local node2 = xmlCreateChild(c1xml,"buyc1") --local success2 = xmlNodeSetValue(node2,msg2) outputChatBox("Vehicle has not been bought",client) end --xmlSaveFile(c1xml) --xmlUnloadFile(c1xml) end else outputChatBox("You dont have enough money to buy this car",client) end end) addEvent("buycar2",true) addEventHandler("buycar2",getRootElement(), function(id,cost,name) if (getPlayerMoney(client)>= tonumber(cost)) then local account = getPlayerAccount(client) local name = getAccountName(account) local playercar = executeSQLQuery("SELECT Model,Paintjob,Color,Upgrade0,Upgrade1,Upgrade2,Upgrade3,Upgrade4,Upgrade5,Upgrade6,Upgrade7,Upgrade8,Upgrade9,Upgrade10,Upgrade11,Upgrade12,Upgrade13,Upgrade14,Upgrade15,Upgrade16 FROM carslot2 WHERE PlayerName = ?",name) if #playercar > 0 then outputChatBox("You cant buy this car since you already have one in this slot",client) else --[[local c2xml = xmlLoadFile("buyingc2.dat") if not c2xml then c2xml = xmlCreateFile("buyingc2.dat","wang") end local node = xmlCreateChild(c2xml,"buyc2") local msg = name.." tried to buy vehicle "..getVehicleNameFromModel(id) local success1 = xmlNodeSetValue(node,msg)]] local paintjob = 3 local color = "88,88,83,70,89,122" takePlayerMoney(client,tonumber(cost)) local addVehicle = executeSQLQuery("INSERT INTO carslot2 (PlayerName,Model,Cost,Paintjob,Color,Upgrade0,Upgrade1,Upgrade2,Upgrade3,Upgrade4,Upgrade5,Upgrade6,Upgrade7,Upgrade8,Upgrade9,Upgrade10,Upgrade11,Upgrade12,Upgrade13,Upgrade14,Upgrade15,Upgrade16) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", tostring(name), tonumber(id), tonumber(cost), tonumber(paintjob), tostring(color), " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ") if addVehicle then --local msg2 = name.." succeeded in sale $"..cost --local node2 = xmlCreateChild(c2xml,"buyc2") --local success2 = xmlNodeSetValue(node2,msg2) outputChatBox("Vehicle bought successfully",client) else --local msg2 = name.." failed in sale $"..cost --local node2 = xmlCreateChild(c2xml,"buyc2") --local success2 = xmlNodeSetValue(node2,msg2) outputChatBox("Vehicle has not been bought",client) end --xmlSaveFile(c2xml) --xmlUnloadFile(c2xml) end else outputChatBox("You dont have enough money to buy this car",client) end end) addEvent("buybik1",true) addEventHandler("buybik1",getRootElement(), function(id,cost,name) if (getPlayerMoney(client)>= tonumber(cost)) then local account = getPlayerAccount(client) local name = getAccountName(account) local playercar = executeSQLQuery("SELECT Model,Paintjob,Color,Upgrade0,Upgrade1,Upgrade2,Upgrade3,Upgrade4,Upgrade5,Upgrade6,Upgrade7,Upgrade8,Upgrade9,Upgrade10,Upgrade11,Upgrade12,Upgrade13,Upgrade14,Upgrade15,Upgrade16 FROM bikslot1 WHERE PlayerName = ?",name) if #playercar > 0 then outputChatBox("You cant buy this car since you already have one in this slot",client) else --[[local b1xml = xmlLoadFile("buyingb1.dat") if not b1xml then b1xml = xmlCreateFile("buyingb1.dat","wang") end local node = xmlCreateChild(b1xml,"buyb1") local msg = name.." tried to buy vehicle "..getVehicleNameFromModel(id) local success1 = xmlNodeSetValue(node,msg)]] local paintjob = 3 local color = "88,88,83,70,89,122" takePlayerMoney(client,tonumber(cost)) local addVehicle = executeSQLQuery("INSERT INTO bikslot1 (PlayerName,Model,Cost,Paintjob,Color,Upgrade0,Upgrade1,Upgrade2,Upgrade3,Upgrade4,Upgrade5,Upgrade6,Upgrade7,Upgrade8,Upgrade9,Upgrade10,Upgrade11,Upgrade12,Upgrade13,Upgrade14,Upgrade15,Upgrade16) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", tostring(name), tonumber(id), tonumber(cost), tonumber(paintjob), tostring(color), " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ") if addVehicle then --local msg2 = name.." succeeded in sale $"..cost --local node2 = xmlCreateChild(b1xml,"buyb1") --local success2 = xmlNodeSetValue(node2,msg2) outputChatBox("Vehicle bought successfully",client) else --local msg2 = name.." failed in sale $"..cost --local node2 = xmlCreateChild(b1xml,"buyb1") --local success2 = xmlNodeSetValue(node2,msg2) outputChatBox("Vehicle has not been bought",client) end --xmlSaveFile(b1xml) --xmlUnloadFile(b1xml) end else outputChatBox("You dont have enough money to buy this car",client) end end) addEvent("buybik2",true) addEventHandler("buybik2",getRootElement(), function(id,cost,name) if (getPlayerMoney(client)>= tonumber(cost)) then local account = getPlayerAccount(client) local name = getAccountName(account) local playercar = executeSQLQuery("SELECT Model,Paintjob,Color,Upgrade0,Upgrade1,Upgrade2,Upgrade3,Upgrade4,Upgrade5,Upgrade6,Upgrade7,Upgrade8,Upgrade9,Upgrade10,Upgrade11,Upgrade12,Upgrade13,Upgrade14,Upgrade15,Upgrade16 FROM bikslot2 WHERE PlayerName = ?",name) if #playercar > 0 then outputChatBox("You cant buy this car since you already have one in this slot",client) else --[[local b2xml = xmlLoadFile("buyingb2.dat") if not b2xml then b2xml = xmlCreateFile("buyingb2.dat","wang") end local node = xmlCreateChild(b2xml,"buyb2") local msg = name.." tried to buy vehicle "..getVehicleNameFromModel(id) local success1 = xmlNodeSetValue(node,msg)]] local paintjob = 3 local color = "88,88,83,70,89,122" takePlayerMoney(client,tonumber(cost)) local addVehicle = executeSQLQuery("INSERT INTO bikslot2 (PlayerName,Model,Cost,Paintjob,Color,Upgrade0,Upgrade1,Upgrade2,Upgrade3,Upgrade4,Upgrade5,Upgrade6,Upgrade7,Upgrade8,Upgrade9,Upgrade10,Upgrade11,Upgrade12,Upgrade13,Upgrade14,Upgrade15,Upgrade16) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", tostring(name), tonumber(id), tonumber(cost), tonumber(paintjob), tostring(color), " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ") if addVehicle then --local msg2 = name.." succeeded in sale $"..cost --local node2 = xmlCreateChild(b2xml,"buyb2") --local success2 = xmlNodeSetValue(node2,msg2) outputChatBox("Vehicle bought successfully",client) else --local msg2 = name.." failed in sale $"..cost --local node2 = xmlCreateChild(b2xml,"buyb2") --local success2 = xmlNodeSetValue(node2,msg2) outputChatBox("Vehicle has not been bought",client) end --xmlSaveFile(b2xml) --xmlUnloadFile(b2xml) end else outputChatBox("You dont have enough money to buy this car",client) end end) addEvent("buyplane1",true) addEventHandler("buyplane1",getRootElement(), function(id,cost,name) if (getPlayerMoney(client)>= tonumber(cost)) then local account = getPlayerAccount(client) local name = getAccountName(account) local playercar = executeSQLQuery("SELECT Model,Paintjob,Color,Upgrade0,Upgrade1,Upgrade2,Upgrade3,Upgrade4,Upgrade5,Upgrade6,Upgrade7,Upgrade8,Upgrade9,Upgrade10,Upgrade11,Upgrade12,Upgrade13,Upgrade14,Upgrade15,Upgrade16 FROM planeslot1 WHERE PlayerName = ?",name) if #playercar > 0 then outputChatBox("You cant buy this car since you already have one in this slot",client) else --[[local p1xml = xmlLoadFile("buyingp1.dat") if not p1xml then p1xml = xmlCreateFile("buyingp1.dat","wang") end local node = xmlCreateChild(p1xml,"buyp1") local msg = name.." tried to buy vehicle "..getVehicleNameFromModel(id) local success1 = xmlNodeSetValue(node,msg)]] local paintjob = 3 local color = "88,88,83,70,89,122" takePlayerMoney(client,tonumber(cost)) local addVehicle = executeSQLQuery("INSERT INTO planeslot1 (PlayerName,Model,Cost,Paintjob,Color,Upgrade0,Upgrade1,Upgrade2,Upgrade3,Upgrade4,Upgrade5,Upgrade6,Upgrade7,Upgrade8,Upgrade9,Upgrade10,Upgrade11,Upgrade12,Upgrade13,Upgrade14,Upgrade15,Upgrade16) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", tostring(name), tonumber(id), tonumber(cost), tonumber(paintjob), tostring(color), " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ") if addVehicle then --local msg2 = name.." succeeded in sale $"..cost --local node2 = xmlCreateChild(p1xml,"buyp1") --local success2 = xmlNodeSetValue(node2,msg2) outputChatBox("Vehicle bought successfully",client) else --local msg2 = name.." failed in sale $"..cost --local node2 = xmlCreateChild(p1xml,"buyp1") --local success2 = xmlNodeSetValue(node2,msg2) outputChatBox("Vehicle has not been bought",client) end --xmlSaveFile(p1xml) --xmlUnloadFile(p1xml) end else outputChatBox("You dont have enough money to buy this car",client) end end) addEvent("buyplane2",true) addEventHandler("buyplane2",getRootElement(), function(id,cost,name) if (getPlayerMoney(client)>= tonumber(cost)) then local account = getPlayerAccount(client) local name = getAccountName(account) local playercar = executeSQLQuery("SELECT Model,Paintjob,Color,Upgrade0,Upgrade1,Upgrade2,Upgrade3,Upgrade4,Upgrade5,Upgrade6,Upgrade7,Upgrade8,Upgrade9,Upgrade10,Upgrade11,Upgrade12,Upgrade13,Upgrade14,Upgrade15,Upgrade16 FROM planeslot2 WHERE PlayerName = ?",name) if #playercar > 0 then outputChatBox("You cant buy this car since you already have one in this slot",client) else --[[local p2xml = xmlLoadFile("buyingp2.dat") if not p2xml then p2xml = xmlCreateFile("buyingp2.dat","wang") end local node = xmlCreateChild(p2xml,"buyp2") local msg = name.." tried to buy vehicle "..getVehicleNameFromModel(id) local success1 = xmlNodeSetValue(node,msg)]] local paintjob = 3 local color = "88,88,83,70,89,122" takePlayerMoney(client,tonumber(cost)) local addVehicle = executeSQLQuery("INSERT INTO planeslot2 (PlayerName,Model,Cost,Paintjob,Color,Upgrade0,Upgrade1,Upgrade2,Upgrade3,Upgrade4,Upgrade5,Upgrade6,Upgrade7,Upgrade8,Upgrade9,Upgrade10,Upgrade11,Upgrade12,Upgrade13,Upgrade14,Upgrade15,Upgrade16) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", tostring(name), tonumber(id), tonumber(cost), tonumber(paintjob), tostring(color), " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ") if addVehicle then --local msg2 = name.." succeeded in sale $"..cost --local node2 = xmlCreateChild(p2xml,"buyp2") --local success2 = xmlNodeSetValue(node2,msg2) outputChatBox("Vehicle bought successfully",client) else --local msg2 = name.." failed in sale $"..cost --local node2 = xmlCreateChild(p2xml,"buyp2") --local success2 = xmlNodeSetValue(node2,msg2) outputChatBox("Vehicle has not been bought",client) end --xmlSaveFile(p2xml) --xmlUnloadFile(p2xml) end else outputChatBox("You dont have enough money to buy this car",client) end end) addEvent("buyboat1",true) addEventHandler("buyboat1",getRootElement(), function(id,cost,name) if (getPlayerMoney(client)>= tonumber(cost)) then local account = getPlayerAccount(client) local name = getAccountName(account) local playercar = executeSQLQuery("SELECT Model,Paintjob,Color,Upgrade0,Upgrade1,Upgrade2,Upgrade3,Upgrade4,Upgrade5,Upgrade6,Upgrade7,Upgrade8,Upgrade9,Upgrade10,Upgrade11,Upgrade12,Upgrade13,Upgrade14,Upgrade15,Upgrade16 FROM boatslot1 WHERE PlayerName = ?",name) if #playercar > 0 then outputChatBox("You cant buy this car since you already have one in this slot",client) else --[[local bt1xml = xmlLoadFile("buyingbt1.dat") if not bt1xml then bt1xml = xmlCreateFile("buyingbt1.dat","wang") end local node = xmlCreateChild(bt1xml,"buybt1") local msg = name.." tried to buy vehicle "..getVehicleNameFromModel(id) local success1 = xmlNodeSetValue(node,msg)]] local paintjob = 3 local color = "88,88,83,70,89,122" takePlayerMoney(client,tonumber(cost)) local addVehicle = executeSQLQuery("INSERT INTO boatslot1 (PlayerName,Model,Cost,Paintjob,Color,Upgrade0,Upgrade1,Upgrade2,Upgrade3,Upgrade4,Upgrade5,Upgrade6,Upgrade7,Upgrade8,Upgrade9,Upgrade10,Upgrade11,Upgrade12,Upgrade13,Upgrade14,Upgrade15,Upgrade16) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", tostring(name), tonumber(id), tonumber(cost), tonumber(paintjob), tostring(color), " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ") if addVehicle then --local msg2 = name.." succeeded in sale $"..cost --local node2 = xmlCreateChild(bt1xml,"buybt1") --local success2 = xmlNodeSetValue(node2,msg2) outputChatBox("Vehicle bought successfully",client) else --local msg2 = name.." failed in sale $"..cost --local node2 = xmlCreateChild(bt1xml,"buybt1") --local success2 = xmlNodeSetValue(node2,msg2) outputChatBox("Vehicle has not been bought",client) end --xmlSaveFile(bt1xml) --xmlUnloadFile(bt1xml) end else outputChatBox("You dont have enough money to buy this car",client) end end) addEvent("buyboat2",true) addEventHandler("buyboat2",getRootElement(), function(id,cost,name) if (getPlayerMoney(client)>= tonumber(cost)) then local account = getPlayerAccount(client) local name = getAccountName(account) local playercar = executeSQLQuery("SELECT Model,Paintjob,Color,Upgrade0,Upgrade1,Upgrade2,Upgrade3,Upgrade4,Upgrade5,Upgrade6,Upgrade7,Upgrade8,Upgrade9,Upgrade10,Upgrade11,Upgrade12,Upgrade13,Upgrade14,Upgrade15,Upgrade16 FROM boatslot2 WHERE PlayerName = ?",name) if #playercar > 0 then outputChatBox("You cant buy this car since you already have one in this slot",client) else --local bt2xml = xmlLoadFile("buyingbt2.dat") --if not bt2xml then --bt2xml = xmlCreateFile("buyingbt2.dat","wang") --end --local node = xmlCreateChild(bt2xml,"buybt2") --local msg = name.." tried to buy vehicle "..getVehicleNameFromModel(id) --local success1 = xmlNodeSetValue(node,msg) local paintjob = 3 local color = "88,88,83,70,89,122" takePlayerMoney(client,tonumber(cost)) local addVehicle = executeSQLQuery("INSERT INTO boatslot2 (PlayerName,Model,Cost,Paintjob,Color,Upgrade0,Upgrade1,Upgrade2,Upgrade3,Upgrade4,Upgrade5,Upgrade6,Upgrade7,Upgrade8,Upgrade9,Upgrade10,Upgrade11,Upgrade12,Upgrade13,Upgrade14,Upgrade15,Upgrade16) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", tostring(name), tonumber(id), tonumber(cost), tonumber(paintjob), tostring(color), " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ") if addVehicle then --local msg2 = name.." succeeded in sale $"..cost --local node2 = xmlCreateChild(bt2xml,"buybt2") --local success2 = xmlNodeSetValue(node2,msg2) outputChatBox("Vehicle bought successfully",client) else --local msg2 = name.." failed in sale $"..cost --local node2 = xmlCreateChild(bt2xml,"buybt2") --local success2 = xmlNodeSetValue(node2,msg2) outputChatBox("Vehicle has not been bought",client) end --xmlSaveFile(bt2xml) --xmlUnloadFile(bt2xml) end else outputChatBox("You dont have enough money to buy this car",client) end end) addEvent("spawncar1",true) addEventHandler("spawncar1",getRootElement(), function() if not (isGuestAccount(getPlayerAccount(client))) then if not (isPedInVehicle(client)) then local x,y,z = getElementPosition(client) if (getElementData(client,"mycar1")) and (getElementData(client,"mycar1")~= nil) --[[and (getElementType(getElementData(client,"mycar1")) =="vehicle")]] then local vehicle = getElementData(client,"mycar1") destroyElement(vehicle) removeElementData(client,"mycar1") --local x,y,z = getElementPosition(vehicle) --setElementPosition(vehicle,x,y,z) outputChatBox("Vehicle destroyed",client) --[[ local vehicle = getElementData(client,"mybik1") destroyElement(vehicle) removeElementData(client,"mybik1") outputChatBox("Vehicle destroyed",client)]] elseif not (getElementData(client,"mycar1")) then local account = getPlayerAccount(client) local name = getAccountName(account) local playercar = executeSQLQuery("SELECT Model,Paintjob,Color,Upgrade0,Upgrade1,Upgrade2,Upgrade3,Upgrade4,Upgrade5,Upgrade6,Upgrade7,Upgrade8,Upgrade9,Upgrade10,Upgrade11,Upgrade12,Upgrade13,Upgrade14,Upgrade15,Upgrade16 FROM carslot1 WHERE PlayerName = ?",name) if (playercar) then if #playercar > 0 then local x,y,z = getElementPosition(client) local vehicle = createVehicle(playercar[1].Model,x + 5,y +2,z) setVehiclePaintjob(vehicle,playercar[1].Paintjob) setElementData(vehicle,"vehicleOwner","mycar1") setElementData (vehicle,"mycar1",getPlayerName(source)) setElementData (client, "mycar1", vehicle) setElementData(vehicle,"VOwner",getPlayerName(client)) outputChatBox ("Car spawned.", source, 255, 0, 0) addVehicleUpgrade(vehicle, playercar[1].Upgrade0) addVehicleUpgrade(vehicle, playercar[1].Upgrade1) addVehicleUpgrade(vehicle, playercar[1].Upgrade2) addVehicleUpgrade(vehicle, playercar[1].Upgrade3) addVehicleUpgrade(vehicle, playercar[1].Upgrade4) addVehicleUpgrade(vehicle, playercar[1].Upgrade5) addVehicleUpgrade(vehicle, playercar[1].Upgrade6) addVehicleUpgrade(vehicle, playercar[1].Upgrade7) addVehicleUpgrade(vehicle, playercar[1].Upgrade8) addVehicleUpgrade(vehicle, playercar[1].Upgrade9) addVehicleUpgrade(vehicle, playercar[1].Upgrade10) addVehicleUpgrade(vehicle, playercar[1].Upgrade11) addVehicleUpgrade(vehicle, playercar[1].Upgrade12) addVehicleUpgrade(vehicle, playercar[1].Upgrade13) addVehicleUpgrade(vehicle, playercar[1].Upgrade14) addVehicleUpgrade(vehicle, playercar[1].Upgrade15) addVehicleUpgrade(vehicle, playercar[1].Upgrade16) local col1 = gettok (playercar[1].Color, 1, string.byte(',') ) local col2 = gettok (playercar[1].Color, 2, string.byte(',') ) local col3 = gettok (playercar[1].Color, 3, string.byte(',') ) local col4 = gettok (playercar[1].Color, 4, string.byte(',') ) local col5 = gettok (playercar[1].Color, 5, string.byte(',') ) local col6 = gettok (playercar[1].Color, 6, string.byte(',') ) outputChatBox(col1) if col1 then setVehicleColor(vehicle, tonumber(col1), tonumber(col2), tonumber(col3), tonumber(col4), tonumber(col5), tonumber(col6)) end else outputChatBox("You have not buy a car for this slot yet",client) end end end else outputChatBox("You need to get out of your vehicle first",client) end else outputChatBox("You need to log in first",client) end end) addEvent("spawncar2",true) addEventHandler("spawncar2",getRootElement(), function() if not (isGuestAccount(getPlayerAccount(client))) then if not (isPedInVehicle(client)) then local x,y,z = getElementPosition(client) if (getElementData(client,"mycar2")) and (getElementData(client,"mycar2")~= nil) --[[and (getElementType(getElementData(client,"mycar2")) =="vehicle")]] then local vehicle = getElementData(client,"mycar2") destroyElement(vehicle) removeElementData(client,"mycar2") outputChatBox("Vehicle destroyed",client) elseif not (getElementData(client,"mycar2")) then local account = getPlayerAccount(client) local name = getAccountName(account) local playercar = executeSQLQuery("SELECT Model,Paintjob,Color,Upgrade0,Upgrade1,Upgrade2,Upgrade3,Upgrade4,Upgrade5,Upgrade6,Upgrade7,Upgrade8,Upgrade9,Upgrade10,Upgrade11,Upgrade12,Upgrade13,Upgrade14,Upgrade15,Upgrade16 FROM carslot2 WHERE PlayerName = ?",name) if (playercar) then if #playercar > 0 then local x,y,z = getElementPosition(client) local vehicle = createVehicle(playercar[1].Model,x + 5,y +2,z) setVehiclePaintjob(vehicle,playercar[1].Paintjob) setElementData(vehicle,"vehicleOwner","mycar2") setElementData (vehicle,"mycar2",getPlayerName(source)) setElementData (source, "mycar2", vehicle) setElementData(vehicle,"VOwner",getPlayerName(client)) outputChatBox ("Car spawned.", source, 255, 0, 0) addVehicleUpgrade(vehicle, playercar[1].Upgrade0) addVehicleUpgrade(vehicle, playercar[1].Upgrade1) addVehicleUpgrade(vehicle, playercar[1].Upgrade2) addVehicleUpgrade(vehicle, playercar[1].Upgrade3) addVehicleUpgrade(vehicle, playercar[1].Upgrade4) addVehicleUpgrade(vehicle, playercar[1].Upgrade5) addVehicleUpgrade(vehicle, playercar[1].Upgrade6) addVehicleUpgrade(vehicle, playercar[1].Upgrade7) addVehicleUpgrade(vehicle, playercar[1].Upgrade8) addVehicleUpgrade(vehicle, playercar[1].Upgrade9) addVehicleUpgrade(vehicle, playercar[1].Upgrade10) addVehicleUpgrade(vehicle, playercar[1].Upgrade11) addVehicleUpgrade(vehicle, playercar[1].Upgrade12) addVehicleUpgrade(vehicle, playercar[1].Upgrade13) addVehicleUpgrade(vehicle, playercar[1].Upgrade14) addVehicleUpgrade(vehicle, playercar[1].Upgrade15) addVehicleUpgrade(vehicle, playercar[1].Upgrade16) local col1 = gettok (playercar[1].Color, 1, string.byte(',') ) local col2 = gettok (playercar[1].Color, 2, string.byte(',') ) local col3 = gettok (playercar[1].Color, 3, string.byte(',') ) local col4 = gettok (playercar[1].Color, 4, string.byte(',') ) local col5 = gettok (playercar[1].Color, 5, string.byte(',') ) local col6 = gettok (playercar[1].Color, 6, string.byte(',') ) if col1 then setVehicleColor(vehicle, tonumber(col1), tonumber(col2), tonumber(col3), tonumber(col4), tonumber(col5), tonumber(col6)) end else outputChatBox("You have not buy a car for this slot yet",client) end end end else outputChatBox("You need to get out of your vehicle first",client) end else outputChatBox("You need to log in first",client) end end) addEvent("spawnbik1",true) addEventHandler("spawnbik1",getRootElement(), function() if not (isGuestAccount(getPlayerAccount(client))) then if not (isPedInVehicle(client)) then local x,y,z = getElementPosition(client) if (getElementData(client,"mybik1")) and (getElementData(client,"mybik1")~= nil) --[[and (getElementType(getElementData(client,"mybik1")) =="vehicle")]] then local vehicle = getElementData(client,"mybik1") destroyElement(vehicle) removeElementData(client,"mybik1") outputChatBox("Vehicle destroyed",client) elseif not (getElementData(client,"mybik1")) then local account = getPlayerAccount(client) local name = getAccountName(account) local playercar = executeSQLQuery("SELECT Model,Paintjob,Color,Upgrade0,Upgrade1,Upgrade2,Upgrade3,Upgrade4,Upgrade5,Upgrade6,Upgrade7,Upgrade8,Upgrade9,Upgrade10,Upgrade11,Upgrade12,Upgrade13,Upgrade14,Upgrade15,Upgrade16 FROM bikslot1 WHERE PlayerName = ?",name) if (playercar) then if #playercar > 0 then local x,y,z = getElementPosition(client) local vehicle = createVehicle(playercar[1].Model,x + 5,y +2,z) setVehiclePaintjob(vehicle,playercar[1].Paintjob) setElementData(vehicle,"vehicleOwner","mybik1") setElementData (vehicle,"mybik1",name) setElementData (source, "mybik1", vehicle) setElementData(vehicle,"VOwner",getPlayerName(client)) outputChatBox ("Car spawned.", source, 255, 0, 0) addVehicleUpgrade(vehicle, playercar[1].Upgrade0) addVehicleUpgrade(vehicle, playercar[1].Upgrade1) addVehicleUpgrade(vehicle, playercar[1].Upgrade2) addVehicleUpgrade(vehicle, playercar[1].Upgrade3) addVehicleUpgrade(vehicle, playercar[1].Upgrade4) addVehicleUpgrade(vehicle, playercar[1].Upgrade5) addVehicleUpgrade(vehicle, playercar[1].Upgrade6) addVehicleUpgrade(vehicle, playercar[1].Upgrade7) addVehicleUpgrade(vehicle, playercar[1].Upgrade8) addVehicleUpgrade(vehicle, playercar[1].Upgrade9) addVehicleUpgrade(vehicle, playercar[1].Upgrade10) addVehicleUpgrade(vehicle, playercar[1].Upgrade11) addVehicleUpgrade(vehicle, playercar[1].Upgrade12) addVehicleUpgrade(vehicle, playercar[1].Upgrade13) addVehicleUpgrade(vehicle, playercar[1].Upgrade14) addVehicleUpgrade(vehicle, playercar[1].Upgrade15) addVehicleUpgrade(vehicle, playercar[1].Upgrade16) local col1 = gettok (playercar[1].Color, 1, string.byte(',') ) local col2 = gettok (playercar[1].Color, 2, string.byte(',') ) local col3 = gettok (playercar[1].Color, 3, string.byte(',') ) local col4 = gettok (playercar[1].Color, 4, string.byte(',') ) local col5 = gettok (playercar[1].Color, 5, string.byte(',') ) local col6 = gettok (playercar[1].Color, 6, string.byte(',') ) if col1 then setVehicleColor(vehicle, tonumber(col1), tonumber(col2), tonumber(col3), tonumber(col4), tonumber(col5), tonumber(col6)) end else outputChatBox("You have not buy a car for this slot yet",client) end end end else outputChatBox("You need to get out of your vehicle first",client) end else outputChatBox("You need to log in first",client) end end) addEvent("spawnbik2",true) addEventHandler("spawnbik2",getRootElement(), function() if not (isGuestAccount(getPlayerAccount(client))) then if not (isPedInVehicle(client)) then local x,y,z = getElementPosition(client) if (getElementData(client,"mybik2")) and (getElementData(client,"mybik2")~= nil) --[[and (getElementType(getElementData(client,"mybik2")) =="vehicle")]] then local vehicle = getElementData(client,"mybik2") destroyElement(vehicle) removeElementData(client,"mybik2") outputChatBox("Vehicle destroyed",client) elseif not (getElementData(client,"mybik2")) then local account = getPlayerAccount(client) local name = getAccountName(account) local playercar = executeSQLQuery("SELECT Model,Paintjob,Color,Upgrade0,Upgrade1,Upgrade2,Upgrade3,Upgrade4,Upgrade5,Upgrade6,Upgrade7,Upgrade8,Upgrade9,Upgrade10,Upgrade11,Upgrade12,Upgrade13,Upgrade14,Upgrade15,Upgrade16 FROM bikslot2 WHERE PlayerName = ?",name) if (playercar) then if #playercar > 0 then local x,y,z = getElementPosition(client) local vehicle = createVehicle(playercar[1].Model,x + 5,y +2,z) setVehiclePaintjob(vehicle,playercar[1].Paintjob) setElementData(vehicle,"vehicleOwner","mybik2") setElementData (vehicle,"mybik2",name) setElementData (source, "mybik2", vehicle) setElementData(vehicle,"VOwner",getPlayerName(client)) outputChatBox ("Car spawned.", source, 255, 0, 0) addVehicleUpgrade(vehicle, playercar[1].Upgrade0) addVehicleUpgrade(vehicle, playercar[1].Upgrade1) addVehicleUpgrade(vehicle, playercar[1].Upgrade2) addVehicleUpgrade(vehicle, playercar[1].Upgrade3) addVehicleUpgrade(vehicle, playercar[1].Upgrade4) addVehicleUpgrade(vehicle, playercar[1].Upgrade5) addVehicleUpgrade(vehicle, playercar[1].Upgrade6) addVehicleUpgrade(vehicle, playercar[1].Upgrade7) addVehicleUpgrade(vehicle, playercar[1].Upgrade8) addVehicleUpgrade(vehicle, playercar[1].Upgrade9) addVehicleUpgrade(vehicle, playercar[1].Upgrade10) addVehicleUpgrade(vehicle, playercar[1].Upgrade11) addVehicleUpgrade(vehicle, playercar[1].Upgrade12) addVehicleUpgrade(vehicle, playercar[1].Upgrade13) addVehicleUpgrade(vehicle, playercar[1].Upgrade14) addVehicleUpgrade(vehicle, playercar[1].Upgrade15) addVehicleUpgrade(vehicle, playercar[1].Upgrade16) local col1 = gettok (playercar[1].Color, 1, string.byte(',') ) local col2 = gettok (playercar[1].Color, 2, string.byte(',') ) local col3 = gettok (playercar[1].Color, 3, string.byte(',') ) local col4 = gettok (playercar[1].Color, 4, string.byte(',') ) local col5 = gettok (playercar[1].Color, 5, string.byte(',') ) local col6 = gettok (playercar[1].Color, 6, string.byte(',') ) if col1 then setVehicleColor(vehicle, tonumber(col1), tonumber(col2), tonumber(col3), tonumber(col4), tonumber(col5), tonumber(col6)) end else outputChatBox("You have not buy a car for this slot yet",client) end end end else outputChatBox("You need to get out of your vehicle first",client) end else outputChatBox("You need to log in first",client) end end) addEvent("spawnplane1",true) addEventHandler("spawnplane1",getRootElement(), function() if not (isGuestAccount(getPlayerAccount(client))) then if not (isPedInVehicle(client)) then local x,y,z = getElementPosition(client) if (getElementData(client,"myplane1")) and (getElementData(client,"myplane1")~= nil) --[[and (getElementType(getElementData(client,"myplane1")) =="vehicle")]] then local vehicle = getElementData(client,"myplane1") destroyElement(vehicle) removeElementData(client,"myplane1") outputChatBox("Vehicle destroyed",client) elseif not (getElementData(client,"myplane1")) then local account = getPlayerAccount(client) local name = getAccountName(account) local playercar = executeSQLQuery("SELECT Model,Paintjob,Color,Upgrade0,Upgrade1,Upgrade2,Upgrade3,Upgrade4,Upgrade5,Upgrade6,Upgrade7,Upgrade8,Upgrade9,Upgrade10,Upgrade11,Upgrade12,Upgrade13,Upgrade14,Upgrade15,Upgrade16 FROM planeslot1 WHERE PlayerName = ?",name) if (playercar) then if #playercar > 0 then local x,y,z = getElementPosition(client) local vehicle = createVehicle(playercar[1].Model,x + 5,y +2,z) setVehiclePaintjob(vehicle,playercar[1].Paintjob) setElementData(vehicle,"vehicleOwner","myplane1") setElementData (vehicle,"myplane1",name) setElementData (source, "myplane1", vehicle) setElementData(vehicle,"VOwner",getPlayerName(client)) outputChatBox ("Car spawned.", source, 255, 0, 0) addVehicleUpgrade(vehicle, playercar[1].Upgrade0) addVehicleUpgrade(vehicle, playercar[1].Upgrade1) addVehicleUpgrade(vehicle, playercar[1].Upgrade2) addVehicleUpgrade(vehicle, playercar[1].Upgrade3) addVehicleUpgrade(vehicle, playercar[1].Upgrade4) addVehicleUpgrade(vehicle, playercar[1].Upgrade5) addVehicleUpgrade(vehicle, playercar[1].Upgrade6) addVehicleUpgrade(vehicle, playercar[1].Upgrade7) addVehicleUpgrade(vehicle, playercar[1].Upgrade8) addVehicleUpgrade(vehicle, playercar[1].Upgrade9) addVehicleUpgrade(vehicle, playercar[1].Upgrade10) addVehicleUpgrade(vehicle, playercar[1].Upgrade11) addVehicleUpgrade(vehicle, playercar[1].Upgrade12) addVehicleUpgrade(vehicle, playercar[1].Upgrade13) addVehicleUpgrade(vehicle, playercar[1].Upgrade14) addVehicleUpgrade(vehicle, playercar[1].Upgrade15) addVehicleUpgrade(vehicle, playercar[1].Upgrade16) local col1 = gettok (playercar[1].Color, 1, string.byte(',') ) local col2 = gettok (playercar[1].Color, 2, string.byte(',') ) local col3 = gettok (playercar[1].Color, 3, string.byte(',') ) local col4 = gettok (playercar[1].Color, 4, string.byte(',') ) local col5 = gettok (playercar[1].Color, 5, string.byte(',') ) local col6 = gettok (playercar[1].Color, 6, string.byte(',') ) if col1 then setVehicleColor(vehicle, tonumber(col1), tonumber(col2), tonumber(col3), tonumber(col4), tonumber(col5), tonumber(col6)) end else outputChatBox("You have not buy a car for this slot yet",client) end end end else outputChatBox("You need to get out of your vehicle first",client) end else outputChatBox("You need to log in first",client) end end) addEvent("spawnplane2",true) addEventHandler("spawnplane2",getRootElement(), function() if not (isGuestAccount(getPlayerAccount(client))) then if not (isPedInVehicle(client)) then local x,y,z = getElementPosition(client) if (getElementData(client,"myplane2")) and (getElementData(client,"myplane2")~= nil) --[[and (getElementType(getElementData(client,"myplane2")) =="vehicle")]] then local vehicle = getElementData(client,"myplane2") destroyElement(vehicle) removeElementData(client,"myplane2") outputChatBox("Vehicle destroyed",client) elseif not (getElementData(client,"myplane2")) then local account = getPlayerAccount(client) local name = getAccountName(account) local playercar = executeSQLQuery("SELECT Model,Paintjob,Color,Upgrade0,Upgrade1,Upgrade2,Upgrade3,Upgrade4,Upgrade5,Upgrade6,Upgrade7,Upgrade8,Upgrade9,Upgrade10,Upgrade11,Upgrade12,Upgrade13,Upgrade14,Upgrade15,Upgrade16 FROM planeslot2 WHERE PlayerName = ?",name) if (playercar) then if #playercar > 0 then local x,y,z = getElementPosition(client) local vehicle = createVehicle(playercar[1].Model,x + 5,y +2,z) setVehiclePaintjob(vehicle,playercar[1].Paintjob) setElementData(vehicle,"vehicleOwner","myplane2") setElementData (vehicle,"myplane2",name) setElementData (source, "myplane2", vehicle) setElementData(vehicle,"VOwner",getPlayerName(client)) outputChatBox ("Car spawned.", source, 255, 0, 0) addVehicleUpgrade(vehicle, playercar[1].Upgrade0) addVehicleUpgrade(vehicle, playercar[1].Upgrade1) addVehicleUpgrade(vehicle, playercar[1].Upgrade2) addVehicleUpgrade(vehicle, playercar[1].Upgrade3) addVehicleUpgrade(vehicle, playercar[1].Upgrade4) addVehicleUpgrade(vehicle, playercar[1].Upgrade5) addVehicleUpgrade(vehicle, playercar[1].Upgrade6) addVehicleUpgrade(vehicle, playercar[1].Upgrade7) addVehicleUpgrade(vehicle, playercar[1].Upgrade8) addVehicleUpgrade(vehicle, playercar[1].Upgrade9) addVehicleUpgrade(vehicle, playercar[1].Upgrade10) addVehicleUpgrade(vehicle, playercar[1].Upgrade11) addVehicleUpgrade(vehicle, playercar[1].Upgrade12) addVehicleUpgrade(vehicle, playercar[1].Upgrade13) addVehicleUpgrade(vehicle, playercar[1].Upgrade14) addVehicleUpgrade(vehicle, playercar[1].Upgrade15) addVehicleUpgrade(vehicle, playercar[1].Upgrade16) local col1 = gettok (playercar[1].Color, 1, string.byte(',') ) local col2 = gettok (playercar[1].Color, 2, string.byte(',') ) local col3 = gettok (playercar[1].Color, 3, string.byte(',') ) local col4 = gettok (playercar[1].Color, 4, string.byte(',') ) local col5 = gettok (playercar[1].Color, 5, string.byte(',') ) local col6 = gettok (playercar[1].Color, 6, string.byte(',') ) if col1 then setVehicleColor(vehicle, tonumber(col1), tonumber(col2), tonumber(col3), tonumber(col4), tonumber(col5), tonumber(col6)) end else outputChatBox("You have not buy a car for this slot yet",client) end end end else outputChatBox("You need to get out of your vehicle first",client) end else outputChatBox("You need to log in first",client) end end) addEvent("spawnboat1",true) addEventHandler("spawnboat1",getRootElement(), function() if not (isGuestAccount(getPlayerAccount(client))) then if not (isPedInVehicle(client)) then local x,y,z = getElementPosition(client) if (getElementData(client,"myboat1")) and (getElementData(client,"myboat1")~= nil) --[[and (getElementType(getElementData(client,"myboat1")) =="vehicle")]] then local vehicle = getElementData(client,"myboat1") destroyElement(vehicle) removeElementData(client,"myboat1") outputChatBox("Vehicle destroyed",client) elseif not (getElementData(client,"myboat1")) then local account = getPlayerAccount(client) local name = getAccountName(account) local playercar = executeSQLQuery("SELECT Model,Paintjob,Color,Upgrade0,Upgrade1,Upgrade2,Upgrade3,Upgrade4,Upgrade5,Upgrade6,Upgrade7,Upgrade8,Upgrade9,Upgrade10,Upgrade11,Upgrade12,Upgrade13,Upgrade14,Upgrade15,Upgrade16 FROM boatslot1 WHERE PlayerName = ?",name) if (playercar) then if #playercar > 0 then local x,y,z = getElementPosition(client) local vehicle = createVehicle(playercar[1].Model,x + 5,y +2,z) setVehiclePaintjob(vehicle,playercar[1].Paintjob) setElementData(vehicle,"vehicleOwner","myboat1") setElementData (vehicle,"myboat1",name) setElementData (source, "myboat1", vehicle) setElementData(vehicle,"VOwner",getPlayerName(client)) outputChatBox ("Car spawned.", source, 255, 0, 0) addVehicleUpgrade(vehicle, playercar[1].Upgrade0) addVehicleUpgrade(vehicle, playercar[1].Upgrade1) addVehicleUpgrade(vehicle, playercar[1].Upgrade2) addVehicleUpgrade(vehicle, playercar[1].Upgrade3) addVehicleUpgrade(vehicle, playercar[1].Upgrade4) addVehicleUpgrade(vehicle, playercar[1].Upgrade5) addVehicleUpgrade(vehicle, playercar[1].Upgrade6) addVehicleUpgrade(vehicle, playercar[1].Upgrade7) addVehicleUpgrade(vehicle, playercar[1].Upgrade8) addVehicleUpgrade(vehicle, playercar[1].Upgrade9) addVehicleUpgrade(vehicle, playercar[1].Upgrade10) addVehicleUpgrade(vehicle, playercar[1].Upgrade11) addVehicleUpgrade(vehicle, playercar[1].Upgrade12) addVehicleUpgrade(vehicle, playercar[1].Upgrade13) addVehicleUpgrade(vehicle, playercar[1].Upgrade14) addVehicleUpgrade(vehicle, playercar[1].Upgrade15) addVehicleUpgrade(vehicle, playercar[1].Upgrade16) local col1 = gettok (playercar[1].Color, 1, string.byte(',') ) local col2 = gettok (playercar[1].Color, 2, string.byte(',') ) local col3 = gettok (playercar[1].Color, 3, string.byte(',') ) local col4 = gettok (playercar[1].Color, 4, string.byte(',') ) local col5 = gettok (playercar[1].Color, 5, string.byte(',') ) local col6 = gettok (playercar[1].Color, 6, string.byte(',') ) if col1 then setVehicleColor(vehicle, tonumber(col1), tonumber(col2), tonumber(col3), tonumber(col4), tonumber(col5), tonumber(col6)) end else outputChatBox("You have not buy a car for this slot yet",client) end end end else outputChatBox("You need to get out of your vehicle first",client) end else outputChatBox("You need to log in first",client) end end) addEvent("spawnboat2",true) addEventHandler("spawnboat2",getRootElement(), function() if not (isGuestAccount(getPlayerAccount(client))) then if not (isPedInVehicle(client)) then local x,y,z = getElementPosition(client) if (getElementData(client,"myboat2")) and (getElementData(client,"myboat2")~= nil) --[[and (getElementType(getElementData(client,"myboat2")) =="vehicle")]] then local vehicle = getElementData(client,"myboat2") destroyElement(vehicle) removeElementData(client,"myboat2") outputChatBox("Vehicle destroyed",client) elseif not (getElementData(client,"myboat2")) then local account = getPlayerAccount(client) local name = getAccountName(account) local playercar = executeSQLQuery("SELECT Model,Paintjob,Color,Upgrade0,Upgrade1,Upgrade2,Upgrade3,Upgrade4,Upgrade5,Upgrade6,Upgrade7,Upgrade8,Upgrade9,Upgrade10,Upgrade11,Upgrade12,Upgrade13,Upgrade14,Upgrade15,Upgrade16 FROM boatslot2 WHERE PlayerName = ?",name) if (playercar) then if #playercar > 0 then local x,y,z = getElementPosition(client) local vehicle = createVehicle(playercar[1].Model,x + 5,y +2,z) setVehiclePaintjob(vehicle,playercar[1].Paintjob) setElementData(vehicle,"vehicleOwner","myboat2") setElementData (vehicle,"myboat2",name) setElementData (source, "myboat2", vehicle) setElementData(vehicle,"VOwner",getPlayerName(client)) outputChatBox ("Car spawned.", source, 255, 0, 0) addVehicleUpgrade(vehicle, playercar[1].Upgrade0) addVehicleUpgrade(vehicle, playercar[1].Upgrade1) addVehicleUpgrade(vehicle, playercar[1].Upgrade2) addVehicleUpgrade(vehicle, playercar[1].Upgrade3) addVehicleUpgrade(vehicle, playercar[1].Upgrade4) addVehicleUpgrade(vehicle, playercar[1].Upgrade5) addVehicleUpgrade(vehicle, playercar[1].Upgrade6) addVehicleUpgrade(vehicle, playercar[1].Upgrade7) addVehicleUpgrade(vehicle, playercar[1].Upgrade8) addVehicleUpgrade(vehicle, playercar[1].Upgrade9) addVehicleUpgrade(vehicle, playercar[1].Upgrade10) addVehicleUpgrade(vehicle, playercar[1].Upgrade11) addVehicleUpgrade(vehicle, playercar[1].Upgrade12) addVehicleUpgrade(vehicle, playercar[1].Upgrade13) addVehicleUpgrade(vehicle, playercar[1].Upgrade14) addVehicleUpgrade(vehicle, playercar[1].Upgrade15) addVehicleUpgrade(vehicle, playercar[1].Upgrade16) local col1 = gettok (playercar[1].Color, 1, string.byte(',') ) local col2 = gettok (playercar[1].Color, 2, string.byte(',') ) local col3 = gettok (playercar[1].Color, 3, string.byte(',') ) local col4 = gettok (playercar[1].Color, 4, string.byte(',') ) local col5 = gettok (playercar[1].Color, 5, string.byte(',') ) local col6 = gettok (playercar[1].Color, 6, string.byte(',') ) if col1 then setVehicleColor(vehicle, tonumber(col1), tonumber(col2), tonumber(col3), tonumber(col4), tonumber(col5), tonumber(col6)) end else outputChatBox("You have not buy a car for this slot yet",client) end end end else outputChatBox("You need to get out of your vehicle first",client) end else outputChatBox("You need to log in first",client) end end) addEvent("spawnpersonal",true) addEventHandler("spawnpersonal",getRootElement(), function() if not (isGuestAccount(getPlayerAccount(client))) then if not (isPedInVehicle(client)) then local x,y,z = getElementPosition(client) if (getElementData(client,"mypersonal")) and (getElementData(client,"mypersonal")~= nil) --[[and (getElementType(getElementData(client,"myboat2")) =="vehicle")]] then local vehicle = getElementData(client,"mypersonal") destroyElement(vehicle) removeElementData(client,"mypersonal") outputChatBox("Vehicle destroyed",client) elseif not (getElementData(client,"mypersonal")) then local x,y,z = getElementPosition(client) local car = createVehicle(436,x+1,y+1,z) setElementData(car,"vehicleOwner","mypersonal") setElementData(client,"mypersonal",car) local account = getPlayerAccount(client) local name = getAccountName(account) setElementData(car,"VOwner",name) end else outputChatBox("You need to get out of your vehicle first",client) end else outputChatBox("You need to log in first",client) end end) addEventHandler("onPlayerQuit",getRootElement(), function() if (getElementData(source,"mycar1")) then destroyElement(getElementData(source,"mycar1")) outputConsole("ok") end if (getElementData(source,"mycar2")) then destroyElement(getElementData(source,"mycar2")) outputConsole("ok") end if (getElementData(source,"mybik1")) then destroyElement(getElementData(source,"mybik1")) outputConsole("ok") end if (getElementData(source,"mybik2")) then destroyElement(getElementData(source,"mybik2")) outputConsole("ok") end if (getElementData(source,"myplane1")) then destroyElement(getElementData(source,"myplane1")) end if (getElementData(source,"myplane2")) then destroyElement(getElementData(source,"myplane2")) end if (getElementData(source,"myboat1")) then destroyElement(getElementData(source,"myboat1")) end if (getElementData(source,"myboat2")) then destroyElement(getElementData(source,"myboat2")) end if (getElementData(source,"mypersonal")) then destroyElement(getElementData(source,"mypersonal")) outputConsole("ok") end end) local ottomarker = createMarker(-1669.870117,1208.0236,5.25,"cylinder",2.5,0,200,0,200) createBlipAttachedTo(ottomarker,12) addEventHandler("onMarkerHit",ottomarker, function(hitElement) if (isElement(hitElement) and getElementType(hitElement) == "player" and not isPedInVehicle(hitElement)) then triggerClientEvent(hitElement,"showSellingGui",hitElement) end end) addEvent("sellcar1",true) addEventHandler("sellcar1",getRootElement(), function() local account = getPlayerAccount(client) local name = getAccountName(account) local playercar1 = executeSQLQuery("SELECT Model,Paintjob,Cost FROM carslot1 WHERE PlayerName=?",name) if playercar1 then if #playercar1 > 0 then local cost = tonumber(playercar1[1].Cost) --outputChatBox(cost) cost = cost/2 --[[outputChatBox(cost) local c1xml = xmlLoadFile("sellingcar1.dat") if not c1xml then c1xml = xmlCreateFile("sellingcar1.dat","otto") end local node = xmlCreateChild(c1xml,"sellcar1") local msg = name.." tried to sell his car "..getVehicleNameFromModel(playercar1[1].Model) local success1 = xmlNodeSetValue(node,msg)]] executeSQLQuery("DELETE FROM carslot1 WHERE PlayerName=?",name) local money = givePlayerMoney(client,cost) --[[if money then local msg2 = name.." succeeded in sale $"..cost local node2 = xmlCreateChild(c1xml,"sellcar1") local success2 = xmlNodeSetValue(node2,msg2) else local msg2 = name.." succeeded in sale but no money given $"..cost local node2 = xmlCreateChild(c1xml,"sellcar1") local success2 = xmlNodeSetValue(node2,msg2) end xmlSaveFile(c1xml) xmlUnloadFile(c1xml)]] else outputChatBox("Sorry,you dont have any car in this slot!",client) end else outputChatBox("error in playercar1") end end) addEvent("sellcar2",true) addEventHandler("sellcar2",getRootElement(), function() local account = getPlayerAccount(client) local name = getAccountName(account) local playercar2 = executeSQLQuery("SELECT Model,Paintjob,Cost FROM carslot2 WHERE PlayerName=?",name) if playercar2 then if #playercar2 > 0 then local cost = tonumber(playercar2[1].Cost) --outputChatBox(cost) cost = cost/2 --[[outputChatBox(cost) local c2xml = xmlLoadFile("sellingcar2.dat") if not c2xml then c2xml = xmlCreateFile("sellingcar2.dat","otto") end local node = xmlCreateChild(c2xml,"sellcar2") local msg = name.." tried to sell his car "..getVehicleNameFromModel(playercar2[1].Model) local success1 = xmlNodeSetValue(node,msg)]] executeSQLQuery("DELETE FROM carslot2 WHERE PlayerName=?",name) local money = givePlayerMoney(client,cost) --[[if money then local msg2 = name.." succeeded in sale $"..cost local node2 = xmlCreateChild(c2xml,"sellcar2") local success2 = xmlNodeSetValue(node2,msg2) else local msg2 = name.." succeeded in sale but no money given $"..cost local node2 = xmlCreateChild(c2xml,"sellcar2") local success2 = xmlNodeSetValue(node2,msg2) end xmlSaveFile(c2xml) xmlUnloadFile(c2xml)]] else outputChatBox("Sorry,you dont have any car in this slot!",client) end else outputChatBox("error in playercar2") end end) addEvent("sellbik1",true) addEventHandler("sellbik1",getRootElement(), function() local account = getPlayerAccount(client) local name = getAccountName(account) local playerbik1 = executeSQLQuery("SELECT Model,Paintjob,Cost FROM bikslot1 WHERE PlayerName=?",name) if playerbik1 then if #playerbik1 > 0 then local cost = tonumber(playerbik1[1].Cost) --outputChatBox(cost) cost = cost/2 --[[outputChatBox(cost) local b1xml = xmlLoadFile("sellingbik1.dat") if not b1xml then b1xml = xmlCreateFile("sellingbik1.dat","otto") end local node = xmlCreateChild(b1xml,"sellbik1") local msg = name.." tried to sell his car "..getVehicleNameFromModel(playerbik1[1].Model) local success1 = xmlNodeSetValue(node,msg)]] executeSQLQuery("DELETE FROM bikslot1 WHERE PlayerName=?",name) --[[local money = givePlayerMoney(client,cost) if money then local msg2 = name.." succeeded in sale $"..cost local node2 = xmlCreateChild(b1xml,"sellbik1") local success2 = xmlNodeSetValue(node2,msg2) else local msg2 = name.." succeeded in sale but no money given $"..cost local node2 = xmlCreateChild(b1xml,"sellbik1") local success2 = xmlNodeSetValue(node2,msg2) end xmlSaveFile(b1xml) xmlUnloadFile(b1xml)]] else outputChatBox("Sorry,you dont have any car in this slot!",client) end else outputChatBox("error in playerbik1") end end) addEvent("sellbik2",true) addEventHandler("sellbik2",getRootElement(), function() local account = getPlayerAccount(client) local name = getAccountName(account) local playerbik2 = executeSQLQuery("SELECT Model,Paintjob,Cost FROM bikslot2 WHERE PlayerName=?",name) if playerbik2 then if #playerbik2 > 0 then local cost = tonumber(playerbik2[1].Cost) --outputChatBox(cost) cost = cost/2 --[[outputChatBox(cost) local b2xml = xmlLoadFile("sellingbik2.dat") if not b2xml then b2xml = xmlCreateFile("sellingbik2.dat","otto") end local node = xmlCreateChild(b2xml,"sellbik2") local msg = name.." tried to sell his car "..getVehicleNameFromModel(playerbik2[1].Model) local success1 = xmlNodeSetValue(node,msg)]] executeSQLQuery("DELETE FROM bikslot2 WHERE PlayerName=?",name) local money = givePlayerMoney(client,cost) --[[if money then local msg2 = name.." succeeded in sale $"..cost local node2 = xmlCreateChild(b2xml,"sellbik2") local success2 = xmlNodeSetValue(node2,msg2) else local msg2 = name.." succeeded in sale but no money given $"..cost local node2 = xmlCreateChild(b2xml,"sellbik2") local success2 = xmlNodeSetValue(node2,msg2) end xmlSaveFile(b2xml) xmlUnloadFile(b2xml)]] else outputChatBox("Sorry,you dont have any car in this slot!",client) end else outputChatBox("error in playerbik2") end end) addEvent("sellplane1",true) addEventHandler("sellplane1",getRootElement(), function() local account = getPlayerAccount(client) local name = getAccountName(account) local playerplane1 = executeSQLQuery("SELECT Model,Paintjob,Cost FROM planeslot1 WHERE PlayerName=?",name) if playerplane1 then if #playerplane1 > 0 then local cost = tonumber(playerplane1[1].Cost) --outputChatBox(cost) cost = cost/2 --[[outputChatBox(cost) local p1xml = xmlLoadFile("sellingplane1.dat") if not p1xml then p1xml = xmlCreateFile("sellingplane1.dat","otto") end local node = xmlCreateChild(p1xml,"sellplane1") local msg = name.." tried to sell his car "..getVehicleNameFromModel(playerplane1[1].Model) local success1 = xmlNodeSetValue(node,msg)]] executeSQLQuery("DELETE FROM planeslot1 WHERE PlayerName=?",name) local money = givePlayerMoney(client,cost) --[[if money then local msg2 = name.." succeeded in sale $"..cost local node2 = xmlCreateChild(p1xml,"sellplane1") local success2 = xmlNodeSetValue(node2,msg2) else local msg2 = name.." succeeded in sale but no money given $"..cost local node2 = xmlCreateChild(p1xml,"sellplane1") local success2 = xmlNodeSetValue(node2,msg2) end xmlSaveFile(p1xml) xmlUnloadFile(p1xml)]] else outputChatBox("Sorry,you dont have any car in this slot!",client) end else outputChatBox("error in playerplane1") end end) addEvent("sellplane2",true) addEventHandler("sellplane2",getRootElement(), function() local account = getPlayerAccount(client) local name = getAccountName(account) local playerplane2 = executeSQLQuery("SELECT Model,Paintjob,Cost FROM planeslot2 WHERE PlayerName=?",name) if playerplane2 then if #playerplane2 > 0 then local cost = tonumber(playerplane2[1].Cost) --outputChatBox(cost) cost = cost/2 --[[outputChatBox(cost) local p2xml = xmlLoadFile("sellingplane2.dat") if not p2xml then p2xml = xmlCreateFile("sellingplane2.dat","otto") end local node = xmlCreateChild(p2xml,"sellplane2") local msg = name.." tried to sell his car "..getVehicleNameFromModel(playerplane2[1].Model) local success1 = xmlNodeSetValue(node,msg)]] executeSQLQuery("DELETE FROM planeslot2 WHERE PlayerName=?",name) local money = givePlayerMoney(client,cost) --[[if money then local msg2 = name.." succeeded in sale $"..cost local node2 = xmlCreateChild(p2xml,"sellplane2") local success2 = xmlNodeSetValue(node2,msg2) else local msg2 = name.." succeeded in sale but no money given $"..cost local node2 = xmlCreateChild(p2xml,"sellplane2") local success2 = xmlNodeSetValue(node2,msg2) end xmlSaveFile(p2xml) xmlUnloadFile(p2xml)]] else outputChatBox("Sorry,you dont have any car in this slot!",client) end else outputChatBox("error in playerplane2") end end) addEvent("sellboat1",true) addEventHandler("sellboat1",getRootElement(), function() local account = getPlayerAccount(client) local name = getAccountName(account) local playerboat1 = executeSQLQuery("SELECT Model,Paintjob,Cost FROM boatslot1 WHERE PlayerName=?",name) if playerboat1 then if #playerboat1 > 0 then local cost = tonumber(playerboat1[1].Cost) --outputChatBox(cost) cost = cost/2 --[[outputChatBox(cost) local b1xml = xmlLoadFile("sellingboat1.dat") if not b1xml then b1xml = xmlCreateFile("sellingboat1.dat","otto") end local node = xmlCreateChild(b1xml,"sellboat1") local msg = name.." tried to sell his car "..getVehicleNameFromModel(playerboat1[1].Model) local success1 = xmlNodeSetValue(node,msg)]] executeSQLQuery("DELETE FROM boatslot1 WHERE PlayerName=?",name) local money = givePlayerMoney(client,cost) --[[if money then local msg2 = name.." succeeded in sale $"..cost local node2 = xmlCreateChild(b1xml,"sellboat1") local success2 = xmlNodeSetValue(node2,msg2) else local msg2 = name.." succeeded in sale but no money given $"..cost local node2 = xmlCreateChild(b1xml,"sellboat1") local success2 = xmlNodeSetValue(node2,msg2) end ]] -- xmlSaveFile(b1xml) --xmlUnloadFile(b1xml) else outputChatBox("Sorry,you dont have any car in this slot!",client) end else outputChatBox("error in playerboat1") end end) addEvent("sellboat2",true) addEventHandler("sellboat2",getRootElement(), function() local account = getPlayerAccount(client) local name = getAccountName(account) local playerboat2 = executeSQLQuery("SELECT Model,Paintjob,Cost FROM boatslot2 WHERE PlayerName=?",name) if playerboat2 then if #playerboat2 > 0 then local cost = tonumber(playerboat2[1].Cost) --outputChatBox(cost) cost = cost/2 --outputChatBox(cost) --local b2xml = xmlLoadFile("sellingboat2.dat") --if not b2xml then -- b2xml = xmlCreateFile("sellingboat2.dat","otto") -- end --local node = xmlCreateChild(b2xml,"sellboat2") --local msg = name.." tried to sell his car "..getVehicleNameFromModel(playerboat2[1].Model) --local success1 = xmlNodeSetValue(node,msg) executeSQLQuery("DELETE FROM boatslot2 WHERE PlayerName=?",name) local money = givePlayerMoney(client,cost) --[[if money then local msg2 = name.." succeeded in sale $"..cost local node2 = xmlCreateChild(b2xml,"sellboat2") local success2 = xmlNodeSetValue(node2,msg2) else local msg2 = name.." succeeded in sale but no money given $"..cost local node2 = xmlCreateChild(b2xml,"sellboat2") local success2 = xmlNodeSetValue(node2,msg2) end ]] --xmlSaveFile(b2xml) --xmlUnloadFile(b2xml) else outputChatBox("Sorry,you dont have any car in this slot!",client) end else outputChatBox("error in playerboat2") end end) addEvent("fixVehicle",true) addEventHandler("fixVehicle",getRootElement(), function() if isPedInVehicle(client) == true then local money = getPlayerMoney(client) if money >= 200 then takePlayerMoney(client,200) local car = getPedOccupiedVehicle(client) fixVehicle(car) local rx,ry,rz = getElementRotation(car) if (rx>90 and rx <270) or (ry>90 and ry<270) then setElementRotation(car,0,0,rz) end outputChatBox("You're vehicle has been fixed and $200 was taken for the service",client,3,249,61) else outputChatBox("Sorry Sir,but you dont have enough money for this service",client,3,249,61) end else outputChatBox("Sorry, but you can only use this service when you are in a vehicle",client,3,249,61) end end) addEvent("rotateVehicle",true) addEventHandler("rotateVehicle",getRootElement(), function() if (isPedInVehicle(client) == true) then local car = getPedOccupiedVehicle(client) if (getVehicleOccupant(car,0) == client) then local rx,ry,rz = getElementRotation(car) if (rx>90 and rx <270) or (ry>90 and ry<270) then setElementRotation(car,0,0,rz) else setElementRotation(car,180,0,rz) end else outputChatBox("Sorry,but you need to be the driver to be able to use this service",client,3,249,61) end else outputChatBox("Sorry,but you can only use this service when you are in a vehicle",client,3,249,61) end end) addEvent("lockVehicle",true) addEventHandler("lockVehicle",getRootElement(), function() if (isPedInVehicle(client) == true) then local car = getPedOccupiedVehicle(client) if (getElementData(car,"VOwner") == getPlayerName(client)) then if (isVehicleLocked(car) == true) then setVehicleLocked(car,false) outputChatBox("Vehicle unlocked, Sir",client,3,249,61) else setVehicleLocked(car,true) outputChatBox("Vehicle locked, Sir",client,3,249,61) end else outputChatBox("Sorry, but you cant use this service as you are not the owner of this vehicle",client,3,249,61) end else outputChatBox("Sorry,but you need to be in a vehicle to use this service",client,3,249,61) end end) addEvent("lightVehicle",true) addEventHandler("lightVehicle",getRootElement(), function() if (isPedInVehicle(client) == true) then local car = getPedOccupiedVehicle(client) if ( getVehicleOverrideLights ( car ) ~= 2 ) then -- if the current state isnt 'force on' setVehicleOverrideLights ( car, 2 ) -- force the lights on outputChatBox("Lights on",client,3,249,61) else setVehicleOverrideLights ( car, 1 ) -- otherwise, force the lights off outputChatBox("Lights off",client,3,249,61) end else outputChatBox("You need to be in a vehicle to use this service",client,3,249,61) end end) addEvent("engineVehicle",true) addEventHandler("engineVehicle",getRootElement(), function() if (isPedInVehicle(client) == true) then local car = getPedOccupiedVehicle(client) if (getVehicleOccupant(car,0) == client) then if getVehicleEngineState(car) == true then setVehicleEngineState(car,false) outputChatBox("Engine off",client,3,249,61) else setVehicleEngineState(car,true) outputChatBox("Engine on",client,3,249,61) end else outputChatBox("Sorry,but you need to be the driver to use this service",client,3,249,61) end else outputChatBox("Sorry,but you need to be in a vehicle to use this service",client,3,249,61) end end) addEvent("invisibleVehicle",true) addEventHandler("invisibleVehicle",getRootElement(), function() if (isPedInVehicle(client) == true) then local car = getPedOccupiedVehicle(client) if (getVehicleOccupant(car,0) == client) then if (getElementAlpha(car) == 250) then setElementAlpha(car,0) outputChatBox("Vehicle invisibility on",client,3,249,61) else setElementAlpha(car,250) outputChatBox("Vehicle invisibility off",client,3,249,61) end else outputChatBox("Sorry, but you need to be the driver to use this service",client,3,249,61) end else outputChatBox("Sorry, but you need to be in a vehicle to be able to use this service",client,3,249,61) end end) addEventHandler("onVehicleStartEnter",getRootElement(), function(player,seat,player2,door) if (isVehicleLocked(source) == true) then local name = getElementData(source,"VOwner") if name then if name == getPlayerName(player) then setVehicleLocked(source,false) outputChatBox("Vehicle unlocked",player,3,249,61) else outputChatBox("Sorry,but this is not your vehicle",client,3,249,61) end end end end) Link to comment
koragg Posted October 3, 2016 Share Posted October 3, 2016 (edited) I recently converted this mod to save everything in account data instead of SQL (I'm not familiar with it and it had some bugs). I used these links to edit it, think they can help you too. https://wiki.multitheftauto.com/wiki/SetAccountData https://wiki.multitheftauto.com/wiki/GetAccountData https://wiki.multitheftauto.com/wiki/SetElementData And remember, delete everything connected with SQL and replace with functions from the above links to make it save all things to account data. Edited October 3, 2016 by koragg Link to comment
#BrosS Posted October 3, 2016 Share Posted October 3, 2016 addEventHandler("onResourceStart", resourceRoot, function() db = dbConnect("sqlite", "database.db") dbExec(db, "CREATE TABLE IF NOT EXISTS VehicleList (ID, Account, Model, X, Y, Z, RotZ, Colors, Upgrades, Paintjob, Cost, HP)") for i, player in ipairs(getElementsByType("player")) do updateVehicleInfo(player) end end) You can convert them manually . sorry i can't it's 1500 lines lol https://wiki.multitheftauto.com/wiki/DbQuery Link to comment
Dealman Posted October 3, 2016 Share Posted October 3, 2016 Do you mean to an XML? SQL is a database... 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