kecskebeka Posted December 10, 2016 Share Posted December 10, 2016 Hi, Im create carshop and perfect all but after shopping not change on mysql.. This Server local connection = exports['mx_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:tulajdonos") == player:getData("acc.AccountID") then myCars = myCars+1 end end if tonumber(myCars) then x,y,z = 2119.8017578125, -1129.298828125, 25.36576461792 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 jarmuvek SET pos=?,model=?,tulajdonos=?,jarmuSzine=?, uzemanyag=?", pos,modellID,getElementData(player,"acc.AccountID"),toJSON({r, g, b, 0, 0, 0}), 10) local QueryEredmeny, _, Beszurid = dbPoll(insterT, -1) if QueryEredmeny then exports["mx_vehicle"]:addVehicle(getElementData(player,"acc.AccountID"), modellID, carshopPos[randed][1], carshopPos[randed][2], carshopPos[randed][3], Beszurid, r, g, b) triggerClientEvent(player,"returnVasarlas",player,Beszurid) dbExec(connection,"UPDATE karakterek SET keszpenz = ? WHERE id = ?", player:getData("char.Money")-money, getElementData(player,"acc.AccountID")) player:setData("char.Money",player:getData("char.Money")-money) exports.mx_item:giveItem(player, 33, Beszurid, 1,0) end else outputChatBox("#7cc576[Carshop] #ffffffNincs elég #F7CA18'Slotod'#ffffff a vásárláshoz.",player,255,255,255,true) end else outputChatBox("#7cc576[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:tulajdonos") == player:getData("acc.AccountID") then myCars = myCars+1 end end if tonumber(myCars) < tonumber(player:getData("char:vehSlot")) then x,y,z = 2134.0712890625, -1134.2509765625, 25.688035964966 --player:setData("char:pp",player:getData("char:pp") - money) local pos = toJSON({x,y,z, 0 ,0}) local insterT = dbQuery(connection, "INSERT INTO jarmuvek SET pos=?,model=?,tulajdonos=?,jarmuSzine=?, uzemanyag=?", pos,modellID,getElementData(player,"acc.AccountID"),toJSON({r, g, b, 0, 0, 0}), 10) local QueryEredmeny, _, Beszurid = dbPoll(insterT, -1) if QueryEredmeny then exports["mx_vehicle"]:addVehicle(getElementData(player,"acc.AccountID"), modellID, x, y, z, Beszurid, r, g, b) triggerClientEvent(player,"returnVasarlas",player,Beszurid) dbExec(connection,"UPDATE karakterek SET premiumpont = ? WHERE id = ?", player:getData("char:pp")-money, getElementData(player,"acc.AccountID")) player:setData("char:pp",player:getData("char:pp") - money) exports.mx_item:giveItem(player, 33, Beszurid, 1,0) end else outputChatBox("#7cc576[Carshop] #ffffffNincs elég #F7CA18'Slotod'#ffffff a vásárláshoz.",player,255,255,255,true) end else outputChatBox("#7cc576[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) This Client: local kepernyom = {guiGetScreenSize()} local panelSize = {300, 450} local panelPosX, panelPosY = kepernyom[1]/2-panelSize[1]/2, kepernyom[2]/2-panelSize[2]/2 local font = dxCreateFont("files/myriadproregular.ttf",9) --<[ Font ]>-- local font2 = dxCreateFont("files/myriadproregular.ttf",10) --<[ Font ]>-- local text = "#7cc576Városi autókereskedés" local camPos = {} camPos[1] = {} -- Campos[érték] táblázata camPos[1]["start"] = {2117.1394042969, 1930.1237792969, 12.522399902344, 2117.4519042969, 1929.2436523438, 12.165108680725} camPos[1]["end"] = {2119.7707519531, 1922.1798095703, 14.212400436401, 2119.9575195313, 1921.6706542969, 13.372242927551} camPos[1]["speed"] = 10000 camPos[1]["type"] = "Linear" camPos[2] = {} -- Campos[érték] táblázata camPos[2]["start"] = {2115.9931640625, 1921.560546875, 12.436599731445, 2116.76171875, 1921.1206054688, 11.972104072571} camPos[2]["end"] = {2116.98828125, 1910.9344482422, 12.907899856567, 2117.64453125, 1911.5268554688, 12.4404296875} camPos[2]["speed"] = 10000 camPos[2]["type"] = "Linear" camPos[3] = {} -- Campos[érték] táblázata camPos[3]["start"] = {2124.7902832031, 1907.1014404297, 12.116200447083, 2124.4919433594, 1908.0008544922, 11.796879768372} camPos[3]["end"] = {2123.3288574219, 1911.525390625, 13.788800239563, 2123.1123046875, 1912.1856689453, 13.069684028625} camPos[3]["speed"] = 10000 camPos[3]["type"] = "Linear" camPos[4] = {} -- Campos[érték] táblázata camPos[4]["start"] = {2128.9689941406, 1913.9185791016, 12.037300109863, 2128.03515625, 1914.1320800781, 11.750021934509} camPos[4]["end"] = {2124.8413085938, 1924.1318359375, 12.609900474548, 2124.29296875, 1923.3881835938, 12.227615356445} camPos[4]["speed"] = 10000 camPos[4]["type"] = "Linear" camPos[5] = {} -- Campos[érték] táblázata camPos[5]["start"] = {2118.3969726563, 1926.8110351563, 15.134300231934, 2118.6647949219, 1925.9877929688, 14.633818626404} camPos[5]["end"] = {2124.4533691406, 1907.7374267578, 15.519700050354, 2124.2072753906, 1908.5101318359, 14.9345703125} camPos[5]["speed"] = 10000 camPos[5]["type"] = "Linear" local carposX, carposY, carposZ = 2121.0258789063, 1917.3940429688, 10.03120803833 local panelType = "CarShop" local camID = 0 local selectedColor = 0 local lastCamTick = 0 local camFading = 0 -- 1 Fekete, 2 Színezett local Jelenkocsi = 0 local statisztikaSzazaleka = 0 local statisztikaMaximumok = { -- Sebesség, Gyorsulás, Vezérlés, fékek 32, 21.8, 1, 1 } local color = {--Szín ,Összeg {255, 255, 255,50}, {0, 0, 0,50}, {0,102,255,50}, {255, 204, 0,50}, {51, 204, 51,50}, {255, 0, 0,50}, {219, 10, 91,50}, } local ped = {} local Tick = getTickCount() local pedPos = { {200, 2131.798828125, -1151.013671875, 24.093935012817, "Josh"} } local create = false function pedLetrehozas() for index,value in ipairs (pedPos) do if isElement(ped[index]) then destroyElement(ped[index]) end ped[index] = createPed(value[1], value[2], value[3], value[4]) ped[index]:setData("carshop-->Ped", true) setElementFrozen(ped[index], true) ped[index]:setData("Ped:Name",value[5]) ped[index]:setData("name:tags", "Járműeladó") end end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), pedLetrehozas) function pedKill() if getElementData(source, "carshop-->Ped") then cancelEvent() end end addEventHandler("onClientPedDamage", getRootElement(), pedKill) function onPedKatt(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement) if clickedElement and button == "right" and state == "down" and getElementData(clickedElement, "carshop-->Ped") and getElementType(clickedElement) == "ped" and not create then addEventHandler("onClientRender", root, createCarshopPanel) create = true showChat(false) setElementData(localPlayer, "toggle-->All", false) Tick = getTickCount() progress = "Linear" setElementFrozen(localPlayer, true) setElementDimension(localPlayer, localPlayer:getData("acc.AccountID")) camID = math.random(1,#camPos) setCameraMatrix(camPos[camID]["start"][1],camPos[camID]["start"][2],camPos[camID]["start"][3],camPos[camID]["start"][4],camPos[camID]["start"][5],camPos[camID]["start"][6]) lastCamTick = getTickCount () createVehicleFunction () addEventHandler ("onClientPreRender",getRootElement(),updateCamPosition) elseif clickedElement and button == "right" and state == "down" and getElementData(clickedElement, "carshop-->Ped") and getElementType(clickedElement) == "ped" and create then removeEventHandler("onClientRender", root, createCarshopPanel) create = false showChat(true) setElementData(localPlayer, "toggle-->All", true) setElementFrozen(localPlayer, false) removeEventHandler ("onClientPreRender",getRootElement(),updateCamPosition) end if create and button == "left" and state == "down" and panelType == "CarShop" then for index, value in ipairs (color) do if dobozbaVan(Size2-7+index*35, panelPosY+398, 32, 32, absoluteX, absoluteY) then setVehicleColor(car, value[1], value[2], value[3]) selectedColor = index end end elseif create and button == "left" and state == "down" and panelType == "Vasarlas" then if dobozbaVan(kepernyom[1]/2-300/2+15, kepernyom[2]/2-200/2+160, 100, 25, absoluteX, absoluteY) then if getVehicleLimits(sellVehicle[Jelenkocsi][1]) >= sellVehicle[Jelenkocsi][5] and sellVehicle[Jelenkocsi][5] > 0 then panelType = "CarShop" text = "#D24D57[Carshop] #ffffffSajnos ez a kocsi limites." setTimer(function () text = "#7cc576Városi autókereskedés" end, 5000, 1) elseif getVehicleLimits(sellVehicle[Jelenkocsi][1]) < sellVehicle[Jelenkocsi][5] or sellVehicle[Jelenkocsi][5] == 0 then local amount = sellVehicle[Jelenkocsi][3] + color[selectedColor][4] triggerServerEvent("buyVehicleSever", localPlayer, localPlayer, sellVehicle[Jelenkocsi][1], color[selectedColor][1], color[selectedColor][2], color[selectedColor][3], amount, Jelenkocsi) panelType = "CarShop" end elseif dobozbaVan(kepernyom[1]/2-300/2+300-115, kepernyom[2]/2-200/2+160, 100, 25, absoluteX, absoluteY) then local pp = sellVehicle[Jelenkocsi][4] + color[selectedColor][4] triggerServerEvent("buyVehiclePPSever", localPlayer, localPlayer, sellVehicle[Jelenkocsi][1], color[selectedColor][1], color[selectedColor][2], color[selectedColor][3] , pp, Jelenkocsi) panelType = "CarShop" end end end addEventHandler("onClientClick", getRootElement(), onPedKatt) addEvent("returnVasarlas",true) addEventHandler("returnVasarlas",root,function(vehID) text = "#87D37C[Carshop] #ffffffSikeresen megvásároltad a járművet. ID: #19B5FE"..vehID setTimer(function() text = "#7cc576Városi autókereskedés" end, 3000, 1) end) function createVehicleFunction () if isElement(car) then destroyElement(car) end Jelenkocsi = math.random(1, #sellVehicle) car = createVehicle(sellVehicle[Jelenkocsi][1],carposX, carposY, carposZ) randomcolor = math.random(1, #color) setVehicleColor(car, color[randomcolor][1], color[randomcolor][2], color[randomcolor][3], 0, 0 ,0) --setElementDimension(car, localPlayer:getData("acc.AccountID")) setElementRotation(car, 0, 0, 20) end function createCarshopPanel () if panelType == "CarShop" then Time = (getTickCount() - Tick) / 1500 Size2 = interpolateBetween(0-panelSize[1],0,0,panelPosX-panelPosX+10,0,0,Time,progress) dxDrawRectangle(Size2, panelPosY, panelSize[1], panelSize[2], tocolor(0, 0, 0, 180)) dxDrawRectangle(Size2, panelPosY, panelSize[1], panelSize[2]-425, tocolor(0, 0, 0, 230)) dxDrawRectangle(Size2, panelPosY+panelSize[2], panelSize[1], panelSize[2]-425, tocolor(0, 0, 0, 230)) dxDrawText("#7cc576Jármű adatok",Size2+5, panelPosY+5, panelSize[1], panelSize[2]-425, tocolor(255, 255, 255, 255),1, font, "left", "top", false, false, false, true) --<[ Felirat kiírás ]>-- dxDrawText("Bezárás a #D24D57'backspace' #ffffffa vásárlás az #87D37C'enter'#ffffff gombbal.",Size2+15, panelPosY+5+panelSize[2], panelSize[1], panelSize[2]-425, tocolor(255, 255, 255, 255),1, font, "left", "top", false, false, false, true) --<[ Felirat kiírás ]>-- if Jelenkocsi <= 0 then Jelenkocsi = 1 end if(statisztikaSzazaleka < 1) then statisztikaSzazaleka = statisztikaSzazaleka + 0.01 end --Sebesség dxDrawText("Sebesség:", Size2+200/2+20, panelPosY+40, panelSize[1], panelSize[2]-425, tocolor(255, 255, 255,255), 1.0, font2, "left", "top", false, false, false,true) --<[ Felirat kiírás ]>-- local handlingInfo = getVehicleHandling (car) local statcsik_csik = handlingInfo["engineAcceleration"]/handlingInfo["dragCoeff"]/statisztikaMaximumok[1] statcsik_csik = math.min(statcsik_csik, statisztikaSzazaleka) local statcsikCsikSzazalek = statcsik_csik*200 dxDrawRectangle(Size2+50,panelPosY+60,200,16,tocolor(0, 0, 0,255)) dxDrawRectangle(Size2+53,panelPosY+63,statcsikCsikSzazalek-5,10,tocolor(124, 197, 118,255/1.3)) -- Gyorsulás dxDrawText("Gyorsulás:", Size2+200/2+20, panelPosY+90, panelSize[1], panelSize[2]-425, tocolor(255, 255, 255,255), 1.0, font2, "left", "top", false, false, false,true) --<[ Felirat kiírás ]>-- local statcsik_csik = handlingInfo["engineAcceleration"]/statisztikaMaximumok[2] statcsik_csik = math.min(statcsik_csik, statisztikaSzazaleka) local statcsikCsikSzazalek = statcsik_csik*200 dxDrawRectangle(Size2+50,panelPosY+110,200,16,tocolor(0, 0, 0,255)) dxDrawRectangle(Size2+53,panelPosY+113,statcsikCsikSzazalek-5,10,tocolor(124, 197, 118,255/1.3)) -- Vezérlés dxDrawText("Vezérlés:", Size2+200/2+20, panelPosY+140, panelSize[1], panelSize[2]-425, tocolor(255, 255, 255,255), 1.0, font2, "left", "top", false, false, false,true) --<[ Felirat kiírás ]>-- local statcsik_csik = ((handlingInfo["tractionLoss"]*handlingInfo["tractionBias"])*(handlingInfo["tractionMultiplier"]))/statisztikaMaximumok[3] statcsik_csik = math.min(statcsik_csik, statisztikaSzazaleka) local statcsikCsikSzazalek3 = statcsik_csik*150 dxDrawRectangle(Size2+50,panelPosY+160,200,16,tocolor(0, 0, 0,255)) dxDrawRectangle(Size2+53,panelPosY+163,statcsikCsikSzazalek-5,10,tocolor(124, 197, 118,255/1.3)) -- Fékek dxDrawText("Fékek:", Size2+200/2+20, panelPosY+190, panelSize[1], panelSize[2]-425, tocolor(255, 255, 255,255), 1.0, font2, "left", "top", false, false, false,true) --<[ Felirat kiírás ]>-- local statcsik_csik = handlingInfo["brakeDeceleration"]/handlingInfo["brakeBias"]/statisztikaMaximumok[4] statcsik_csik = math.min(statcsik_csik, statisztikaSzazaleka) local statcsikCsikSzazalek3 = statcsik_csik*150 dxDrawRectangle(Size2+50,panelPosY+210,200,16,tocolor(0, 0, 0,255)) dxDrawRectangle(Size2+53,panelPosY+213,statcsikCsikSzazalek-5,10,tocolor(124, 197, 118,255/1.3)) local Wheel = "" local Wheels = handlingInfo["driveType"] if Wheels == "awd" then Wheel = "Összkerék" elseif Wheels == "rwd" then Wheel = "Hátsókerék" elseif Wheels == "fwd" then Wheel = "Elsőkerék" end dxDrawText("Tipus: #7cc576"..sellVehicle[Jelenkocsi][2], Size2+50, panelPosY+240, panelSize[1], panelSize[2]-425, tocolor(255, 255, 255,255), 1.0, font2, "left", "top", false, false, false,true) --<[ Felirat kiírás ]>-- dxDrawText("Ára: #7cc576"..penz_darabolas(sellVehicle[Jelenkocsi][3]) .. " $ #ffffff PrémiumPont: #7cc576"..penz_darabolas(sellVehicle[Jelenkocsi][4]).. " PP", Size2+50, panelPosY+270, panelSize[1], panelSize[2]-425, tocolor(255, 255, 255,255), 1.0, font2, "left", "top", false, false, false,true) --<[ Felirat kiírás ]>-- dxDrawText("Kerék: #7cc576"..Wheel, Size2+50, panelPosY+300, panelSize[1], panelSize[2]-425, tocolor(255, 255, 255,255), 1.0, font2, "left", "top", false, false, false,true) --<[ Felirat kiírás ]>-- --dxDrawText("Üzemanyag: #7cc576"..handlingInfo["engineType"], Size2+50, panelPosY+330, panelSize[1], panelSize[2]-425, tocolor(255, 255, 255,255), 1.0, font2, "left", "top", false, false, false,true) --<[ Felirat kiírás ]>-- dxDrawText("Váltó: #7cc576"..handlingInfo["numberOfGears"].. " fokozatú", Size2+50, panelPosY+330, panelSize[1], panelSize[2]-425, tocolor(255, 255, 255,255), 1.0, font2, "left", "top", false, false, false,true) --<[ Felirat kiírás ]>-- if sellVehicle[Jelenkocsi][5] > 0 then local color = "" if getVehicleLimits(sellVehicle[Jelenkocsi][1]) >= sellVehicle[Jelenkocsi][5] then color = "#D24D57" else color = "#7cc576" end dxDrawText("Limit: ".. color .. getVehicleLimits(sellVehicle[Jelenkocsi][1]).. " #ffffff/ #7cc576"..sellVehicle[Jelenkocsi][5], Size2+50, panelPosY+360, panelSize[1], panelSize[2]-425, tocolor(255, 255, 255,255), 1.0, font2, "left", "top", false, false, false,true) --<[ Felirat kiírás ]>-- else dxDrawText("Ezen a járművön #F5D76Enincs #fffffflimit!", Size2+50, panelPosY+360, panelSize[1], panelSize[2]-425, tocolor(255, 255, 255,255), 1.0, font2, "left", "top", false, false, false,true) --<[ Felirat kiírás ]>-- end dxDrawText("Színek:", Size2+200/2+25, panelPosY+380, panelSize[1], panelSize[2]-425, tocolor(255, 255, 255,255), 1.0, font2, "left", "top", false, false, false,true) --<[ Felirat kiírás ]>-- for index, value in ipairs (color) do if isInSlot(Size2-5+index*35, panelPosY+400, 30, 30) then dxDrawRectangle(Size2-7+index*35, panelPosY+398, 32, 32, tocolor(value[1], value[2], value[3])) else dxDrawRectangle(Size2-5+index*35, panelPosY+400, 30, 30, tocolor(value[1], value[2], value[3])) end end local width = dxGetTextWidth( text, 1, font ) + 20 Time = (getTickCount() - Tick) / 1500 Size1 = interpolateBetween(0,0,0,kepernyom[1]/2-width/2,0,0,Time,progress) dxDrawRectangle(Size1, 10, width, 25, tocolor(0, 0, 0, 200)) dxDrawText(text,Size1+width/2, 10+5, Size1+width/2, 25, tocolor(255, 255, 255, 255),1, font, "center", "top", false, false, false, true) --<[ Felirat kiírás ]>-- elseif panelType == "Vasarlas" then dxDrawRectangle(kepernyom[1]/2-300/2, kepernyom[2]/2-200/2, 300, 200, tocolor(0, 0, 0, 200)) dxDrawRectangle(kepernyom[1]/2-300/2, kepernyom[2]/2-200/2, 300, 25, tocolor(0, 0, 0, 230)) dxDrawText("#7cc576Vásárlás",kepernyom[1]/2-300/2+5, kepernyom[2]/2-200/2+5, panelSize[1], panelSize[2]-425, tocolor(255, 255, 255, 255),1, font, "left", "top", false, false, false, true) --<[ Felirat kiírás ]>-- dxDrawText("Tipus: #7cc576"..sellVehicle[Jelenkocsi][2], kepernyom[1]/2-300/2+5, kepernyom[2]/2-200/2+30, panelSize[1], panelSize[2]-425, tocolor(255, 255, 255,255), 1.0, font2, "left", "top", false, false, false,true) --<[ Felirat kiírás ]>-- dxDrawText("Ára: #7cc576"..penz_darabolas(sellVehicle[Jelenkocsi][3]) .. " $", kepernyom[1]/2-300/2+5, kepernyom[2]/2-200/2+50, panelSize[1], panelSize[2]-425, tocolor(255, 255, 255,255), 1.0, font2, "left", "top", false, false, false,true) --<[ Felirat kiírás ]>-- dxDrawText("PrémiumPont: #7cc576"..penz_darabolas(sellVehicle[Jelenkocsi][4]).. " PP", kepernyom[1]/2-300/2+5, kepernyom[2]/2-200/2+70, panelSize[1], panelSize[2]-425, tocolor(255, 255, 255,255), 1.0, font2, "left", "top", false, false, false,true) --<[ Felirat kiírás ]>-- dxDrawText("Szín: #7cc576", kepernyom[1]/2-300/2+5, kepernyom[2]/2-200/2+100, panelSize[1], panelSize[2]-425, tocolor(255, 255, 255,255), 1.0, font2, "left", "top", false, false, false,true) --<[ Felirat kiírás ]>-- dxDrawRectangle( kepernyom[1]/2-300/2+40, kepernyom[2]/2-200/2+95, 30, 30, tocolor(color[selectedColor][1], color[selectedColor][2], color[selectedColor][3])) if isInSlot(kepernyom[1]/2-300/2+15, kepernyom[2]/2-200/2+160, 100, 25) then dxDrawRectangle(kepernyom[1]/2-300/2+15, kepernyom[2]/2-200/2+160, 100, 25, tocolor(124, 197, 118, 200)) dxDrawText("Készpénz", kepernyom[1]/2-300/2+15, kepernyom[2]/2-200/2+160, 100 + kepernyom[1]/2-300/2+15, 25 + kepernyom[2]/2-200/2+160, tocolor(0, 0, 0,255), 1.0, font2, "center", "center", false, false, false,true) --<[ Felirat kiírás ]>-- else dxDrawRectangle(kepernyom[1]/2-300/2+15, kepernyom[2]/2-200/2+160, 100, 25, tocolor(0, 0, 0, 200)) dxDrawText("Készpénz", kepernyom[1]/2-300/2+15, kepernyom[2]/2-200/2+160, 100 + kepernyom[1]/2-300/2+15, 25 + kepernyom[2]/2-200/2+160, tocolor(255, 255, 255,255), 1.0, font2, "center", "center", false, false, false,true) --<[ Felirat kiírás ]>-- end if isInSlot(kepernyom[1]/2-300/2+300-115, kepernyom[2]/2-200/2+160, 100, 25) then dxDrawRectangle(kepernyom[1]/2-300/2+300-115, kepernyom[2]/2-200/2+160, 100, 25, tocolor(25, 181, 254, 200)) dxDrawText("PrémiumPont", kepernyom[1]/2-300/2+300-115, kepernyom[2]/2-200/2+160, 100 + kepernyom[1]/2-300/2+300-115, 25 + kepernyom[2]/2-200/2+160, tocolor(0, 0, 0,255), 1.0, font2, "center", "center", false, false, false,true) --<[ Felirat kiírás ]>-- else dxDrawRectangle(kepernyom[1]/2-300/2+300-115, kepernyom[2]/2-200/2+160, 100, 25, tocolor(0, 0, 0, 200)) dxDrawText("PrémiumPont", kepernyom[1]/2-300/2+300-115, kepernyom[2]/2-200/2+160, 100 + kepernyom[1]/2-300/2+300-115, 25 + kepernyom[2]/2-200/2+160, tocolor(255, 255, 255,255), 1.0, font2, "center", "center", false, false, false,true) --<[ Felirat kiírás ]>-- end end end function getVehicleLimits(vehicleID) local ammount = 0 local breake = false for i, v in ipairs (getElementsByType("vehicle")) do if getElementModel(v) == vehicleID then ammount = ammount + 1 if ammount > 1 then breake = true end if ammount == 1 and breake then break end end end ammount = ammount -1 return ammount end function penz_darabolas(amount) local formatted = amount while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1.%2') if (k==0) then break end end return formatted end local stoped = false local stop = false addEventHandler("onClientKey", root, function(k,v) if not create then return end if k == "backspace" and v then if panelType == "CarShop" then if isElement(car) then destroyElement(car) end removeEventHandler("onClientRender", root, createCarshopPanel) create = false showChat(true) setElementData(localPlayer, "toggle-->All", true) setElementFrozen(localPlayer, false) setCameraTarget(localPlayer, true) fadeCamera (true,2) setElementDimension(localPlayer, 0) removeEventHandler ("onClientPreRender",getRootElement(),updateCamPosition) statisztikaSzazaleka = 0 selectedColor = 0 else panelType = "CarShop" end if isTimer(timer) then return end timer = setTimer(function() end, 300, 1) elseif k == "arrow_l" and not stoped and panelType == "CarShop" then if Jelenkocsi > 0 then Jelenkocsi = Jelenkocsi - 1 stoped = true else Jelenkocsi = 1 end setTimer(function() setElementModel(car, sellVehicle[Jelenkocsi][1]) statisztikaSzazaleka = 0 stoped = false end , 300, 1 ) elseif k == "arrow_r" and not stoped and panelType == "CarShop" then if Jelenkocsi < #sellVehicle then Jelenkocsi = Jelenkocsi + 1 stoped = true else Jelenkocsi = 1 end setTimer(function() setElementModel(car, sellVehicle[Jelenkocsi][1]) statisztikaSzazaleka = 0 stoped = false end , 300, 1 ) elseif k == "enter" and not stop then if panelType == "CarShop" then if selectedColor > 0 then panelType = "Vasarlas" else text = "#D24D57[Carshop] #ffffffVálasz színt a kocsinak." stop = true setTimer(function () text = "#7cc576Városi autókereskedés" stop = false end, 3000, 1 ) end end end end) function updateCamPosition () if camPos[camID] then local cTick = getTickCount () local delay = cTick - lastCamTick local duration = camPos[camID]["speed"] local easing = camPos[camID]["type"] if duration and easing then local progress = delay/duration if progress < 1 then local cx,cy,cz = interpolateBetween ( camPos[camID]["start"][1],camPos[camID]["start"][2],camPos[camID]["start"][3], camPos[camID]["end"][1],camPos[camID]["end"][2],camPos[camID]["end"][3], progress,easing ) local tx,ty,tz = interpolateBetween ( camPos[camID]["start"][4],camPos[camID]["start"][5],camPos[camID]["start"][6], camPos[camID]["end"][4],camPos[camID]["end"][5],camPos[camID]["end"][6], progress,easing ) setCameraMatrix (cx,cy,cz,tx,ty,tz) if camFading == 0 then local left = duration-delay if left <= 3000 then -- Ez kezd sötétedni camFading = 1 fadeCamera (false,3,0,0,0) end elseif camFading == 2 then -- színezett local left = duration-delay if left >= 2000 then camFading = 0 end end else local nextID = false while nextID == false do local id = camID + 1 if id ~= camID then nextID = id end if id > # camPos then nextID = 1 end end camFading = 2 fadeCamera (true,2) lastCamTick = getTickCount () camID = nextID setCameraMatrix (camPos[camID]["start"][1],camPos[camID]["start"][2],camPos[camID]["start"][3],camPos[camID]["start"][4],camPos[camID]["start"][5],camPos[camID]["start"][6]) end end end end function dobozbaVan(dX, dY, dSZ, dM, eX, eY) if(eX >= dX and eX <= dX+dSZ and eY >= dY and eY <= dY+dM) then return true else return false end end function isInSlot(xS,yS,wS,hS) if(isCursorShowing()) then XY = {guiGetScreenSize()} local cursorX, cursorY = getCursorPosition() cursorX, cursorY = cursorX*XY[1], cursorY*XY[2] if(dobozbaVan(xS,yS,wS,hS, cursorX, cursorY)) then return true else return false end end end Why not modify on mysql after shopping? Mysql connect: OK. Car spawn: OK. Car key spawn and operation ( perfect close - open door ) : OK. Please help me thx Link to comment
Administrators Lpsd Posted December 10, 2016 Administrators Share Posted December 10, 2016 Check your logs https://wiki.multitheftauto.com/wiki/DbQuery Tip: The server command debugdb 2 will output verbose information on each query to a logging file (usually logs/db.log) https://wiki.multitheftauto.com/wiki/Server_Commands#debugdb Link to comment
kecskebeka Posted December 10, 2016 Author Share Posted December 10, 2016 Log clear.. nothing error.. Link to comment
pa3ck Posted December 10, 2016 Share Posted December 10, 2016 What does not get updated in MySQL? dbExec(connection,"UPDATE karakterek SET premiumpont = ? WHERE id = ?", player:getData("char:pp")-money, getElementData(player,"acc.AccountID")) If you are talking about the "premiumpont", you are just getting the "char:pp" but shouldn't you also subtract the price of the car? Like player:getData("char:pp") - 15000? Link to comment
kecskebeka Posted December 10, 2016 Author Share Posted December 10, 2016 (edited) Edited December 10, 2016 by kecskebeka 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now