Truceed Posted July 10, 2021 Share Posted July 10, 2021 Só Fica uma Cor, alguem Sabe pq? local cargo = getElementData(player, "cargo") if(cargo) then w = dxGetTextWidth(cargo, 1.2, font ) dxDrawText(cargo, x - 1 - w / 2,y - -20 - h - 12-18, w, h, tocolor(0,255,127), 1.2, font) end end end function cromusCargos(player) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Console")) then setElementData(player, "cargo", "DONO GERAL") setElementData(player, "cargo->cor", {0,255,127}) elseif isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Admin")) then setElementData(player, "cargo", "ADM") elseif isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Premium")) then setElementData(player, "cargo", "【VIP Premium】") setElementData(player, "cargo->cor", (255,0,255)) elseif isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("SuperModerator")) then setElementData(player, "cargo", "S.MOD") setElementData(player, "cargo->cor", {255,140,140}) elseif isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Moderator")) then setElementData(player, "cargo", "MOD") setElementData(player, "cargo->cor", {255,140,140}) elseif isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("BPG")) then setElementData(player, "cargo", "BPG") setElementData(player, "cargo->cor", {255,140,140}) elseif isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Everyone")) then setElementData(player, "cargo", " ") setElementData(player, "cargo->cor", {255,140,140}) end end function onResourceStart() for _, player in pairs(getElementsByType("player")) do cromusCargos(player) end end addEventHandler("onResourceStart",resourceRoot,onResourceStart) function onPlayerLogin() cromusCargos(source) end addEventHandler("onPlayerLogin",root,onPlayerLogin) Link to comment
Administrators Tut Posted July 10, 2021 Administrators Share Posted July 10, 2021 Welcome to the forums. Your thread has been moved into the Portuguese scripting section Link to comment
Other Languages Moderators androksi Posted July 10, 2021 Other Languages Moderators Share Posted July 10, 2021 Olá! O erro ocorre pois em nenhum momento você pede para que a cor seja alterada. A cor está sendo salva no elementData cargo->cor. Sendo assim, você também deve obtê-la. Uma vez com ela, basta aplicar naquela função tocolor. Ficaria algo desta forma: local color = getElementData(player, "cargo->cor") dxDrawText(cargo, x - 1 - w / 2, y - -20 - h - 12 - 18, w, h, tocolor(color[1], color[2], color[3], 255), 1.2, font) Como tal elementData armazena uma tabela, nós obtemos o índice de cada um. Digamos que eu possuo o cargo MOD, então a variável color receberia: {255, 140, 140}. Logo, aqueles valores definidos dentro da função tocolor, seriam o mesmo que: color[1] = 255, color[2] = 140 e color[3] = 140. 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