Could you please help me edit a script?
carMarker1 = createMarker(2200.72729,1390.67089,10.820312,"cylinder",2,100,100,0,200)
carMarker2 = createMarker(-1951.9349,273.04946,34.468,"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,35.174198,"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(545,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,55)
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)
--[[------------------------------------------car section-----------------------------------------
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------]]
carWindow = guiCreateWindow(0.35,0.35,0.35,0.45,"Welcome to the car shop",true)
carglVehicleSelection = guiCreateGridList(0,0.1,1,0.7,true,carWindow)
--add a vehicle and $ column to the gridlist
guiGridListSetSelectionMode(carglVehicleSelection,0)
carColumn = guiGridListAddColumn(carglVehicleSelection,"Car",0.6)
carcostColumn = guiGridListAddColumn(carglVehicleSelection,"Cost",0.4)
guiGridListSetColumnWidth(carglVehicleSelection,1,0.75,true)
guiGridListSetColumnWidth(carglVehicleSelection,2,0.25,true)
local cars = { {579,60000},{400,60000},{404,28000},{489,65000},{505,65000},{479,45000},{442,45000},{458,45000},{602,300000},{496,75000},{401,41000},{518,60000},{527,75000},{589,125000},{419,45000},{533,75000},{526,50000},{474,55000},{545,50000},{517,45000},{410,41000},{600,50000},{436,41000},{580,50000},{439,75000},{549,75000},{491,45000},{445,45000},{507,45000},{585,45000},{587,250000},{466,55000},{492,50000},{546,45000},{551,45000},{516,45000},{467,45000},{426,47500},{547,45000},{405,55000},{409,75000},{550,45000},{566,45000},{540,45000},{421,50000},{529,45000},{402,320000},{542,65000},{603,290000},{475,75000},{562,460000},{565,350000},{559,300000},{561,50000},{560,420000},{558,400000},{429,240000},{541,550000},{415,400000},{480,320000},{434,100000},{494,320000},{502,370000},{503,400000},{411,600000},{506,320000},{451,520000},{555,95000},{477,95000},{499,25000},{498,25000},{578,50000},{486,70000},{455,75000},{588,50000},{403,75000},{414,50000},{443,75000},{515,75000},{514,75000},{531,12000},{456,45000},{422,45000},{482,95000},{530,12000},{418,45000},{572,12000},{582,50000},{413,50000},{440,50000},{543,65000},{583,12000},{478,35000},{554,50000},{536,75000},{575,75000},{534,75000},{567,75000},{535,75000},{576,75000},{412,75000},{568,75000},{457,12000},{483,45000},{508,40000},{571,10000},{500,55000},{444,420000},{556,440000},{557,470000},{471,20000},{495,300000},{539,75000},{485,12000},{431,60000},{438,45000},{437,60000},{574,12000},{420,45000},{525,75000},{408,50000},{428,65000}}
for i,v in ipairs(cars) do
local carName = getVehicleNameFromModel(v[1])
local row = guiGridListAddRow(carglVehicleSelection)
guiGridListSetItemText(carglVehicleSelection,row,1,carName,false,true)
guiGridListSetItemText(carglVehicleSelection,row,2,tostring(v[2]),false,true)
end
buycar1 = guiCreateButton(0.1,0.85,0.3,0.15,"Buy Slot1",true,carWindow)
buycar2 = guiCreateButton(0.6,0.85,0.3,0.15,"Buy Slot2",true,carWindow)
closecarButton = guiCreateButton(0.45,0.85,0.1,0.15,"X",true,carWindow)
guiSetVisible(carWindow,false)
addEvent("showcarmarker",true)
function showcarmarker()
guiSetVisible(carWindow,true)
showCursor(true)
end
addEventHandler("showcarmarker",root,showcarmarker)
function buyCar1(button,state)
if (source == buycar1) then
guiSetVisible(carWindow,false)
showCursor(false)
local carName = guiGridListGetItemText(carglVehicleSelection,guiGridListGetSelectedItem(carglVehicleSelection),1)
local carID = getVehicleModelFromName(carName)
local carCost = guiGridListGetItemText(carglVehicleSelection,guiGridListGetSelectedItem(carglVehicleSelection),2)
triggerServerEvent("buycar1",getLocalPlayer(),carID,carCost,CarName)
elseif (source == buycar2) then
guiSetVisible(carWindow,false)
showCursor(false)
local carName = guiGridListGetItemText(carglVehicleSelection,guiGridListGetSelectedItem(carglVehicleSelection),1)
local carID = getVehicleModelFromName(carName)
local carCost = guiGridListGetItemText(carglVehicleSelection,guiGridListGetSelectedItem(carglVehicleSelection),2)
triggerServerEvent("buycar2",getLocalPlayer(),carID,carCost,CarName)
elseif (source == closecarButton) then
guiSetVisible(carWindow, false)
showCursor(false)
end
end
addEventHandler("onClientGUIClick",getRootElement(),buyCar1)
--[[------------------------------------------B menu section---------------------------------------
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------]]
local sWidth, sHeight = guiGetScreenSize()
guiwindow = guiCreateWindow(0.35,0.35,0.3,0.5,"diesel974 carsystem v1.1",true)
guiWindowSetMovable(guiwindow,true)
guiWindowSetSizable(guiwindow,false)
local tabPanel = guiCreateTabPanel ( 0, 0.1, 1, 1, true, guiwindow)
local tabGeneral = guiCreateTab( "General", tabPanel )
local tabVehicle = guiCreateTab( "My Vehicles", tabPanel )
local tabSpecial = guiCreateTab("Special", tabPanel)
mylabel = guiCreateLabel(0.02,0.04,0.94,0.9,[[
Welcome to ... server.
You are here to have fun,simple!
Note that we have our own rules here(press f1).
Please read them to avoid any kind of problems.Also,you have a free vehicle (personal).Enjoy!!!]],true,tabGeneral)
guiLabelSetColor(mylabel,3,249,61)
guiLabelSetHorizontalAlign(mylabel,"center",true)
local mycar1 = guiCreateButton(0.05,0.1,0.4,0.1,"Car Slot1",true,tabVehicle)
local mycar2 = guiCreateButton(0.55,0.1,0.4,0.1,"Car Slot2",true,tabVehicle)
local mybik1 = guiCreateButton(0.05,0.3,0.4,0.1,"Bike Slot1",true,tabVehicle)
local mybik2 = guiCreateButton(0.55,0.3,0.4,0.1,"Bike Slot2",true,tabVehicle)
local myplane1 = guiCreateButton(0.05,0.5,0.4,0.1,"Aircraft Slot1",true,tabVehicle)
local myplane2 = guiCreateButton(0.55,0.5,0.4,0.1,"Aircraft Slot2",true,tabVehicle)
local myboat1 = guiCreateButton(0.05,0.7,0.4,0.1,"Boat Slot1",true,tabVehicle)
local myboat2 = guiCreateButton(0.55,0.7,0.4,0.1,"Boat Slot2",true,tabVehicle)
local personal = guiCreateButton(0.25,0.85,0.5,0.1,"Personal",true,tabVehicle)
local fix = guiCreateButton(0.05,0.1,0.4,0.1,"Fix vehicle",true,tabSpecial)
local rotate = guiCreateButton(0.55,0.1,0.4,0.1,"Rotate vehicle",true,tabSpecial)
local lock = guiCreateButton(0.05,0.3,0.4,0.1,"Lock vehicle",true,tabSpecial)
local light = guiCreateButton(0.55,0.3,0.4,0.1,"Lights on/off",true,tabSpecial)
local engine = guiCreateButton(0.05,0.5,0.4,0.1,"Engine on/off",true,tabSpecial)
local invisible = guiCreateButton(0.55,0.5,0.4,0.1,"Invisible on/off",true,tabSpecial)
guiSetAlpha(tabPanel,1)
guiSetAlpha(tabGeneral,1)
guiSetAlpha(tabVehicle,1)
guiSetVisible(guiwindow, false)
function showHelp1 ()
if (guiGetVisible(guiwindow)) then
guiSetVisible(guiwindow, false)
showCursor(false)
else
guiSetVisible(guiwindow,true)
showCursor(true)
end
end
bindKey ("M", "down", showHelp1) --// binding that on resource start is not needed
addEventHandler("onClientGUIClick",getRootElement(),
function(button,state)
if (source == mycar1) then
triggerServerEvent("spawncar1",getLocalPlayer())
elseif (source == mycar2) then
triggerServerEvent("spawncar2",getLocalPlayer())
elseif (source == mybik1) then
triggerServerEvent("spawnbik1",getLocalPlayer())
elseif (source == mybik2) then
triggerServerEvent("spawnbik2",getLocalPlayer())
elseif (source == myplane1) then
triggerServerEvent("spawnplane1",getLocalPlayer())
elseif (source == myplane2) then
triggerServerEvent("spawnplane2",getLocalPlayer())
elseif (source == myboat1) then
triggerServerEvent("spawnboat1",getLocalPlayer())
elseif (source == myboat2) then
triggerServerEvent("spawnboat2",getLocalPlayer())
elseif (source == personal) then
triggerServerEvent("spawnpersonal",getLocalPlayer())
elseif (source == fix) then
triggerServerEvent("fixVehicle",getLocalPlayer())
elseif (source == rotate) then
triggerServerEvent("rotateVehicle",getLocalPlayer())
elseif (source == lock) then
triggerServerEvent("lockVehicle",getLocalPlayer())
elseif (source == light) then
triggerServerEvent("lightVehicle",getLocalPlayer())
elseif (source == engine) then
triggerServerEvent("engineVehicle",getLocalPlayer())
elseif (source == invisible) then
triggerServerEvent("invisibleVehicle",getLocalPlayer())
end
end)
------------------------------- Otto shop -------------------------------------------------
function sellingGui()
local sWidth, sHeight = guiGetScreenSize()
guiSellingwindow = guiCreateWindow(0.35,0.35,0.3,0.5,"Otto shop",true)
guiWindowSetMovable(guiSellingwindow,true)
guiWindowSetSizable(guiSellingwindow,false)
closebutton = guiCreateButton(0.87,0.065,0.1,0.1,"X",true,guiSellingwindow)
addEventHandler("onClientGUIClick",closebutton,closegui,false)
tabSellingPanel = guiCreateTabPanel ( 0, 0.2, 1, 1, true, guiSellingwindow)
tabSellingGeneral = guiCreateTab( "Welcome", tabSellingPanel )
tabSellingVehicle = guiCreateTab( "Sell your vehicles", tabSellingPanel )
mySellinglabel = guiCreateLabel(0.02,0.04,0.94,0.9,[[
Welcome to Otto shop.
Here we buy your vehicles at half the original price.
However be sure what you are doing. Selling a fully moded vehicle will get you half of the same price of the original price.
Have a good day!!!]],true,tabSellingGeneral)
guiLabelSetColor(mySellinglabel,0,200,0)
guiLabelSetHorizontalAlign(mySellinglabel,"center",true)
myScar1 = guiCreateButton(0.05,0.1,0.4,0.1,"sell car1",true,tabSellingVehicle)
myScar2 = guiCreateButton(0.55,0.1,0.4,0.1,"sell car2",true,tabSellingVehicle)
mySbik1 = guiCreateButton(0.05,0.3,0.4,0.1,"sell bike1",true,tabSellingVehicle)
mySbik2 = guiCreateButton(0.55,0.3,0.4,0.1,"sell bike2",true,tabSellingVehicle)
mySplane1 = guiCreateButton(0.05,0.5,0.4,0.1,"sell aircraft1",true,tabSellingVehicle)
mySplane2 = guiCreateButton(0.55,0.5,0.4,0.1,"sell aircraft2",true,tabSellingVehicle)
mySboat1 = guiCreateButton(0.05,0.7,0.4,0.1,"sell boat1",true,tabSellingVehicle)
mySboat2 = guiCreateButton(0.55,0.7,0.4,0.1,"sell boat2",true,tabSellingVehicle)
addEventHandler("onClientGUIClick",myScar1,sellVehicle,false)
addEventHandler("onClientGUIClick",myScar2,sellVehicle,false)
addEventHandler("onClientGUIClick",mySbik1,sellVehicle,false)
addEventHandler("onClientGUIClick",mySbik2,sellVehicle,false)
addEventHandler("onClientGUIClick",mySplane1,sellVehicle,false)
addEventHandler("onClientGUIClick",mySplane2,sellVehicle,false)
addEventHandler("onClientGUIClick",mySboat1,sellVehicle,false)
addEventHandler("onClientGUIClick",mySboat2,sellVehicle,false)
guiSetAlpha(tabSellingPanel,1)
guiSetAlpha(tabSellingGeneral,1)
guiSetAlpha(tabSellingVehicle,1)
guiSetVisible(guiSellingwindow, false)
end
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),
function()
sellingGui()
end)
function sellVehicle(button,state)
--outputChatBox("done")
if button == "left" and state == "up" then
if source == myScar1 then
triggerServerEvent("sellcar1",getLocalPlayer())
elseif source == myScar2 then
triggerServerEvent("sellcar2",getLocalPlayer())
elseif source == mySbik1 then
triggerServerEvent("sellbik1",getLocalPlayer())
elseif source == mySbik2 then
triggerServerEvent("sellbik2",getLocalPlayer())
elseif source == mySplane1 then
triggerServerEvent("sellplane1",getLocalPlayer())
elseif source == mySplane2 then
triggerServerEvent("sellplane2",getLocalPlayer())
elseif source == mySboat1 then
triggerServerEvent("sellboat1",getLocalPlayer())
elseif source == mySboat2 then
triggerServerEvent("sellboat2",getLocalPlayer())
end
end
end
addEvent("showSellingGui",true)
function showsgui()
guiSetVisible(guiSellingwindow,true)
showCursor(true)
end
addEventHandler("showSellingGui",root,showsgui)
function closegui(button,state)
--outputChatBox("ok")
if button == "left" and state =="up" then
if source == closebutton then
guiSetVisible(guiSellingwindow,false)
showCursor(false)
end
end
end
i want change to skins