Jump to content

Dimos7

Members
  • Posts

    1,546
  • Joined

  • Last visited

Everything posted by Dimos7

  1. alots x nill values not messa not string etc
  2. that you wrote it wont work bro
  3. Like that will be apear many erroy x ,y message etc not take them from one to other function function sendClientMessage(message, r, g, b, colorCode) local x, y = guiGetScreenSize() local message = tostring(message) if not message then return end r,g ,b = tonumber(r), tonumber(g), tonumber(b) if not colorCode then colorCode = false else colorCode = true r,g,b = getColorFromString(message) end dxDrawRectangle(x/2-800/2, 0, 800, 50, tocolor(0, 0, 0, 220), false, false) dxDrawText(message, 0, 15, x, y, tocolor(r, g, b, 220), 1, "default", "center", "top", false, false, true) end addEvent("sendClientMessage", true) addEventHandler("sendClientMessage", root, sendClientMessage) function Notifactions() sendClientMessage() addEventHandler("onClientRender", root, Notifactions) setTimer( function() removeEventHandler("onClientRender", root, Notifactions) end, 15000, 1) end i try it like this but again in few seconds dissapear
  4. in this case like i have it what i can do?
  5. function sendClientMessage(message, r, g, b, colorCode) local x, y = guiGetScreenSize() local message = tostring(message) if not message then return end r,g ,b = tonumber(r), tonumber(g), tonumber(b) if not colorCode then colorCode = false else colorCode = true r,g,b = getColorFromString(message) end addEventHandler("onClientRender", root, function() dxDrawRectangle(x/2-800/2, 0, 800, 50, tocolor(0, 0, 0, 220), false, false) dxDrawText(message, 0, 15, x, y, tocolor(r, g, b, 220), 1, "default", "center", "top", false, false, true) end ) setTimer(removeEventHandler, 5000, 1, "onClientRender", root, sendClientMessage) end addEvent("sendClientMessage", true) addEventHandler("sendClientMessage", root, sendClientMessage) i try it like that but in time need function and put the functionstart function say take nill
  6. but i want be only for some time not for every frame
  7. i try it like this function sendClientMessage(message, r, g, b, colorCode) local x, y = guiGetScreenSize() local message = tostring(message) if not message then return end r,g ,b = tonumber(r), tonumber(g), tonumber(b) if not colorCode then colorCode = false else colorCode = true r,g,b = getColorFromString(message) end if getTickCount() <= 5000 then dxDrawRectangle(x/2, 0, 200, 100, tocolor(0, 0, 0, 220), false, false) dxDrawText(message,x/2, 0, x, y, tocolor(r, g, b, 220), 1, "default", "left", "top", false, false, true) end end addEvent("sendClientMessage", true) addEventHandler("sendClientMessage", root, sendClientMessage) but didn't show up nothing
  8. function sendClientMessage(message, r, g, b, colorCode) local x, y = guiGetScreenSize() local message = string.gsub(message, "") if not message then return end r,g ,b = tonumber(r), tonumber(g), tonumber(b) if not colorCode then colorCode = false else colorCode = true r,g,b = getColorFromString(message) end dxDrawRectangle(x/2, 0, 200, 200, tocolor(0, 0, 0, 220), false, false) dxDrawText(message,0, 0, x, y, tocolor(r, g, b, 220), 1, "default", "center", "center", false, false, true) end addEvent("sendClientMessage", true) addEventHandler("sendClientMessage", root, sendClientMessage) it draw the rectangle but for very few seconds why?
  9. Dimos7

    Sql error

    local Vehicles = {{579,60000},{400,60000},{404,28000},{489,65000},{505,65000},{479,45000},{442,45000},{458,45000},{602,100000},{496,42500},{401,41000},{518,60000},{527,75000},{589,75000},{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,100000},{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,250000},{542,65000},{603,150000},{475,75000},{562,175000},{565,95000},{559,125000},{561,50000},{560,125000},{558,100000},{429,150000},{541,150000},{415,150000},{480,95000},{434,100000},{494,200000},{502,200000},{503,200000},{411,300000},{506,150000},{451,300000},{555,95000},{477,95000},{499,25000},{498,25000},{578,50000},{486,70000},{406,500000},{573,250000},{455,75000},{588,50000},{403,75000},{423,1000000},{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,250000},{556,250000},{557,250000},{495,100000},{539,75000},{485,12000},{431,60000},{438,45000},{437,60000},{574,12000},{420,45000},{525,75000},{408,50000},{428,65000}} local Updates = {{1000}, {1001}, {1002}, {1003}, {1004}, {1005}, {1006}, {1007},{1008}, {1009} , {1010}, {1011}, {1012}, {1013}, {1014}, {1015}, {1016}, {1017}, {1018}, {1019}, {1020}, {1021}, {1022}, {1023}, {1024}, {1025}, {1026}, {1027}, {1028}, {1029}, {1030}, {1031}, {1032}, {1033}, {1034}, {1035}, {1036}, {1037}, {1038}, {1039}, {1040}, {1041}, {1042}, {1043}, {1044}, {1045}, {1046}, {1047}, {1048}, {1049}, {1050}, {1051}, {1052}, {1053}, {1054}, {1055}, {1056}, {1057}, {1058}, {1059},{1060}, {1061}, {1062}, {1063}, {1064}, {1065}, {1066}, {1067}, {1068}, {1069}, {1070}, {1071}, {1072}, {1073}, {1074}, {1075}, {1076}, {1077}, {1078}, {1079}, {1080}, {1081}, {1082}, {1083}, {1084}, {1085}, {1086}, {1087}, {1088}, {1089}, {1090}, {1091}, {1092}, {1093}, {1094}, {1095}, {1096}, {1097}, {1098}, {1099}, {1100}, {1101}, {1102}, {1103}, {1104}, {1105}, {1106}, {1107}, {1108}, {1109}, {1110}, {1111}, {1112}, {1113}, {1114}, {1115}, {1116}, {1117}, {1118}, {1119}, {1120}, {1121}, {1122}, {1123}, {1124}, {1125}, {1126}, {1127}, {1128}, {1129}, {1130}, {1131}, {1132}, {1133}, {1134}, {1135}, {1136}, {1137}, {1138}, {1139}, {1140}, {1141}, {1142}, {1143}, {1144}, {1145}, {1146}, {1147}, {1148}, {1149}, {1150}, {1151}, {1152}, {1153}, {1154}, {1155}, {1156}, {1157}, {1158}, {1159}, {1160}, {1161}, {1162}, {1163}, {1164}, {1165}, {1166}, {1167}, {1168}, {1169}, {1170}, {1171}, {1172}, {1173}, {1174}, {1175}, {1176}, {1177}, {1178}, {1179}, {1180}, {1181}, {1182}, {1183}, {1184}, {1185}, {1186}, {1187}, {1188}, {1189}, {1190}, {1191}, {1192}, {1193}} GUIEditor = { gridlist = {}, window = {}, button = {}, scrollbar = {}, column = {} } function shop() local screenWidth , screenHeight = guiGetScreenSize() local windowWidth, windowHeight = 457, 491 local left, top = screenWidth/2 - windowWidth/2 , screenHeight/2 - windowHeight/2 GUIEditor.window[1] = guiCreateWindow(left, top, windowWidth, windowHeight, "Car Shop", false) guiWindowSetMovable(GUIEditor.window[1], false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetAlpha(GUIEditor.window[1], 1.00) guiSetProperty(GUIEditor.window[1], "CaptionColour", "FFFFFEFE") GUIEditor.gridlist[1] = guiCreateGridList(20, 30, 410, 332, false, GUIEditor.window[1]) GUIEditor.column[1] = guiGridListAddColumn(GUIEditor.gridlist[1], "Vehicle name", 0.5) GUIEditor.column[2] = guiGridListAddColumn(GUIEditor.gridlist[1], "Price", 0.5) GUIEditor.button[1] = guiCreateButton(25, 385, 117, 47, "Buy", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FF26E513") GUIEditor.button[2] = guiCreateButton(303, 385, 117, 47, "Close", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFF70000") GUIEditor.button[3] = guiCreateButton(168, 385, 117, 47, "View Vehicle", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FFE8DB0E") showCursor(true) for ent,v in ipairs(Vehicles) do local row = guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, getVehicleNameFromModel(v[1]), false, false) guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, v[1]) guiGridListSetItemText(GUIEditor.gridlist[1], row, 2, "".. v[2] .."$", false, false) guiGridListSetItemData(GUIEditor.gridlist[1], row, 2, v[2]) end end Marker1 = createMarker(321.04, -1965.3171, 17.9757, "cylinder", 3, 0, 0, 255, 255) Marker2 = createMarker(193.7826, 1919.5389, 16.64, "cylinder", 3, 0, 0, 255, 255) addEventHandler("onClientMarkerHit", Marker1, shop) addEventHandler("onClientMarkerHit", Marker2, shop) addEventHandler("onClientGUIClick", root, function(button,state) if not GUIEditor.window[1] or not guiGetVisible(GUIEditor.window[1]) then return end if ( source == GUIEditor.button[1] ) and ( button == "left" ) and ( state == "up" ) then if guiGridListGetSelectedItem(GUIEditor.gridlist[1]) == -1 then outputChatBox("Please select a vehicle to buy!", 255, 0, 0) return end local vehicleID = guiGridListGetItemData(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 1) local price = tonumber(guiGridListGetItemData(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 2)) triggerServerEvent("VS.buy", localPlayer, getLocalPlayer(), tonumber(vehicleID), price) guiSetVisible(GUIEditor.window[1], false) showCursor(false) guiSetInputEnabled(false) elseif ( source == GUIEditor.button[2] ) and ( button == "left" ) and ( state == "up" ) then guiSetVisible(GUIEditor.window[1], false) showCursor(false) guiSetInputEnabled(false) elseif ( source == GUIEditor.button[3] ) and ( button == "left" ) and ( state == "up" ) then if guiGridListGetSelectedItem(GUIEditor.gridlist[1]) == -1 then outputChatBox("Please select a vehicle to view!", 255, 0, 0) return end local vehicleID = guiGridListGetItemData(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 1) local x, y, z = getElementPosition(getLocalPlayer()) local vehicle = createVehicle(vehicleID,x,y-5,z) if ( vehicle ) then setTimer(destroyElement,5000,1,vehicle) end guiSetVisible(GUIEditor.window[1], false) showCursor(false) end end) function close_shop() shop() showCursor(false) guiSetVisible(GUIEditor.window[1], false) end addEventHandler("onClientMarkerLeave", Marker1, close_shop) addEventHandler("onClientMarkerLeave", Marker2, close_shop) function showVehicles() local screenWidth, screenHeight = guiGetScreenSize() local windowWidth, windowHeight = 457, 491 local left, top = screenWidth/2 - windowWidth/2, screenHeight/2 - windowHeight/2 GUIEditor.window[2] = guiCreateWindow(left, top, windowWidth, windowHeight, "Vehicles", false) guiWindowSetMovable(GUIEditor.window[2],false) guiWindowSetSizable(GUIEditor.window[2], false) showCursor(not isCursorShowing()) guiSetVisible(GUIEditor.window[2], not guiGetVisible(GUIEditor.window[2])) GUIEditor.gridlist[2] = guiCreateGridList(20, 30, 410, 332, false, GUIEditor.window[2]) GUIEditor.column[3] = guiGridListAddColumn(GUIEditor.gridlist[2], "Vehicles:", 0.5) GUIEditor.button[4] = guiCreateButton(25, 385, 117, 47, "Okay", false, GUIEditor.window[2]) GUIEditor.button[5] = guiCreateButton(303, 385, 117, 47, "Upgrades", false, GUIEditor.window[2]) GUIEditor.button[6] = guiCreateButton(168, 385, 117, 47, "Fix", false, GUIEditor.window[2]) ownVehicles = getElementData(localPlayer, "Vehicles") if ownVehicles then for _, v in ipairs(ownVehicles) do local row = guiGridListAddRow(GUIEditor.gridlist[2]) guiGridListSetItemText(GUIEditor.gridlist[2], row, 1, getElementData(v, "spawned")..""..getElementData(localPlayer, "Vehicles:Name").."".."("..getElementData(v, "Vehicles:ID")..")", false, false) guiGridListSetItemData(GUIEditor.gridlist[2], row, 1, v[1]) end end end bindKey("F3", "down", showVehicles) function createUpdagradeWindow() local screenWidth, screenHeight = guiGetScreenSize() local windowWidth, windowHeight = 314, 377 local left, top = screenWidth/2 - windowWidth/2, screenHeight/2- windowHeight/2 GUIEditor.window[3] = guiCreateWindow(left, top, windowWidth, windowHeight, "Vehicle Upgrades") guiWindowSetMovable(GUIEditor.window[3], false) guiWindowSetSizable(GUIEditor.window[3], false) GUIEditor.gridlist[3] = guiCreateGridList(15, 31, 284, 294, false, GUIEditor.window[3]) GUIEditor.column[4] = guiGridListAddColumn(GUIEditor.gridlist[3], "Upgrade", 0.5) GUIEditor.column[5] = guiGridListAddColumn(GUIEditor.gridlist[3], "Price", 0.5) for _ , v in ipairs(Updates) do local row = guiGridListAddRow(GUIEditor.gridlist[3]) guiGridListSetItemText(GUIEditor.gridlist[3], row, 1 , getVehicleUpgradeSlotName(Updates), false, false) guiGridListSetItemText(GUIEditor.gridlist[3], row, 1 , v[1], false, false) guiGridListSetItemData(GUIEditor.gridlist[3], row, 1, v[1]) guiGridListSetItemText(GUIEditor.gridlist[3], row, 2, ""..v[2].."$", false, false) guiGridListSetItemData(GUIEditor.gridlist[3], row, 2, v[2]) end GUIEditor.button[7] = guiCreateButton(25, 342, 56, 25, "add", false, GUIEditor.window[3]) GUIEditor.button[8] = guiCreateButton(109, 342, 56, 25, "remove", false, GUIEditor.window[3]) GUIEditor.button[9] = guiCreateButton(200, 342, 56, 25, "close", false, GUIEditor.window[3]) guiSetVisible(GUIEditor.window[3], false) end addEventHandler("onClientGUIClick", root, function(button, state) if not GUIEditor.window[2] or not guiGetVisible(GUIEditor.window[2]) then return end if (source == GUIEditor.button[4]) and (button == "left") and (state == "up") then if guiGridListGetSelectedItem(GUIEditor.gridlist[2]) == - 1 then outputChatBox("Please select a vehicle to spawn / depsawn!", 255, 0, 0) return end local vehicle = guiGridListGetItemData(GUIEditor.gridlist[2], guiGridListGetSelectedItem(GUIEditor.gridlist[1], 1)) local dbid = getElementData(localPlayer, "Vehicles:ID") triggerServerEvent("VS.spawn", localPlayer, vehicle, dbid) elseif (source == GUIEditor.button[5]) and (button== "left") and (state == "up") then if guiGridListGetSelectedItem(GUIEditor.gridlist[2]) == - 1 then outputChatBox("Please select a vehicle to upgrade!", 255, 0, 0) return end createUpdagradeWindow() guiSetVisible(GUIEditor.window[3], true) showCursor(true) if source == GUIEditor.button[7] then local vehicle = guiGridListGetItemData(GUIEditor.gridlist[2], guiGridListGetSelectedItem(GUIEditor.gridlist[1], 1)) local upgrade = tonumber(guiGridListGetItemData(GUIEditor.gridlist[3], guiGridListGetSelectedItem(GUIEditor.gridlist[3]), 1)) local price = tonumber(guiGridListGetItemData(GUIEditor.gridlist[3], guiGridListGetSelectedItem(GUIEditor.gridlist[3]), 2)) triggerServerEvent("VS.upgrade", localPlayer, vehicle, upgrade, price) elseif source == GUIEditor.button[8] then local vehicle = guiGridListGetItemData(GUIEditor.gridlist[2], guiGridListGetSelectedItem(GUIEditor.gridlist[1], 1)) local upgrade = tonumber(guiGridListGetItemData(GUIEditor.gridlist[3], guiGridListGetSelectedItem(GUIEditor.gridlist[3], 1))) local price = tonumber(guiGridListGetItemData(GUIEditor.gridlist[3], guiGridListGetSelectedItem(GUIEditor.gridlist[3]), 2)) triggerServerEvent("VS.upgrade", localPlayer, vehicle, upgrade, price/2) elseif source == GUIEditor.button[9] then guiSetVisible(GUIEditor.window[3], false) showCursor(false) end elseif (source == GUIEditor.button[6]) and (button=="left") and (state == "up") then if guiGridListGetSelectedItem(GUIEditor.gridlist[2]) == - 1 then outputChatBox("Please select a vehicle to fix!", 255, 0, 0) return end local vehicle = guiGridListGetItemData(GUIEditor.gridlist[2], guiGridListGetSelectedItem(GUIEditor.gridlist[1], 1)) local dbid = getElementData(localPlayer, "Vehicles:ID") triggerServerEvent("VS.fix", localPlayer, vehicle, dbid) end end) when i press f3 only the cursor work the visible no why not error or warnigns
  10. you want show to all and damage them?
  11. addCommandHandler("bobo", function () local position = Vector3(getElementPosition (localPlayer)) local weapon = createWeapon( 'minigun',position.x, position.y, position.z + 3 ); if ( isPedInVehicle(localPlayer )) then local car = getPedOccupiedVehicle ( localPlayer ) local _,_, rotZ = getElementRotation(weapon) setElementRotation(weapon, 0, 0 , rotZ+10) attachElements ( weapon, car, 0, 0, 1, 0, 90, 0 ) end end)
  12. addCommandHandler("bobo", function () local position = Vector3(getElementPosition (localPlayer)) local weapon = createWeapon( 'minigun',position.x, position.y, position.z + 3 ); if ( isPedInVehicle(localPlayer )) then local car = getPedOccupiedVehicle ( localPlayer ) attachElements ( weapon, car, 0, 0, 1, 0, 90, 0 ) end
  13. Dimos7

    Sql error

    anyone please i am hurry need to fix it soon
  14. Dimos7

    Sql error

    handler = dbConnect("sqlite", " IZDatabase.db") dbExec(handler, "CREATE TABLE IF NOT EXISTS vehicles(id int(11), model int(3), x decimal(10,6), y decimal(10.6), z decimal(10.6), rotx decimal(10.6), roty decimal(10,6), rotz decimal(10.6), engine int(1), locked int(1), lights int(1), hp float, color1 varchar(50), color2 varchar(50), plate text, owner text, interior int(5), dimension int(5), upgrades varchat(150), headLights varchar(30), variant1 int(3), variant2 int(3))") dbExec(handler, "INSERT INTO vehicles VALUES(model='0', x='0.000000', y='0.000000',z='0.000000', rotx='0.000000', roty='0.000000', rotz='0.000000', engine='0', locked='0', lights='0', hp='100', color1='0', color2='0', interior='0', dimension='0', upgades= '[ [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ]', headLights=' [ [ 255, 255, 255 ] ]', variant1='NULL', variant2='NULL')") function SmallestID() local query = dbQuery(handler, "SELECT MIN(e1.id+1) AS nextID FROM vehicles AS e1 LEFT JOIN vehicles AS e2 ON e1.id+1 = e2.id WHERE e2.id = NULL") local result = dbPoll(query, -1) if result then local id = tonumber(result["nextID"]) or 1 return id end end function buyTheCar(player, vehicle, price) if isElement(source) and source == player and ( not ( isGuestAccount(getPlayerAccount(source)) ) ) then local money = getPlayerMoney(source) local i = 0 if vehicle and price <= money and ( getAccountData(getPlayerAccount(source),"VS.5") == false ) then local x, y, z = getElementPosition(source) local car = createVehicle(vehicle, x, y-5, z) warpPedIntoVehicle(source,car) outputChatBox("You have successfully bought "..getVehicleNameFromModel(vehicle).."!", source, 0, 255, 0) takePlayerMoney(source, price) local vx, vy, vz = getElementPosition(car) local rx, ry, rz = getElementRotation(car) local col = {getVehicleColor(car)} local color1 = toJSON( col[1], col[2], col[3]) local color2 = toJSON( col[4], col[5], col[6]) local latter1 = string.char(math.random(65, 90)) local latter2 = string.char(math.random(65, 90)) local var1, var2 = getVehicleVariant(car) local plate = latter1..latter2..math.random(0,9).." "..math.random(1000,9999) local smallestid = SmallestID() i = i + 1 setVehiclePlateText(car, plate) dbExec(handler, "INSERT INTO vehicles VALUES(id='"..tostring(smallestid).."', model='"..tostring(vehicle).."', x='"..tostring(vx).."', y='"..tostring(vy).."', z='"..tostring(vz).."', rotx='"..tostring(rx).."',roty='".. tostring(ry).."',rotz='"..tostring(rz).."', color1='"..tostring(color1).."', color2='"..tostring(color2).."', owner='"..getplayerName(source).."', plate='"..tostring(plate).."', variant1='"..var1.."', variant2='"..var2.."')") setElementData(source, "Vehicles", i) setElementData(source, "Vehicles:Name", getVehicleNameFromModel(vehicle)) setElementData(vehicle, "Vehicles:ID", smallestid) setElementData(vehicle, "owner", getPlayerName(source)) local account = getPlayerAccount(source) if ( getAccountData(account,"VS.1") == false ) then setAccountData(account,"VS.1",vehicle) outputChatBox("You own now 1 vehicle!",source,0,255,0) elseif ( getAccountData(account,"VS.2") == false ) then setAccountData(account,"VS.2",vehicle) outputChatBox("You own now 2 vehicles!",source,0,255,0) elseif ( getAccountData(account,"VS.3") == false ) then setAccountData(account,"VS.3",vehicle) outputChatBox("You own now 3 vehicles!",source,0,255,0) elseif ( getAccountData(account,"VS.4") == false ) then setAccountData(account,"VS.4",vehicle) outputChatBox("You own now 4 vehicles!",source,0,255,0) elseif ( getAccountData(account,"VS.5") == false ) then setAccountData(account,"VS.5",vehicle) outputChatBox("You own now 5 vehicles and you can't own more vehicles!",source,0,255,0) end elseif ( price > money ) then outputChatBox("You don't have enough money to buy this vehicle!", source, 255, 0, 0) elseif ( not ( getAccountData(getPlayerAccount(source),"VS.5") == false ) ) then outputChatBox("You can't own more than 5 vehicles!",source,255,0,0) end end end addEvent("VS.buy", true) addEventHandler("VS.buy", root, buyTheCar) function spawnTheCar(vehicle, id) local query = dbQuery(handler, "SELECT * FROM vehicles WHERE id='"..id.."', and model='"..getVehicleModelFromName(vehicle).."'") local result = dbPoll(query, -1) local spawned = true if vehicle and id then if result > 0 and spawned == true then destroyElement(vehicle) spawned = false setElementData(vehicle, "spawned", "#FF0000[INACTIVE]") elseif result > 0 and spawned == false then createVehicle(tonumber(result["model"]), tonumber(result["x"]), tonumber(result["y"]), tonumber(result["z"]), tonumber(result["rotx"]), tonumber(result["roty"]), tonumber(result["rotz"]), result["plate"]) setVehicleVariant(vehicle, tonumber(result["variant1"]), tonumber(result["variant2"])) setVehicleColor(vehicle, tonumber(result["color1"]), tonumber(result["color2"])) addVehicleUpgrade(vehicle, tonumber(result["upgades"])) setElementHealth(vehicle, tonumber(result["hp"])) setElementData(vehicle, "spawned", "#00FF00[ACTIVE]") spawned = true end end end addEvent("VS.spawn", true) addEventHandler("VS.spawn", root, spawnTheCar) function upgradeTheCar(vehicle, id, upgrade, price) local query = dbQuery(handler, "SELECT * FROM vehicles WHERE id='"..id.."', and model='"..getVehicleNameFromModel(vehicle).."'") local result = dbPoll(query, -1) local money = getPlayerMoney(source) if result > 0 then if upgrade and price <= money then addVehicleUpgrade(vehicle, upgrade) local var1, var2 = getVehicleVariant(car) dbExec(handler, "UPDATE vehicles SET upgrades='"..tostring(getVehicleUpgrades(vehicle)).."'and variant1='"..var1.."', and variant2='"..var2.." WHERE id='"..id.."'") takePlayerMoney(source, price) elseif upgrade and getVehicleUpgradeSlot(getVehicleUpgradeSlotName(upgrade)) and price then removeVehicleUpgrade(vehicle, upgrade) givePlayerMoney(source, price) local var1, var2 = getVehicleVariant(car) dbExec(handler, "UPDATE vehicles SET upgrades='"..tostring(getVehicleUpgrades(vehicle)).."'and variant1='"..var1.."', and variant2='"..var2.." WHERE id='"..id.."'") elseif price > money then outputChatBox("You don't have enough money to buy this upgrade!", source, 255, 0, 0) end end end addEvent("VS.upgrade", true) addEventHandler("VS.upgade", root, upgradeTheCar) function setCarColor(vehicle, color1, color2) if getElementData(vehicle, "owner") and getElementData(source,"Vehicles") and getPedInVehicle(source) and getPedOccupiedVehicleSeat(getPedOccupiedVehicle(source))==0 then if not color1 or not color2 then outputChatBox("Put color1 (r, g, b) and color2(r,g, b) to change your vehicle color!", source, 255, 0, 0) return end color1 = tonumber(r), tonumber(g), tonumber(b) color2 = tonumber(r), tonumber(g), tonumber(b) setVehicleColor(getPedOccupiedVehicle(source), color1, color2) takePlayerMoney(source, 300) dbExec(handler, "UPDATE vehicles SET color1="..tostring(color1).."', color2='"..tostring(color2).." WHERE id ='"..getElementData(vehicle, "Vehicles:ID").."'") end end addCommandHandler("setColor", setCarColor) function setVehicleSpawn(vehicle) if getElementData(vehicle, "owner") and getElementData(source,"Vehicles") and getPedInVehicle(source) and getPedOccupiedVehicleSeat(getPedOccupiedVehicle(source))==0 then x, y, z = getElementPosition(vehicle) rx, ry, rz = getElementRotation(vehicle) col = {getVehicleColor(vehicle)} color1 = toJSON(col[1], col[2], col[3]) color2 = toJSON(col[4], col[5], col[6]) hp = getElementHealth(vehicle) dbExec(handler, "UPDATE vehicles SET x='".. tostring(x).."', y='"..tostring(y)"',z='"..tostring(z).."',rotx='"..tostring(rx)"',roty='"..tostring(ry)"', rotz='"..tostring(rz).."', color1='"..color1.."', color2='"..color2.."', and hp='"..tostring(hp).."WHERE id='"..getElementData(source, "Vehicles:ID").."'") end end addCommandHandler("park", setVehicleSpawn) function fixCar(vehicle, id) local query = dbQuery(handler, "SELECT * FROM vehicles WHERE id='"..id.."' and model='"..getVehicleNameFromModel(vehicle).."'") local result = dbPoll(query, -1) if result >0 then fixVehicle(vehicle) end end addEvent("VS.fix", true) addEventHandler("VS.fix", root, fixCar) function selltheCar(vehicle, id, price) if getElementData(vehicle, "owner") and getElementData(source, "Vehicles") and getPedInVehicle(source) then price = buyTheCar(price) destroyElement(vehicle) givePlayerMoney(source, price/2) dbExec(handler, "DELETE vehicles WHERE id ='"..getElementData(vehicle, "Vehicles:ID").."'") end end addCommandHandler("sellcar", selltheCar) dbExec no such column model
  15. Dimos7

    Sql error

    handler = dbConnect("sqlite", " IZDatabase.db") dbExec(handler, "CREATE TABLE IF NOT EXISTS vehicles(id int(11), model int(3), x decimal(10,6), y decimal(10.6), z decimal(10.6), rotx decimal(10.6), roty decimal(10,6), rotz decimal(10.6), engine int(1), locked int(1), lights int(1), hp float, color1 varchar(50), color2 varchar(50), plate text, owner text, interior int(5), dimension int(5), upgrades varchat(150), headLights varchar(30), variant1 int(3), variant2 int(3)") dbExec(handler, "INSERT INTO vehicles VALUES(model='0', x='0.000000', y='0.000000',z='0.000000', rotx='0.000000', roty='0.000000', rotz='0.000000', engine='0', locked='0', lights='0', hp='100', color1='0', color2='0', interior='0', dimension='0', upgades= '[ [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ]', headLights=' [ [ 255, 255, 255 ] ]', variant1='NULL', variant2='NULL')") function SmallestID() local query = dbQuery(handler, "SELECT MIN(e1.id+1) AS nextID FROM vehicles AS e1 LEFT JOIN vehicles AS e2 ON e1.id+1 = e2.id WHERE e2.id = NULL") local result = dbPoll(query, -1) if result then local id = tonumber(result["nextID"]) or 1 return id end end function buyTheCar(player, vehicle, price) if isElement(source) and source == player and ( not ( isGuestAccount(getPlayerAccount(source)) ) ) then local money = getPlayerMoney(source) local i = 0 if vehicle and price <= money and ( getAccountData(getPlayerAccount(source),"VS.5") == false ) then local x, y, z = getElementPosition(source) local car = createVehicle(vehicle, x, y-5, z) warpPedIntoVehicle(source,car) outputChatBox("You have successfully bought "..getVehicleNameFromModel(vehicle).."!", source, 0, 255, 0) takePlayerMoney(source, price) local vx, vy, vz = getElementPosition(car) local rx, ry, rz = getElementRotation(car) local col = {getVehicleColor(car)} local color1 = toJSON( col[1], col[2], col[3]) local color2 = toJSON( col[4], col[5], col[6]) local latter1 = string.char(math.random(65, 90)) local latter2 = string.char(math.random(65, 90)) local var1, var2 = getVehicleVariant(car) local plate = latter1..latter2..math.random(0,9).." "..math.random(1000,9999) local smallestid = SmallestID() i = i + 1 setVehiclePlateText(car, plate) dbExec(handler, "INSERT INTO vehicles VALUES(id='"..tostring(smallestid).."', model='"..tostring(vehicle).."', x='"..tostring(vx).."', y='"..tostring(vy).."', z='"..tostring(vz).."', rotx='"..tostring(rx).."',roty='".. tostring(ry).."',rotz='"..tostring(rz).."', color1='"..tostring(color1).."', color2='"..tostring(color2).."', owner='"..getplayerName(source).."', plate='"..tostring(plate).."', variant1='"..var1.."', variant2='"..var2.."')") setElementData(source, "Vehicles", i) setElementData(source, "Vehicles:Name", getVehicleNameFromModel(vehicle)) setElementData(vehicle, "Vehicles:ID", smallestid) setElementData(vehicle, "owner", getPlayerName(source)) local account = getPlayerAccount(source) if ( getAccountData(account,"VS.1") == false ) then setAccountData(account,"VS.1",vehicle) outputChatBox("You own now 1 vehicle!",source,0,255,0) elseif ( getAccountData(account,"VS.2") == false ) then setAccountData(account,"VS.2",vehicle) outputChatBox("You own now 2 vehicles!",source,0,255,0) elseif ( getAccountData(account,"VS.3") == false ) then setAccountData(account,"VS.3",vehicle) outputChatBox("You own now 3 vehicles!",source,0,255,0) elseif ( getAccountData(account,"VS.4") == false ) then setAccountData(account,"VS.4",vehicle) outputChatBox("You own now 4 vehicles!",source,0,255,0) elseif ( getAccountData(account,"VS.5") == false ) then setAccountData(account,"VS.5",vehicle) outputChatBox("You own now 5 vehicles and you can't own more vehicles!",source,0,255,0) end elseif ( price > money ) then outputChatBox("You don't have enough money to buy this vehicle!", source, 255, 0, 0) elseif ( not ( getAccountData(getPlayerAccount(source),"VS.5") == false ) ) then outputChatBox("You can't own more than 5 vehicles!",source,255,0,0) end end end addEvent("VS.buy", true) addEventHandler("VS.buy", root, buyTheCar) function spawnTheCar(vehicle, id) local query = dbQuery(handler, "SELECT * FROM vehicles WHERE id='"..id.."', and model='"..getVehicleModelFromName(vehicle).."'") local result = dbPoll(query, -1) local spawned = true if vehicle and id then if result > 0 and spawned == true then destroyElement(vehicle) spawned = false setElementData(vehicle, "spawned", "#FF0000[INACTIVE]") elseif result > 0 and spawned == false then createVehicle(tonumber(result["model"]), tonumber(result["x"]), tonumber(result["y"]), tonumber(result["z"]), tonumber(result["rotx"]), tonumber(result["roty"]), tonumber(result["rotz"]), result["plate"]) setVehicleVariant(vehicle, tonumber(result["variant1"]), tonumber(result["variant2"])) setVehicleColor(vehicle, tonumber(result["color1"]), tonumber(result["color2"])) addVehicleUpgrade(vehicle, tonumber(result["upgades"])) setElementHealth(vehicle, tonumber(result["hp"])) setElementData(vehicle, "spawned", "#00FF00[ACTIVE]") spawned = true end end end addEvent("VS.spawn", true) addEventHandler("VS.spawn", root, spawnTheCar) function upgradeTheCar(vehicle, id, upgrade, price) local query = dbQuery(handler, "SELECT * FROM vehicles WHERE id='"..id.."', and model='"..getVehicleNameFromModel(vehicle).."'") local result = dbPoll(query, -1) local money = getPlayerMoney(source) if result > 0 then if upgrade and price <= money then addVehicleUpgrade(vehicle, upgrade) local var1, var2 = getVehicleVariant(car) dbExec(handler, "UPDATE vehicles SET upgrades='"..tostring(getVehicleUpgrades(vehicle)).."'and variant1='"..var1.."', and variant2='"..var2.." WHERE id='"..id.."'") takePlayerMoney(source, price) elseif upgrade and getVehicleUpgradeSlot(getVehicleUpgradeSlotName(upgrade)) and price then removeVehicleUpgrade(vehicle, upgrade) givePlayerMoney(source, price) local var1, var2 = getVehicleVariant(car) dbExec(handler, "UPDATE vehicles SET upgrades='"..tostring(getVehicleUpgrades(vehicle)).."'and variant1='"..var1.."', and variant2='"..var2.." WHERE id='"..id.."'") elseif price > money then outputChatBox("You don't have enough money to buy this upgrade!", source, 255, 0, 0) end end end addEvent("VS.upgrade", true) addEventHandler("VS.upgade", root, upgradeTheCar) function setCarColor(vehicle, color1, color2) if getElementData(vehicle, "owner") and getElementData(source,"Vehicles") and getPedInVehicle(source) and getPedOccupiedVehicleSeat(getPedOccupiedVehicle(source))==0 then if not color1 or not color2 then outputChatBox("Put color1 (r, g, b) and color2(r,g, b) to change your vehicle color!", source, 255, 0, 0) return end color1 = tonumber(r), tonumber(g), tonumber(b) color2 = tonumber(r), tonumber(g), tonumber(b) setVehicleColor(getPedOccupiedVehicle(source), color1, color2) takePlayerMoney(source, 300) dbExec(handler, "UPDATE vehicles SET color1="..tostring(color1).."', color2='"..tostring(color2).." WHERE id ='"..getElementData(vehicle, "Vehicles:ID").."'") end end addCommandHandler("setColor", setCarColor) function setVehicleSpawn(vehicle) if getElementData(vehicle, "owner") and getElementData(source,"Vehicles") and getPedInVehicle(source) and getPedOccupiedVehicleSeat(getPedOccupiedVehicle(source))==0 then x, y, z = getElementPosition(vehicle) rx, ry, rz = getElementRotation(vehicle) col = {getVehicleColor(vehicle)} color1 = toJSON(col[1], col[2], col[3]) color2 = toJSON(col[4], col[5], col[6]) hp = getElementHealth(vehicle) dbExec(handler, "UPDATE vehicles SET x='".. tostring(x).."', y='"..tostring(y)"',z='"..tostring(z).."',rotx='"..tostring(rx)"',roty='"..tostring(ry)"', rotz='"..tostring(rz).."', color1='"..color1.."', color2='"..color2.."', and hp='"..tostring(hp).."WHERE id='"..getElementData(source, "Vehicles:ID").."'") end end addCommandHandler("park", setVehicleSpawn) function fixCar(vehicle, id) local query = dbQuery(handler, "SELECT * FROM vehicles WHERE id='"..id.."' and model='"..getVehicleNameFromModel(vehicle).."'") local result = dbPoll(query, -1) if result >0 then fixVehicle(vehicle) end end addEvent("VS.fix", true) addEventHandler("VS.fix", root, fixCar) function selltheCar(vehicle, id, price) if getElementData(vehicle, "owner") and getElementData(source, "Vehicles") and getPedInVehicle(source) then price = buyTheCar(price) destroyElement(vehicle) givePlayerMoney(source, price/2) dbExec(handler, "DELETE vehicles WHERE id ='"..getElementData(vehicle, "Vehicles:ID").."'") end end addCommandHandler("sellcar", selltheCar) 2 dbExec failed(1) Syntax error near ) 3 dbExec failed no such table
  16. Dimos7

    Sql error

    handler = dbConnect("sqlite", " IZDatabase.db") dbExec(handler, "CREATE TABLE IF NOT EXISTS vehicles(id int(11), model int(3), x decimal(10,6), y decimal(10.6), z decimal(10.6), rotx decimal(10.6), roty decimal(10,6), rotz decimal(10.6), engine int(1), locked int(1), lights int(1), hp float, color1 varchar(50), color2 varchar(50), plate text, owner text, interior int(5), dimension int(5), upgrades varchat(150), headLights varchar(30), variant1 int(3), variant2 int(3)") dbExec(handler, "INSERT INTO vehicles VALUES(model='0', x='0.000000', y='0.000000',z='0.000000', rotx='0.000000', roty='0.000000', rotz='0.000000', engine='0', locked='0', lights='0', hp='100', color1='0', color2='0', interior='0', dimension='0', upgades= '[ [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ]', headLights=' [ [ 255, 255, 255 ] ]', variant1='NULL', variant2='NULL')") function SmallestID() local query = dbQuery(handler, "SELECT MIN(e1.id+1) AS nextID FROM vehicles AS e1 LEFT JOIN vehicles AS e2 ON e1.id+1 = e2.id WHERE e2.id = NULL") local result = dbPoll(query, -1) if result then local id = tonumber(result["nextID"]) or 1 return id end end function buyTheCar(player, vehicle, price) if isElement(source) and source == player and ( not ( isGuestAccount(getPlayerAccount(source)) ) ) then local money = getPlayerMoney(source) local i = 0 if vehicle and price <= money and ( getAccountData(getPlayerAccount(source),"VS.5") == false ) then local x, y, z = getElementPosition(source) local car = createVehicle(vehicle, x, y-5, z) warpPedIntoVehicle(source,car) outputChatBox("You have successfully bought "..getVehicleNameFromModel(vehicle).."!", source, 0, 255, 0) takePlayerMoney(source, price) local vx, vy, vz = getElementPosition(car) local rx, ry, rz = getElementRotation(car) local col = {getVehicleColor(car)} local color1 = toJSON( col[1], col[2], col[3]) local color2 = toJSON( col[4], col[5], col[6]) local latter1 = string.char(math.random(65, 90)) local latter2 = string.char(math.random(65, 90)) local var1, var2 = getVehicleVariant(car) local plate = latter1..latter2..math.random(0,9).." "..math.random(1000,9999) local smallestid = SmallestID() i = i + 1 setVehiclePlateText(car, plate) dbExec(handler, "INSERT INTO vehicles VALUES(id='"..tostring(smallestid).."', model='"..tostring(vehicle).."', x='"..tostring(vx).."', y='"..tostring(vy).."', z='"..tostring(vz).."', rotx='"..tostring(rx).."',roty='".. tostring(ry).."',rotz='"..tostring(rz).."', color1='"..tostring(color1).."', color2='"..tostring(color2).."', owner='"..getplayerName(source).."', plate='"..tostring(plate).."', variant1='"..var1.."', variant2='"..var2.."')") setElementData(source, "Vehicles", i) setElementData(source, "Vehicles:Name", getVehicleNameFromModel(vehicle)) setElementData(vehicle, "Vehicles:ID", smallestid) setElementData(vehicle, "owner", getPlayerName(source)) local account = getPlayerAccount(source) if ( getAccountData(account,"VS.1") == false ) then setAccountData(account,"VS.1",vehicle) outputChatBox("You own now 1 vehicle!",source,0,255,0) elseif ( getAccountData(account,"VS.2") == false ) then setAccountData(account,"VS.2",vehicle) outputChatBox("You own now 2 vehicles!",source,0,255,0) elseif ( getAccountData(account,"VS.3") == false ) then setAccountData(account,"VS.3",vehicle) outputChatBox("You own now 3 vehicles!",source,0,255,0) elseif ( getAccountData(account,"VS.4") == false ) then setAccountData(account,"VS.4",vehicle) outputChatBox("You own now 4 vehicles!",source,0,255,0) elseif ( getAccountData(account,"VS.5") == false ) then setAccountData(account,"VS.5",vehicle) outputChatBox("You own now 5 vehicles and you can't own more vehicles!",source,0,255,0) end elseif ( price > money ) then outputChatBox("You don't have enough money to buy this vehicle!", source, 255, 0, 0) elseif ( not ( getAccountData(getPlayerAccount(source),"VS.5") == false ) ) then outputChatBox("You can't own more than 5 vehicles!",source,255,0,0) end end end addEvent("VS.buy", true) addEventHandler("VS.buy", root, buyTheCar) function spawnTheCar(vehicle, id) local query = dbQuery(handler, "SELECT * FROM vehicles WHERE id='"..id.."', and model='"..getVehicleModelFromName(vehicle).."'") local result = dbPoll(query, -1) local spawned = true if vehicle and id then if result > 0 and spawned == true then destroyElement(vehicle) spawned = false setElementData(vehicle, "spawned", "#FF0000[INACTIVE]") elseif result > 0 and spawned == false then createVehicle(tonumber(result["model"]), tonumber(result["x"]), tonumber(result["y"]), tonumber(result["z"]), tonumber(result["rotx"]), tonumber(result["roty"]), tonumber(result["rotz"]), result["plate"]) setVehicleVariant(vehicle, tonumber(result["variant1"]), tonumber(result["variant2"])) setVehicleColor(vehicle, tonumber(result["color1"]), tonumber(result["color2"])) addVehicleUpgrade(vehicle, tonumber(result["upgades"])) setElementHealth(vehicle, tonumber(result["hp"])) setElementData(vehicle, "spawned", "#00FF00[ACTIVE]") spawned = true end end end addEvent("VS.spawn", true) addEventHandler("VS.spawn", root, spawnTheCar) function upgradeTheCar(vehicle, id, upgrade, price) local query = dbQuery(handler, "SELECT * FROM vehicles WHERE id='"..id.."', and model='"..getVehicleNameFromModel(vehicle).."'") local result = dbPoll(query, -1) local money = getPlayerMoney(source) if result > 0 then if upgrade and price <= money then addVehicleUpgrade(vehicle, upgrade) local var1, var2 = getVehicleVariant(car) dbExec(handler, "UPDATE vehicles SET upgrades='"..tostring(getVehicleUpgrades(vehicle)).."'and variant1='"..var1.."', and variant2='"..var2.." WHERE id='"..id.."'") takePlayerMoney(source, price) elseif upgrade and getVehicleUpgradeSlot(getVehicleUpgradeSlotName(upgrade)) and price then removeVehicleUpgrade(vehicle, upgrade) givePlayerMoney(source, price) local var1, var2 = getVehicleVariant(car) dbExec(handler, "UPDATE vehicles SET upgrades='"..tostring(getVehicleUpgrades(vehicle)).."'and variant1='"..var1.."', and variant2='"..var2.." WHERE id='"..id.."'") elseif price > money then outputChatBox("You don't have enough money to buy this upgrade!", source, 255, 0, 0) end end end addEvent("VS.upgrade", true) addEventHandler("VS.upgade", root, upgradeTheCar) function setCarColor(vehicle, color1, color2) if getElementData(vehicle, "owner") and getElementData(source,"Vehicles") and getPedInVehicle(source) and getPedOccupiedVehicleSeat(getPedOccupiedVehicle(source))==0 then if not color1 or not color2 then outputChatBox("Put color1 (r, g, b) and color2(r,g, b) to change your vehicle color!", source, 255, 0, 0) return end color1 = tonumber(r), tonumber(g), tonumber(b) color2 = tonumber(r), tonumber(g), tonumber(b) setVehicleColor(getPedOccupiedVehicle(source), color1, color2) takePlayerMoney(source, 300) dbExec(handler, "UPDATE vehicles SET color1="..tostring(color1).."', color2='"..tostring(color2).." WHERE id ='"..getElementData(vehicle, "Vehicles:ID").."'") end end addCommandHandler("setColor", setCarColor) function setVehicleSpawn(vehicle) if getElementData(vehicle, "owner") and getElementData(source,"Vehicles") and getPedInVehicle(source) and getPedOccupiedVehicleSeat(getPedOccupiedVehicle(source))==0 then x, y, z = getElementPosition(vehicle) rx, ry, rz = getElementRotation(vehicle) col = {getVehicleColor(vehicle)} color1 = toJSON(col[1], col[2], col[3]) color2 = toJSON(col[4], col[5], col[6]) hp = getElementHealth(vehicle) dbExec(handler, "UPDATE vehicles SET x='".. tostring(x).."', y='"..tostring(y)"',z='"..tostring(z).."',rotx='"..tostring(rx)"',roty='"..tostring(ry)"', rotz='"..tostring(rz).."', color1='"..color1.."', color2='"..color2.."', and hp='"..tostring(hp).."WHERE id='"..getElementData(source, "Vehicles:ID").."'") end end addCommandHandler("park", setVehicleSpawn) function fixCar(vehicle, id) local query = dbQuery(handler, "SELECT * FROM vehicles WHERE id='"..id.."' and model='"..getVehicleNameFromModel(vehicle).."'") local result = dbPoll(query, -1) if result >0 then fixVehicle(vehicle) end end addEvent("VS.fix", true) addEventHandler("VS.fix", root, fixCar) function selltheCar(vehicle, id, price) if getElementData(vehicle, "owner") and getElementData(source, "Vehicles") and getPedInVehicle(source) then price = buyTheCar(price) destroyElement(vehicle) givePlayerMoney(source, price/2) dbExec(handler, "DELETE vehicles WHERE id ='"..getElementData(vehicle, "Vehicles:ID").."'") end end addCommandHandler("sellcar", selltheCar) 2 dbExec failed(1) Syntax error near ) 3 dbExec failed no such table
  17. how to change column type
  18. how i can put the type from something inside a table?
  19. Dimos7

    GUI

    Marker1 = createMarker(321.04, -1965.3171, 17.9757, "cylinder", 4, 255, 255, 0, 255) Marker2 = createMarker(193.7826, 1919.5389, 17.64, "cylinder", 4, 255, 255, 0, 255) local Vehicles = { {"Landstalker", 400}, {"Bravura", 401}, {"Buffalo", 402}, {"Linerunner", 403}, {"Pernniel", 404}, {"Sentiel", 405}, {"Trashmaster", 408}, {"Stretch", 409}, {"Manana", 410}, {"Ifernus", 411}, {"Voodoo", 412}, {"Pony", 413}, {"Mule", 414}, {"Cheetah", 415}, {"Leviathan", 417}, {"Moonbeam", 418}, {"Esperanto", 419}, {"Washington", 421}, {"Bobcat", 422}, {"Mr.Whoopee", 423}, {"BF Injection", 424}, {"Premier", 426}, {"Securicar", 428}, {"Bunshee", 429}, {"Barracks", 433}, {"Hotknife", 434}, {"Previon", 436}, {"Stallion", 439}, {"Rumpo", 440}, {"Romero", 442}, {"Packer", 443}, {"Monster", 444}, {"Admiral", 445}, {"Pizzaboy", 448}, {"Turismo", 451}, {"Flatbed", 455}, {"Yankee", 456}, {"Caddy", 457}, {"Solair", 458}, {"Berkley's RC", 459}, {"Skimmer", 460}, {"PCJ-600", 461}, {"Faggio", 462}, {"Freeway", 463}, {"Glendale", 466}, {"Oceanic", 467}, {"Sanchez", 468}, {"Sparrow", 469}, {"Patriot", 470}, {"Quad", 471}, {"Hermes", 474}, {"Sabre", 475}, {"Rustler", 476}, {"ZR-350", 477}, {"Walton", 478}, {"Regina",479}, {"Comet", 480}, {"BMX", 481}, {"Burrito", 482}, {"Camper", 483}, {"Baggage", 485}, {"Dozer", 486}, {"Maverick", 487}, {"News Maverick", 488}, {"Rancher", 489}, {"Virgo", 491}, {"Greenwood", 492}, {"Hotring Racer", 494}, {"Sandking", 495}, {"Blista Compact", 496}, {"Boxville", 498}, {"Benson", 499}, {"Mesa", 500}, {"Hotring Racer A", 502}, {"Hotring Racer B", 503}, {"Bloodring Banger", 504}, {"Rancher Lure", 505}, {"Super GT", 506}, {"Elegant", 507}, {"Journey", 508}, {"Bike", 509}, {"Mountain Bike", 510}, {"Beagle", 511}, {"Cropduster", 512}, {"Stuntplane", 513}, {"Tanker", 514}, {"Roadtrain", 515}, {"Nebula", 516}, {"Majestic", 517}, {"Buccaneer", 518}, {"Shamal", 519}, {"FCR-900", 521}, {"NRG-500", 522}, {"Cement Truck", 524}, {"Towtruck", 525}, {"Fortune", 526}, {"Cadrona", 527}, {"Willard", 529}, {"forklift", 530}, {"Tractor", 531}, {"Combine Harvester", 532}, {"Feltzer", 533}, {"Remington", 534}, {"Slamvan", 535}, {"Blade", 536}, {"Vincent", 540}, {"Bullet", 541}, {"Clover", 542}, {"Sadler", 543}, {"Huntler", 545}, {"Intruder", 546}, {"Primo", 547}, {"Cargobob", 548}, {"Tampa", 549}, {"Sunrise", 550}, {"Merit", 551}, {"Utility Van", 552}, {"Nevada", 553}, {"Yosemite", 554}, {"Windsor", 555}, {"Moster A", 556}, {"Monster B", 557}, {"Uranus", 558}, {"Jester", 559}, {"Sultan", 560}, {"Stratum", 561}, {"Elegy", 562}, {"Flash", 565}, {"Tahoma", 566}, {"Savana", 567}, {"Bandito", 568}, {"Kart", 571}, {"Mower", 572}, {"Dune", 573}, {"Sweeper", 574}, {"Broadway", 575}, {"Tomado", 576}, {"DFT-30", 578}, {"Huntley", 579}, {"Stafford", 580}, {"BF-400", 581}, {"Newsvan", 582}, {"Tug", 583}, {"Emperor", 585}, {"Wayfarer", 586}, {"Euros", 587}, {"Hotdog", 588}, {"Club", 589}, {"Dodo", 593}, {"Picador", 600}, {"Alpha", 602}, {"Pheonix", 603}, {"Glendale :~", 604}, {"Sadler :~", 605}, } local Prices= { } local GUIEditor = { window = {}, gridlist = {}, column = {}, button = {} } function shop_buyCar() local screenWidth , screenHeight = guiGetScreenSize() local windowWidth, windowHeight = 305, 264 local left, top = screenWidth/2 - windowWidth/2 , screenHeight/2 - windowHeight/2 GUIEditor.window[1] = guiCreateWindow(left, top, windowWidth, windowHeight, "Buy Vehicle", false) guiWindowSetMovable(GUIEditor.window[1], false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.gridlist[1] = guiCreateGridList(9, 21, 568, 201, false, GUIEditor.window[1]) GUIEditor.column[1] = guiGridListAddColum(GUIEditor.gridlist[1], "Vehicles", 0.60) GUIEditor.column[2] = guiGridListAddColum(GUIEditor.gridlist[1], "Prices", 0.60) guiCreateScrollBar(264, 6, 18, 121, false, false, GUIEditor.window[1]) GUIEditor.button[1] = guiCreateButton(19, 233, 37, 19, "Buy", false, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(62, 233, 154, 19, "View the vehicle", false, GUIEditor.window[1]) GUIEditor.button[3] = guiCreateButton(221, 233, 69, 19, "Cancel", false, GUIEditor.window[1]) guiSetVisible(GUIEditor.window[1], true) showCursor(true) for _, v in ipairs(Vehicles) do local row = guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, v[1], false, false) guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, v[2]) end for _, k in ipairs(Prices) do local row = guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, k[1], false, false) guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, k[2]) end end addEventHandler("onClientMarkerHit", Marker1, shop_buyCar) addEventHandler("onClientMarkerHit", Marker2, shop_buyCar) addEventHandler("onClientGUIClick", root, function(button, state) if not GUIEditor.window[1] or not guiGetVisible(GUIEditor.window[1]) then return end if source == GUIEditor.button[1] and button == "left" and state == "up" then if guiGridListGetSelectedItem(GUIEditor.gridlist[1]) == -1 then outputChatBox("Select a vehicle!", 255, 0, 0) return end local vehicleID = guiGridListGetItemData(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 1) local price = tonumber(guiGridListGetItemData(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 1)) triggerServerEvent("buycar", localPlayer, vehicleID, price) guiSetVisible(GUIEditor.window[1], false) showCursor(false) elseif source == GUIEditor.button[2] and button == "left" and state == "up" then if guiGridListGetSelectedItem(GUIEditor.gridlist[1]) == -1 then outputChatBox("Select a vehicle!", 255, 0, 0) return end local vehicleID = guiGridListGetItemData(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 1) local x, y, z = getElementPosition(localPlayer) theVehicle = createVehicle(vehicleID, x, y-5, z) setCameraTarget(theVehicle) setTimer(destoryElement, 5000, 1, theVehicle) setTimer(setCameraTarget, 5000, 1, localPlayer) guiSetVisible(GUIEditor.window[1], false) showCursor(false) elseif source == GUIEditor.button[3] and button == "left" and state == "up" then guiSetVisible(GUIEditor.window[1], false) showCursor(false) end end) addEventHandler("onResourceStart", resourceRoot, function() handler = dbConnect("sqlite", "database.db") end) function buyCar(vehicle, price) if isElement(source) and source == client then local money = getPlayerMoney(source) if vehicle and price <= money then local x, y, z = getElementPosition(source) createVehicle(vehicle, x, y-5, z) outputChatBox("You succefully buy a "..getVheicleNameFromModel(vehicle).." you now own it!", source, 0, 255, 0) takePlayerMoney(source, price) else outputChatBox("You don't have enought money for buy this vehicle!", source, 255, 0, 0) end end end addEvent("buycar", true) addEventHandler("buycar", root, buyCar) attemept call guiGridListAddComuln a nill value
  20. that you can do it with that string.len
  21. Dimos7

    Question

    i need add something in meta so browser work and find the script?
×
×
  • Create New...