Sparta Posted February 27, 2020 Share Posted February 27, 2020 Opa galera, não sei muito de .Lua e gostaria de um projeto muito simples, um painel que possa dar dinheiro a um determinado player usando o id ou nick. Agradeço a quem poder ajudar. 1 Link to comment
Developer. Posted February 27, 2020 Share Posted February 27, 2020 Funções, eventos e resource's que você vai necessitar para fazer esse script: Server-Side ( lado servidor) addCommandHandler getPlayerByID ou getPlayerFromPartialNick (as duas são funções úteis, mandarei logo abaixo.) givePlayerMoney addEvent addEventHandler Client-Side (lado cliente) guiEditor (resource útil, só clicar para ser redirecionado a community.) cursorPosition (função útil, mandarei logo abaixo.) triggerServerEvent onClientClick getPlayerByID: function getPlayerByID(id) v = false for i, player in ipairs (getElementsByType("player")) do if getElementData(player, "ID") == id then v = player break end end return v end getPlayerFromPartialName: function getPlayerFromPartialName (name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end cursorPosition: function cursorPosition(x, y, w, h) if (not isCursorShowing()) then return false end local mx, my = getCursorPosition() local fullx, fully = guiGetScreenSize() cursorx, cursory = mx*fullx, my*fully if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then return true else return false end end 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