Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local connection = exports['mta_connection']:getConnection()
- function buyVehicle(player, modellID, r, g, b, money, jelenVeh)
- if isElement(player) then
- if (tonumber(player:getData("char:money") or 0) >= tonumber(money)) then
- local myCars = 0
- for _, value in ipairs(getElementsByType("vehicle")) do
- if value:getData("veh:owner") == player:getData("acc:id") then
- myCars = myCars+1
- end
- end
- if tonumber(myCars) < tonumber(player:getData("char:vehSlot")) then
- x,y,z = 2256.7829589844, -1116.6042480469, 48.75
- local carshopPos = {
- {2135.1296386719, -1146.6275634766, 24.613170623779},
- {2135.3054199219, -1138.3544921875, 25.508316040039},
- {2135.8127441406, -1129.4816894531, 25.634937286377},
- {2120.1853027344, -1126.1196289063, 25.40358543396},
- {2119.8137207031, -1135.6446533203, 25.232713699341},
- {2118.9714355469, -1147.2834472656, 24.354309082031},
- {2117.9084472656, -1156.5870361328, 24.24542427063},
- }
- local randed = math.random(1, #carshopPos)
- local pos = toJSON({carshopPos[randed][1], carshopPos[randed][2], carshopPos[randed][3], 0 ,0})
- local insterT = dbQuery(connection, "INSERT INTO vehicle SET pos=?,model=?,owner=?,color=?, fuel=?",
- pos,modellID,getElementData(player,"acc:id"),toJSON({r, g, b, 0, 0, 0}), 10)
- local QueryEredmeny, _, Beszurid = dbPoll(insterT, -1)
- if QueryEredmeny then
- exports["mta_vehicle"]:addVehicle(getElementData(player,"acc:id"), modellID, carshopPos[randed][1], carshopPos[randed][2], carshopPos[randed][3], Beszurid, r, g, b)
- triggerClientEvent(player,"returnVasarlas",player,Beszurid)
- dbExec(connection,"UPDATE characters SET money = ? WHERE id = ?", player:getData("char:money")-money, getElementData(player,"acc:id"))
- player:setData("char:money",player:getData("char:money")-money)
- exports.mta_item:giveItem(player, 34, Beszurid, 1,0)
- end
- else
- outputChatBox("#7cc576[ExternalGaming - Carshop] #ffffffNincs elég #F7CA18'Slotod'#ffffff a vásárláshoz.",player,255,255,255,true)
- end
- else
- outputChatBox("#7cc576[ExternalGaming - Carshop] #ffffffNincs elég #87D37C'Kézpénzed'#ffffff a vásárláshoz.",player,255,255,255,true)
- end
- end
- end
- addEvent("buyVehicleSever", true)
- addEventHandler("buyVehicleSever", root, buyVehicle)
- function buyVehiclePP(player, modellID, r, g, b, money, jelenVeh)
- if isElement(player) then
- if (tonumber(player:getData("char:pp")) >= tonumber(money)) then
- local myCars = 0
- for _, value in ipairs(getElementsByType("vehicle")) do
- if value:getData("veh:owner") == player:getData("acc:id") then
- myCars = myCars+1
- end
- end
- if tonumber(myCars) < tonumber(player:getData("char:vehSlot")) then
- x,y,z = 2255.8427734375, -1125.1579589844, 48.75
- --player:setData("char:pp",player:getData("char:pp") - money)
- local pos = toJSON({x,y,z, 0 ,0})
- local insterT = dbQuery(connection, "INSERT INTO vehicle SET pos=?,model=?,owner=?,color=?, fuel=?",
- pos,modellID,getElementData(player,"acc:id"),toJSON({r, g, b, 0, 0, 0}), 10)
- local QueryEredmeny, _, Beszurid = dbPoll(insterT, -1)
- if QueryEredmeny then
- exports["mta_vehicle"]:addVehicle(getElementData(player,"acc:id"), modellID, x, y, z, Beszurid, r, g, b)
- triggerClientEvent(player,"returnVasarlas",player,Beszurid)
- dbExec(connection,"UPDATE characters SET premiumpont = ? WHERE id = ?", player:getData("char:pp")-money, getElementData(player,"acc:id"))
- player:setData("char:pp",player:getData("char:pp") - money)
- exports.mta_item:giveItem(player, 34, Beszurid, 1,0)
- end
- else
- outputChatBox("#7cc576[ExternalGaming - Carshop] #ffffffNincs elég #F7CA18'Slotod'#ffffff a vásárláshoz.",player,255,255,255,true)
- end
- else
- outputChatBox("#7cc576[ExternalGaming - Carshop] #ffffffNincs elég #19B5FE'PrémiumPontot'#ffffff a vásárláshoz.",player,255,255,255,true)
- end
- end
- end
- addEvent("buyVehiclePPSever", true)
- addEventHandler("buyVehiclePPSever", root, buyVehiclePP)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement