Tando Posted August 15, 2018 Share Posted August 15, 2018 Hello everybody, Client: addEvent("showmenuu",true) addEventHandler("showmenuu",root, function () dxDrawRectangle(547, 259, 92, 104, tocolor(98, 98, 98, 90), false) dxDrawText("Click Menu", 549, 259, 635, 279, tocolor(239, 191, 0, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawText("PM", 549, 279, 635, 299, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawText("Revive", 549, 305, 635, 325, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawText("Trade", 549, 332, 635, 352, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) end ) i need help in client i need some funcation like when click player show this menu + Make dxDrawText like Button i can click it for make request and if u can make "dxDrawText("Revive") shown "onPlayerWasted" make it plz Link to comment
Keiichi1 Posted August 15, 2018 Share Posted August 15, 2018 For clicking i'd use onClientClick and if the cursor is at the right position and the client clicks, it would make the request. Link to comment
Tando Posted August 15, 2018 Author Share Posted August 15, 2018 22 minutes ago, Keiichi1 said: For clicking i'd use onClientClick and if the cursor is at the right position and the client clicks, it would make the request. Can u show me? sry for take time from u ik i have to work but i will make systems of it but in Client iam not pro Link to comment
VenomOG Posted August 15, 2018 Share Posted August 15, 2018 SERVER function click( btn, stat, plr) if btn ~= "left" and stat ~= "down" then return end if getElementType( source) ~= "player" then return end triggerClientEvent("showMenu, plr) end addEventHandler( "onElementClicked", getRootElement(), click ) @(SAUG)Tando @(SAUG)Tando Im sure your developer @LilDawage can give you the rest, i already made fullclient. Link to comment
Tando Posted August 15, 2018 Author Share Posted August 15, 2018 22 minutes ago, KnucklesSAEG said: SERVER function click( btn, stat, plr) if btn ~= "left" and stat ~= "down" then return end if getElementType( source) ~= "player" then return end triggerClientEvent("showMenu, plr) end addEventHandler( "onElementClicked", getRootElement(), click ) @(SAUG)Tando @(SAUG)Tando Im sure your developer @LilDawage can give you the rest, i already made fullclient. hhhhhhhhhhhhhhhhhhhhhhhh if we aren't talking in mtasa forum i won't request u in anything but lucky U are supporter like much other ohhh, LilDawage if want make it he will make but we have deal can't break it like S.A.E.G XDDDD Link to comment
Keiichi1 Posted August 15, 2018 Share Posted August 15, 2018 (edited) Client: local sx, sy = guiGetScreenSize() local rx, ry = sx/1920, sy/1080 local selectedPlayer = false function isCursorInPosition(rectX, rectY, rectW, rectH) if isCursorShowing() then local cursorX, cursorY = getCursorPosition() local cursorX, cursorY = cursorX * sx, cursorY * sy return (cursorX >= rectX and cursorX <= rectX+rectW) and (cursorY >= rectY and cursorY <= rectY+rectH) else return false end end setTimer(function() if isElement(selectedPlayer) then local x, y, z = getElementPosition(localPlayer) local px, py, pz = getElementPosition(selectedPlayer) local dist = getDistanceBetweenPoints3D(x, y, z, px, py, pz) if dist > 5 then selectedPlayer = false end end end, 500, 0) addEventHandler("onClientRender", getRootElement(), function() if isElement(selectedPlayer) then if isCursorInPosition(cX, cY, 200*rx, 30*ry) then dxDrawRectangle(cX, cY, 200*rx, 30*ry, tocolor(66, 134, 244, 220)) else dxDrawRectangle(cX, cY, 200*rx, 30*ry, tocolor(66, 134, 244, 150)) end dxDrawText("Revive", cX + (55*rx), cY, 0, 0, tocolor(255, 255, 255), 2*rx, "default-bold") end end) addEventHandler("onClientClick", getRootElement(), function(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement) if (state == "up") then if (button == "right") then if (clickedElement) and (getElementType(clickedElement) == "player") and clickedElement ~= localPlayer then cX, cY = absoluteX, absoluteY selectedPlayer = clickedElement else selectedPlayer = false end elseif (button == "left") then if isElement(selectedPlayer) and isCursorInPosition(cX, cY, 200*rx, 30*ry) then triggerServerEvent("serverRevivePlayer", resourceRoot, selectedPlayer) selectedPlayer = false end end end end) Server: addEvent("serverRevivePlayer", true) addEventHandler("serverRevivePlayer", resourceRoot, function(targetPlayer) if isElement(targetPlayer) then local x, y, z = getElementPosition(targetPlayer) local rx, ry, rz = getElementRotation(targetPlayer) local skin = getElementModel(targetPlayer) spawnPlayer(targetPlayer, x, y, z, rz, skin) setCameraTarget(targetPlayer, targetPlayer) outputChatBox("You got revived by: "..getPlayerName(client), targetPlayer) outputChatBox("You revived: "..getPlayerName(targetPlayer), client) end end) Edited August 15, 2018 by Keiichi1 Added optimization for all screen resolutions Link to comment
Tando Posted August 15, 2018 Author Share Posted August 15, 2018 2 hours ago, Keiichi1 said: Client: local sx, sy = guiGetScreenSize() local rx, ry = sx/1920, sy/1080 local selectedPlayer = false function isCursorInPosition(rectX, rectY, rectW, rectH) if isCursorShowing() then local cursorX, cursorY = getCursorPosition() local cursorX, cursorY = cursorX * sx, cursorY * sy return (cursorX >= rectX and cursorX <= rectX+rectW) and (cursorY >= rectY and cursorY <= rectY+rectH) else return false end end setTimer(function() if isElement(selectedPlayer) then local x, y, z = getElementPosition(localPlayer) local px, py, pz = getElementPosition(selectedPlayer) local dist = getDistanceBetweenPoints3D(x, y, z, px, py, pz) if dist > 5 then selectedPlayer = false end end end, 500, 0) addEventHandler("onClientRender", getRootElement(), function() if isElement(selectedPlayer) then if isCursorInPosition(cX, cY, 200*rx, 30*ry) then dxDrawRectangle(cX, cY, 200*rx, 30*ry, tocolor(66, 134, 244, 220)) else dxDrawRectangle(cX, cY, 200*rx, 30*ry, tocolor(66, 134, 244, 150)) end dxDrawText("Revive", cX + (55*rx), cY, 0, 0, tocolor(255, 255, 255), 2*rx, "default-bold") end end) addEventHandler("onClientClick", getRootElement(), function(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement) if (state == "up") then if (button == "right") then if (clickedElement) and (getElementType(clickedElement) == "player") and clickedElement ~= localPlayer then cX, cY = absoluteX, absoluteY selectedPlayer = clickedElement else selectedPlayer = false end elseif (button == "left") then if isElement(selectedPlayer) and isCursorInPosition(cX, cY, 200*rx, 30*ry) then triggerServerEvent("serverRevivePlayer", resourceRoot, selectedPlayer) selectedPlayer = false end end end end) Server: addEvent("serverRevivePlayer", true) addEventHandler("serverRevivePlayer", resourceRoot, function(targetPlayer) if isElement(targetPlayer) then local x, y, z = getElementPosition(targetPlayer) local rx, ry, rz = getElementRotation(targetPlayer) local skin = getElementModel(targetPlayer) spawnPlayer(targetPlayer, x, y, z, rz, skin) setCameraTarget(targetPlayer, targetPlayer) outputChatBox("You got revived by: "..getPlayerName(client), targetPlayer) outputChatBox("You revived: "..getPlayerName(targetPlayer), client) end end) ok what about trade ? i have trade system ! Client: GUIEditor = { checkbox = {}, edit = {}, button = {}, window = {}, label = {}, gridlist = {} } moneyoffer = 0 notallowed = { ["Armour"] = true, ["Weed Seed"] = true, ["Heroine Seed"] = true, ["DMT Seed"] = true, ["LSD Seed"] = true, } addEventHandler("onClientRender", root, function () if isElement(GUIEditor.gridlist[1]) then if getPlayerMoney()-moneyoffer < 0 then triggerServerEvent("closeTrade", localPlayer) hideGui() return end guiGridListSetItemText(GUIEditor.gridlist[1], moneyrow, 2, getPlayerMoney()-moneyoffer, false, false) end end) addEvent("startTrade", true) addEventHandler("startTrade", root, function(pits, pitq) moneyoffer = 0 if isElement(GUIEditor.window[1]) then return exports.SAUGMessages:sendClientMessage("You already have a trade window opened!", 255, 0, 0) end showCursor(true) local screenW, screenH = guiGetScreenSize() GUIEditor.window[1] = guiCreateWindow((screenW - 802) / 2, (screenH - 451) / 2, 802, 451, "SAUG:RPG Trading System (double-click to cancel trade)", false) addEventHandler("onClientGUIDoubleClick", GUIEditor.window[1], function () if getElementType(source) ~= "gui-window" then return end triggerServerEvent("closeTrade", localPlayer) exports.SAUGMessages:sendClientMessage("You cancelled the trade!", 255, 0, 0) hideGui() end) guiWindowSetSizable(GUIEditor.window[1], false) guiSetAlpha(GUIEditor.window[1], 1.00) GUIEditor.label[1] = guiCreateLabel(10, 23, 163, 18, "Your items:", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[1], "default-bold-small") GUIEditor.label[2] = guiCreateLabel(326, 23, 163, 18, "Your offer:", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[2], "default-bold-small") GUIEditor.label[3] = guiCreateLabel(629, 23, 163, 18, "Your partner offer:", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[3], "default-bold-small") GUIEditor.gridlist[1] = guiCreateGridList(9, 43, 164, 354, false, GUIEditor.window[1]) guiGridListSetSortingEnabled(GUIEditor.gridlist[1], false) guiGridListAddColumn(GUIEditor.gridlist[1], "Item", 0.5) guiGridListAddColumn(GUIEditor.gridlist[1], "Count", 0.5) for k, v in ipairs(pits) do if not notallowed[v] then r = guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1], r, 1, v, false, false) guiGridListSetItemText(GUIEditor.gridlist[1], r, 2, pitq[k], false, false) end end moneyrow = guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1], moneyrow, 1, "Money", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], moneyrow, 2, getPlayerMoney(), false, false) GUIEditor.gridlist[2] = guiCreateGridList(325, 46, 164, 351, false, GUIEditor.window[1]) --Offer guiGridListSetSortingEnabled(GUIEditor.gridlist[2], false) guiGridListAddColumn(GUIEditor.gridlist[2], "Item", 0.5) guiGridListAddColumn(GUIEditor.gridlist[2], "Count", 0.5) GUIEditor.gridlist[3] = guiCreateGridList(629, 46, 163, 351, false, GUIEditor.window[1]) --Other offer guiGridListSetSortingEnabled(GUIEditor.gridlist[3], false) guiGridListAddColumn(GUIEditor.gridlist[3], "Item", 0.5) guiGridListAddColumn(GUIEditor.gridlist[3], "Count", 0.5) GUIEditor.button[1] = guiCreateButton(196, 171, 66, 21, ">", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA") addEventHandler("onClientGUIClick", GUIEditor.button[1], function () if getElementType(source) == "gui-button" and guiGridListGetSelectedItem(GUIEditor.gridlist[1]) > -1 and tonumber(guiGetText(GUIEditor.edit[1])) ~= nil and tonumber(guiGetText(GUIEditor.edit[1])) > 0 then if tonumber(guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 2)) < tonumber(guiGetText(GUIEditor.edit[1])) then return exports.ac_message:sendClientMessage("You don't have that amount!", 255, 0, 0) end guiGridListSetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 2, tonumber(guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 2))-tonumber(guiGetText(GUIEditor.edit[1])), false, false) if guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 1) == "Money" then moneyoffer = moneyoffer+tonumber(guiGetText(GUIEditor.edit[1])) end r = guiGridListAddRow(GUIEditor.gridlist[2]) guiGridListSetItemText(GUIEditor.gridlist[2], r, 1, guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 1), false, false) guiGridListSetItemText(GUIEditor.gridlist[2], r, 2, tonumber(guiGetText(GUIEditor.edit[1])), false, false) setTradeAccepted(false) triggerServerEvent("updateAddOffer", localPlayer, guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 1), tonumber(guiGetText(GUIEditor.edit[1]))) end end) GUIEditor.button[2] = guiCreateButton(230, 202, 66, 21, "<", false, GUIEditor.window[1]) addEventHandler("onClientGUIClick", GUIEditor.button[2], function () if getElementType(source) == "gui-button" and guiGridListGetSelectedItem(GUIEditor.gridlist[2]) > -1 and tonumber(guiGetText(GUIEditor.edit[1])) ~= nil and tonumber(guiGetText(GUIEditor.edit[1])) > 0 then if tonumber(guiGridListGetItemText(GUIEditor.gridlist[2], guiGridListGetSelectedItem(GUIEditor.gridlist[2]), 2)) < tonumber(guiGetText(GUIEditor.edit[1])) then return exports.ac_message:sendClientMessage("You don't have that amount added!", 255, 0, 0) end setTradeAccepted(false) triggerServerEvent("updateRemoveOffer", localPlayer, guiGridListGetItemText(GUIEditor.gridlist[2], guiGridListGetSelectedItem(GUIEditor.gridlist[2]), 1), tonumber(guiGetText(GUIEditor.edit[1]))) if guiGridListGetItemText(GUIEditor.gridlist[2], guiGridListGetSelectedItem(GUIEditor.gridlist[2]), 1) then moneyoffer = moneyoffer-tonumber(guiGetText(GUIEditor.edit[1])) end if tonumber(guiGetText(GUIEditor.edit[1])) == tonumber(guiGridListGetItemText(GUIEditor.gridlist[2], guiGridListGetSelectedItem(GUIEditor.gridlist[2]), 2)) then guiGridListRemoveRow(GUIEditor.gridlist[2], guiGridListGetSelectedItem(GUIEditor.gridlist[2])) guiGridListSetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 2, tonumber(guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 2))+tonumber(guiGetText(GUIEditor.edit[1])), false, false) else guiGridListSetItemText(GUIEditor.gridlist[2], guiGridListGetSelectedItem(GUIEditor.gridlist[2]), 2, tonumber(guiGridListGetItemText(GUIEditor.gridlist[2], guiGridListGetSelectedItem(GUIEditor.gridlist[2]), 2))-tonumber(guiGetText(GUIEditor.edit[1])), false, false) guiGridListSetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 2, tonumber(guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 2))+tonumber(guiGetText(GUIEditor.edit[1])), false, false) end end end) guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA") GUIEditor.edit[1] = guiCreateEdit(191, 233, 115, 31, "Amount", false, GUIEditor.window[1]) addEventHandler("onClientGUIChanged", GUIEditor.edit[1], function() local myString = guiGetText(GUIEditor.edit[1]) guiSetText(GUIEditor.edit[1], myString:gsub ( "%p", "" ) ) end) GUIEditor.checkbox[1] = guiCreateCheckBox(190, 408, 174, 18, "Accept trade", false, false, GUIEditor.window[1]) addEventHandler("onClientGUIClick", GUIEditor.checkbox[1], function () if getElementType(GUIEditor.checkbox[1]) == "gui-checkbox" then triggerServerEvent("acceptTrade", localPlayer, guiCheckBoxGetSelected(GUIEditor.checkbox[1])) end end) GUIEditor.button[3] = guiCreateButton(475, 403, 154, 38, "Make trade", false, GUIEditor.window[1]) addEventHandler("onClientGUIClick", GUIEditor.button[3], function () if getElementType(source) == "gui-button" and getElementData(localPlayer, "TradeACP") and getElementData(getElementData(localPlayer, "TradingW"), "TradeACP") then if guiGridListGetRowCount(GUIEditor.gridlist[2]) > 0 or guiGridListGetRowCount(GUIEditor.gridlist[3]) > 0 then mof = {{}, {}} oof = {{}, {}} for r=0, guiGridListGetRowCount(GUIEditor.gridlist[2]) do table.insert(mof[1], guiGridListGetItemText(GUIEditor.gridlist[2], r, 1)) table.insert(mof[2], guiGridListGetItemText(GUIEditor.gridlist[2], r, 2)) end for r=0, guiGridListGetRowCount(GUIEditor.gridlist[3]) do table.insert(oof[1], guiGridListGetItemText(GUIEditor.gridlist[3], r, 1)) table.insert(oof[2], guiGridListGetItemText(GUIEditor.gridlist[3], r, 2)) end triggerServerEvent("makeTrade", localPlayer, mof, oof) hideGui() else hideGui() end end end) guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FFAAAAAA") end ) addEvent("updateOffer", true) addEventHandler("updateOffer", root, function (it, am) setTradeAccepted(false) r = false for k=0, guiGridListGetRowCount(GUIEditor.gridlist[3]) do if guiGridListGetItemText(GUIEditor.gridlist[3], k, 1) == it then r = k end end if r == false then r = guiGridListAddRow(GUIEditor.gridlist[3]) guiGridListSetItemText(GUIEditor.gridlist[3], r, 1, it, false, false) guiGridListSetItemText(GUIEditor.gridlist[3], r, 2, 0, false, false) end if am < 0 then if tonumber(guiGridListGetItemText(GUIEditor.gridlist[3], r, 2))+am <= 0 then guiGridListRemoveRow(GUIEditor.gridlist[3], r) else guiGridListSetItemText(GUIEditor.gridlist[3], r, 2, tonumber(guiGridListGetItemText(GUIEditor.gridlist[3], r, 2))+am, false, false) end else guiGridListSetItemText(GUIEditor.gridlist[3], r, 2, tonumber(guiGridListGetItemText(GUIEditor.gridlist[3], r, 2))+am, false, false) end end) function hideGui() if isElement(GUIEditor.window[1]) then destroyElement(GUIEditor.window[1]) showCursor(false) end end addEvent("hideTrade", true) addEventHandler("hideTrade", root, hideGui) function setTradeAccepted(bol) guiCheckBoxSetSelected(GUIEditor.checkbox[1], bol) triggerServerEvent("acceptTrade", localPlayer, bol) end Server: conn = dbConnect( "mysql", "dbname="..tostring(exports["NGSQL"]:getMySQLData()[3])..";host=46.105.63.90", tostring(exports["NGSQL"]:getMySQLData()[1]), tostring(exports["NGSQL"]:getMySQLData()[2]), "share=1" ) ptrt = {} itens = { [-1] = "Money", [0] = "Gas Can", [1] = "Full Rack", [2] = "Buster", [3] = "Double D-Luxe", [4] = "Sallad Meal", [5] = "Wrench", [6] = "Medic Kit", [7] = "Gas Mask", [8] = "Tire Repair Kit", [9] = "2x Nitrous", [10] = "5x Nitrous", [11] = "10x Nitrous", [12] = "Heroine", [13] = "Weed", [14] = "LSD", [15] = "DMT", [16] = "Armour", [17] = "Paint", [18] = "Heroine Seed", [19] = "Weed Seed", [20] = "LSD Seed", [21] = "DMT Seed", [22] = "Mistery Box", [23] = "Colt 45", [24] = "Taser", [25] = "Deagle", [26] = "M4", [27] = "AK-47", [28] = "Uzi", [29] = "Tec-9", [30] = "MP5", [31] = "Shotgun", [32] = "Sawn-off", [33] = "Spas-12", [34] = "Rifle", [35] = "Sniper", [36] = "Minigun", [37] = "RPG", [38] = "Heat-Seeking RPG", [39] = "Flamethrower", [40] = "Grenade", [41] = "Satchel", [42] = "Molotov", [43] = "Tear Gas", [44] = "Parachute", } for k, v in ipairs(getElementsByType("player")) do setElementData(v, "Trading", false) setElementData(v, "TradingW", false) setElementData(v, "TradeRQ", false) setElementData(v, "TradeACP", false) end addCommandHandler("trade", function (source, _, who) if not isGuestAccount(getPlayerAccount(source)) then local who = findPlayer(who) if who and not isGuestAccount(getPlayerAccount(who)) and who ~= source then if not getElementData(source, "Trading") then local x, y, z = getElementPosition(source) local a, b, c = getElementPosition(who) if getDistanceBetweenPoints3D(x, y, z, a, b, c) <= 5 then if not getElementData(source, "TradeRQ") then setElementData(source, "TradeRQ", who) exports.SAUGMessages:sendClientMessage("You sended a trade request to "..getPlayerName(who).."!",source, 0, 255, 0) ptrt[source] = setTimer(setElementData, 20000, 1, source, "TradeRQ", false) else exports.SAUGMessages:sendClientMessage("You already sent a trade request, wait a while to send another one!",source, 255, 0, 0) return end if source == getElementData(who, "TradeRQ") and who == getElementData(source, "TradeRQ") then pi = {} piq = {} qry = dbQuery(conn, "SELECT * FROM inventory WHERE playerid=?", getPlayerID(source)) pol = dbPoll(qry, -1) for k, row in ipairs(pol) do if(row["quant"] > 0) then table.insert(pi, itens[row["itemid"]]) table.insert(piq, row["quant"]) end end triggerClientEvent(source, "startTrade", source, pi, piq) pi = {} piq = {} qry = dbQuery(conn, "SELECT * FROM inventory WHERE playerid=?", getPlayerID(who)) pol = dbPoll(qry, -1) for k, row in ipairs(pol) do if(row["quant"] > 0) then table.insert(pi, itens[row["itemid"]]) table.insert(piq, row["quant"]) end end triggerClientEvent(who, "startTrade", who, pi, piq) setElementData(source, "Trading", true) setElementData(who, "Trading", true) setElementData(who, "TradingW", source) setElementData(source, "TradingW", who) exports.SAUGMessages:sendClientMessage("You started trading with "..getPlayerName(who).."!",source, 0, 255, 0) exports.SAUGMessages:sendClientMessage("You started trading with "..getPlayerName(source).."!",who, 0, 255, 0) end else exports.SAUGMessages:sendClientMessage("You must be near the player you want to trade with!",source, 255, 0, 0) end else exports.SAUGMessages:sendClientMessage("You are already trading!",source, 255, 0, 0) end else exports.SAUGMessages:sendClientMessage("Player not found!",source, 255, 0, 0) end end end) addEvent("updateAddOffer", true) addEventHandler("updateAddOffer", root, function (it, am) if getElementData(source, "Trading") and getElementData(source, "TradingW") and getElementData(getElementData(source, "TradingW"), "TradingW") == source and getKeyFromValueInTable(itens, it) then triggerClientEvent(getElementData(source, "TradingW"), "updateOffer", getElementData(source, "TradingW"), it, tonumber(am)) end end) addEvent("updateRemoveOffer", true) addEventHandler("updateRemoveOffer", root, function (it, am) if getElementData(source, "Trading") and getElementData(source, "TradingW") and getElementData(getElementData(source, "TradingW"), "TradingW") == source and getKeyFromValueInTable(itens, it) then triggerClientEvent(getElementData(source, "TradingW"), "updateOffer", getElementData(source, "TradingW"), it, 0-tonumber(am)) end end) addEvent("closeTrade", true) addEventHandler("closeTrade", root, function () if getElementData(source, "Trading") and getElementData(source, "TradingW") and getElementData(getElementData(source, "TradingW"), "TradingW") == source then triggerClientEvent(getElementData(source, "TradingW"), "hideTrade", getElementData(source, "TradingW")) setElementData(source, "TradeACP", false) setElementData(getElementData(source, "TradingW"), "TradeACP", false) exports.SAUGMessages:sendClientMessage(getPlayerName(source).." cancelled the trade!",getElementData(source, "TradingW"), 255, 0, 0) setElementData(getElementData(source, "TradingW"), "Trading", false) setElementData(getElementData(source, "TradingW"), "TradingW", false) setElementData(source, "Trading", false) setElementData(source, "TradingW", false) end end) addEvent("acceptTrade", true) addEventHandler("acceptTrade", root, function (acp) if getElementData(source, "Trading") and getElementData(source, "TradingW") and getElementData(getElementData(source, "TradingW"), "TradingW") == source then setElementData(source, "TradeACP", acp) end end) error = {} addEvent("makeTrade", true) addEventHandler("makeTrade", root, function (mof, oof) if getElementData(source, "Trading") and getElementData(source, "TradingW") and getElementData(getElementData(source, "TradingW"), "TradingW") == source and not getElementData(getElementData(source, "TradingW"), "TradeMade") and not getElementData(source, "TradeMade") then if getElementData(getElementData(source, "TradingW"), "TradeACP") then error[source] = false setElementData(source, "TradeMade", true) setTimer(setElementData, 5000, 1, source, "TradeMade", false) exports.SAUGucp:givePlayerAch(source,19) for k, v in ipairs(mof[1]) do if v == "Money" then if getPlayerMoney(source) >= tonumber(mof[2][k]) then takePlayerMoney(source, mof[2][k]) givePlayerMoney(getElementData(source, "TradingW"), mof[2][k]) else error[source] = true end elseif not error[source] then exports["SAUGInventory"]:takePlayerItem(source, getKeyFromValueInTable(itens, v), tonumber(mof[2][k])) exports["SAUGInventory"]:addPlayerItem(getElementData(source, "TradingW"), getKeyFromValueInTable(itens, v), tonumber(mof[2][k])) end end for k, v in ipairs(oof[1]) do if v == "Money" then if getPlayerMoney(getElementData(source, "TradingW")) >= tonumber(oof[2][k]) then givePlayerMoney(source, oof[2][k]) takePlayerMoney(getElementData(source, "TradingW"), oof[2][k]) else error[source] = true end elseif not error[source] then exports["SAUGInventory"]:takePlayerItem(getElementData(source, "TradingW"), getKeyFromValueInTable(itens, v), tonumber(oof[2][k])) exports["SAUGInventory"]:addPlayerItem(source, getKeyFromValueInTable(itens, v), tonumber(oof[2][k])) end end triggerClientEvent(getElementData(source, "TradingW"), "hideTrade", getElementData(source, "TradingW")) setElementData(getElementData(source, "TradingW"), "Trading", false) setElementData(getElementData(source, "TradingW"), "TradingW", false) setElementData(getElementData(source, "TradingW"), "TradeACP", false) setElementData(source, "TradeACP", false) setElementData(source, "Trading", false) setElementData(source, "TradingW", false) exports.SAUGMessages:sendClientMessage("Trade successfully made!",getElementData(source, "TradingW"),0,255,0) exports.SAUGMessages:sendClientMessage("Trade successfully made!",source, 0, 255, 0) else triggerClientEvent(getElementData(source, "TradingW"), "hideTrade", getElementData(source, "TradingW")) setElementData(getElementData(source, "TradingW"), "Trading", false) setElementData(getElementData(source, "TradingW"), "TradingW", false) setElementData(getElementData(source, "TradingW"), "TradeACP", false) setElementData(source, "TradeACP", false) setElementData(source, "Trading", false) setElementData(source, "TradingW", false) exports.SAUGMessages:sendClientMessage("Your partner did not accept the trade!",source, 255, 0, 0) end end end) addEventHandler("onPlayerQuit", root, function () if getElementData(source, "Trading") and getElementData(source, "TradingW") and isElement(getElementData(source, "TradingW")) then triggerClientEvent(getElementData(source, "TradingW"), "hideTrade", getElementData(source, "TradingW")) triggerClientEvent(source, "hideTrade", source) end end) function getPlayerID(player) pqr = dbQuery(conn, "SELECT * FROM accountdata WHERE Username=? LIMIT 1", getAccountName(getPlayerAccount(player))) pqp = dbPoll(pqr, -1) for k, plas in ipairs (pqp) do return plas["id"] end return false end function getKeyFromValueInTable(a, b) for k,v in pairs(a) do if v == b then return k end end return false end function findPlayer(player) if (player and type(player) == "string") then local plr = getPlayerFromName(player) if (plr ~= false) then return plr end local pC = 0 local player = string.lower(player) local spl = split(player, string.byte("[")) if spl then player = table.concat(spl, ";") end for k, v in ipairs(getElementsByType("player")) do local nam = string.lower(getPlayerName(v)) local spl = split(nam, string.byte("[")) if spl then nam = table.concat(spl, ";") end if string.find(nam, player) then plr = v pC = pC + 1 end end if plr and pC == 1 then return plr end return false else return false end end Link to comment
Keiichi1 Posted August 15, 2018 Share Posted August 15, 2018 You can do it yourself. Just draw another button and text like i did. Link to comment
Tando Posted August 15, 2018 Author Share Posted August 15, 2018 6 hours ago, Keiichi1 said: You can do it yourself. Just draw another button and text like i did. okay but can u make another button only of client and i will finish server.lua Link to comment
Keiichi1 Posted August 15, 2018 Share Posted August 15, 2018 Yes, I can do it, but i want you to learn from my script and do it yourself! Link to comment
Tando Posted August 15, 2018 Author Share Posted August 15, 2018 come pm plz 1 minute ago, Keiichi1 said: Yes, I can do it, but i want you to learn from my script and do it yourself! i never know about dx thats way i didn't undestand it i make my hq make design dx Link to comment
VenomOG Posted August 15, 2018 Share Posted August 15, 2018 6 minutes ago, (SAUG)Tando said: come pm plz i never know about dx thats way i didn't undestand it i make my hq make design dx The revive he made is bugged. wont spawn player player still sleeps but i fixed Link to comment
Tando Posted August 15, 2018 Author Share Posted August 15, 2018 (edited) 1 minute ago, KnucklesSAEG said: The revive he made is bugged. wont spawn player player still sleeps but i fixed i will add my own + i request for help not for know u fixed or no ? i have write Venom Fixed revive system and script will work with me lol? Edited August 15, 2018 by (SAUG)Tando Link to comment
Keiichi1 Posted August 15, 2018 Share Posted August 15, 2018 26 minutes ago, KnucklesSAEG said: The revive he made is bugged. wont spawn player player still sleeps but i fixed Player still sleeps? Link to comment
VenomOG Posted August 15, 2018 Share Posted August 15, 2018 3 minutes ago, Keiichi1 said: Player still sleeps? The scripts he use when u kill crim=they sleep then respawn at hospital Link to comment
Tando Posted August 15, 2018 Author Share Posted August 15, 2018 6 minutes ago, Keiichi1 said: Player still sleeps? check pm i sent it to u Link to comment
Keiichi1 Posted August 15, 2018 Share Posted August 15, 2018 5 minutes ago, KnucklesSAEG said: The scripts he use when u kill crim=they sleep then respawn at hospital Yeah I see, fixed it. Thanks for the reply. 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