![](https://forum.multitheftauto.com/uploads/set_resources_22/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
Firespider
Members-
Posts
238 -
Joined
-
Last visited
Everything posted by Firespider
-
I will testing tommorow but thanks
-
function tp(player, cmd, ID) if getElementData(player, "Player.AdminLevel") > 1 then local players = getElementsByType ( "player" ) if tonumber(ID) then for i, p in ipairs(players) do print(getElementData(p, "Player.ID")) if getElementData(p, "Player.ID") == tonumber(ID) then local x, y, z = getElementPosition(p) setElementPosition(player, x, y, z) else outputChatBox("#000000<#910e07Wise#ffffffRolePlay#000000> #ffffff Rossz ID-t adtál meg.", player, 255, 255, 255, true) end end end end end
-
I deleted the break and it was fine, but it always says 3 times that I entered the wrong ID, but the commands still work
-
So I threw my previous code into the SQL bin? What did I send?
-
Could you explain what this code does?
-
At each entry, you set a SetElementData for the value of the ID table
-
This is how I add the ID to the player addEventHandler("onPlayerJoin", root, function () local serial = getPlayerSerial(source) local player = source local dq = dbQuery(db, "SELECT * FROM characters WHERE serial=?", serial) local result = dbPoll(dq, 250) -- Ne korlátozd az eredmények számát if result and #result > 0 then -- Az adatbázisban a munkát tároló oszlop neve local name = tostring(result[1]["name"]) local WhitoutSpace = string.gsub(name, " ", "_") local id = result[1]["ID"] pos = fromJSON(result[1]["pos"]) local skin = result[1]["skinID"] local money = result[1]["Money"] setPlayerMoney(player, money) setElementData(player, "Player.ID", id) local data = getElementData(player, "Player.ID") setPlayerName(player, WhitoutSpace) setElementModel(player, skin) setElementPosition(player, pos[1], pos[2], pos[3]) end end )
-
So I have the problem that every player gets an ID with setElementData when, for example, ID 1 appears based on the primary row of the SQL table But when the command is entered on the server, the system only works with a player with a specific ID, e.g. we can TP the player with a specific ID, etc.
-
Yes, but does it need a name argument? However, I would like to solve it with ID
-
But that returns a name, doesn't it?
-
Now the problem is that the players have an ID, but the system only detects the individual ID and you can only TP on it, etc., etc.
-
Hello, there is a small problem: the code does not break out of the cycle when I write the word break, here is the code (But what is before the break is executed, only after the break does not end the cycle) function gethere(player, cmd, ID) if getElementData(player, "Player.AdminLevel") > 1 then local players = getElementsByType ( "player" ) if tonumber(ID) then for i, p in ipairs(players) do if getElementData(p, "Player.ID") == tonumber(ID) then local x, y, z = getElementPosition(player) setElementPosition(p, x, y, z) break else outputChatBox("#000000<#910e07Wise#ffffffRolePlay#000000> #ffffff Rossz ID-t adtál meg.", player, 255, 255, 255, true) end end else outputChatBox("#000000<#910e07Wise#ffffffRolePlay#000000> #ffffff /gethere [ID]", player, 255, 255, 255, true) end end end addCommandHandler("gethere", gethere, false, false)
-
ddEventHandler("onClientClick", root, function(Button, State) if IsInvShow then for i, slot in ipairs(slots) do if isMouseInPosition(sx * slot[1], sy * slot[2], sx * slot[3], sy * slot[4]) then if Button == "right" and State == "down" then if slot[5][1] then ClickOnItem(slot[5], i) break end else if not slot[5][1] then if Button == "left" and State == "down" then local x, y = getCursorPosition() WindowMove = {x - InvPos[1], y - InvPos[2]} else WindowMove = {false, false} end else if Button == "left" and State == "down" then DragNDrop = {slot[5], i} slot[5] = {false} else if DragNDrop[1] then ItemMove() end end end end end end end end) This is how I call the function --slot, ID, stack {1, 1, 1, ""} This is the content of the slot table
-
Hello, I'm making an inventory and now I've found that the items can be moved, but it's not good, for example, that if I bring it to another item, they don't change places, the slot[5] table contains the items. Can someone help me fix the bugs? function ItemMove() for i, slot in ipairs(slots) do if isMouseInPosition(sx * slot[1], sy * slot[2], sx * slot[3], sy * slot[4]) then if slot[5] then if slot[5][1] == DragNDrop[1][1] then if slot[5][2] < items[slot[5][1]][3] then if slot[5][2] + DragNDrop[1][2] > items[slot[5][1]][3] then slot[5][2] = items[slot[5][1]][3] else slot[5][2] = slot[5][2] + DragNDrop[1][2] end else DragNDrop[1] = slot[5] slot[5] = DragNDrop[5] end else slots[DragNDrop[2]][5] = slot[5] slot[5] = DragNDrop[5] end else slot[5] = DragNDrop[1] print("XD") end end end end DragNDrop = {slot[5], i} Below, I only wrote what is in the DragNDrop table
-
local DashPos = {.2, .2} Server Side: addEventHandler("onPlayerJoin", root, function () local serail = getPlayerSerial(source) local dq = dbQuery(db, "SELECT * FROM vehicle WHERE serial=?", serail) local result = dbPoll(dq, 250) if (#result > 0) then for i, car in ipairs(result) do outputChatBox(i) outputChatBox(car["carid"]) triggerClientEvent("CarData", source, car["carid"]) end end end )
-
Hello, I need some help with writing out data using a cycle, but the problem is that the DxDrawTexts flow into one, what can you do to help me with this for i, carID in ipairs(id) do dxDrawText(carID, sx*(DashPos[1]+.11), sy*(DashPos[2]+.125), sx*.6, sy*.6, tocolor(255, 255, 255), relx*1.5, rely*1.5, "default-bold", "center", "top") end
-
And if i set the pics download false then also save pics in the memory?
-
@FileEX And if i set the Chache false then the player can use the script?
-
Can I also use this cache in server scripts?