Jump to content

MisterQuestions

Members
  • Posts

    460
  • Joined

  • Last visited

Everything posted by MisterQuestions

  1. Here is it. function SetRank() window_panel = guiCreateWindow(346, 141, 322, 522, "Set Rank Panel", false) guiWindowSetSizable(window_panel, false) tab_panel = guiCreateTabPanel(9, 30, 303, 482, false, window_panel) tab_rank = guiCreateTab("Set Rank", tab_panel) playergrid = guiCreateGridList(8, 15, 145, 432, false, tab_rank) column = guiGridListAddColumn( playergrid, "Players", 0.85 ) for id, player in ipairs(getElementsByType("player")) do row = guiGridListAddRow ( playergrid ) guiGridListSetItemText ( playergrid, row, column, getPlayerName ( player ), false, false ) playerName = guiGridListGetItemText ( playergrid, guiGridListGetSelectedItem ( playergrid ), 1 ) TrialMember = guiCreateButton(161, 33, 132, 38, "Give Trial-Member", false, tab_rank) Moderator = guiCreateButton(161, 129, 132, 38, "Give Moderator", false, tab_rank) Member = guiCreateButton(161, 81, 132, 38, "Give Member", false, tab_rank) SModerator = guiCreateButton(161, 177, 132, 38, "Give S.Moderator", false, tab_rank) Administrator = guiCreateButton(161, 225, 132, 38, "Give Administrator", false, tab_rank) TeamMananger = guiCreateButton(161, 273, 132, 38, "Give Team Mananger", false, tab_rank) ranklabel = guiCreateLabel(158, 332, 135, 27, "Current Rank:", false, tab_rank) showCursor(true, true) addEventHandler ("OnClientGUIClick", Trial-Member, SetTrial) end end Then? Whats wrong?
  2. I already have it like that, but it only shows me :C why?
  3. I have a dude, how to create a playerlist on a previous created gridlist, i dont know how to create that player list and select players to make the action of the buton. (sorry for the bad english)
  4. Hi, Hi use this script cause i need to create teams in game, and i select this cause have a gui panel, but have a lot of errors, and i dont know what to do. (I added somethings to this autoteams, like carcolor, and command "team") i use this script on race gamemode. 1.When add one team, it change of place every team example: before add new team: Fast Fucking War -Xtreme Pro Racers- after add new team: -Xtreme Pro Racers- Pure Skill Fast Fucking War It change order of teams .-. IDK Why and what to do. Else, doesnt set me the team! i dont know why :c, somebody can help me? Here are the codes. client.lua function createWindow() GUI = {} GUI["window"] = guiCreateWindow(0.225,0.225,0.55,0.55,"Team Management",true) GUI["grid"] = guiCreateGridList(0.0162,0.061,0.7896,0.9178,true,GUI["window"]) guiGridListSetSelectionMode(GUI["grid"],2) guiGridListSetSortingEnabled(GUI["grid"], false) addEventHandler("onClientGUIClick", GUI["window"], editCellLostFocus, false ) GUI["col_name"] = guiGridListAddColumn(GUI["grid"],"Team Name",0.3) GUI["col_color"] = guiGridListAddColumn(GUI["grid"],"Color",0.15) GUI["col_tag"] = guiGridListAddColumn(GUI["grid"],"Tag",0.15) GUI["col_group"] = guiGridListAddColumn(GUI["grid"],"ACL",0.2) GUI["col_required"] = guiGridListAddColumn(GUI["grid"],"Required",0.15) addEventHandler("onClientGUIClick", GUI["grid"], editCellLostFocus, false ) addEventHandler("onClientGUIDoubleClick", GUI["grid"], editCellContent, false ) GUI["btn_load"] = guiCreateButton(0.8165,0.0634,0.1673,0.0728,"Load",true,GUI["window"]) addEventHandler ("onClientGUIClick", GUI["btn_load"], buttonClicked, false ) GUI["btn_save"] = guiCreateButton(0.8183,0.8005,0.1655,0.0728,"Save",true,GUI["window"]) addEventHandler ("onClientGUIClick", GUI["btn_save"], buttonClicked, false ) GUI["btn_close"] = guiCreateButton(0.8183,0.9038,0.1655,0.0728,"Close",true,GUI["window"]) addEventHandler ("onClientGUIClick", GUI["btn_close"], buttonClicked, false ) GUI["btn_add"] = guiCreateButton(0.8183,0.3803,0.1655,0.0728,"Add",true,GUI["window"]) addEventHandler ("onClientGUIClick", GUI["btn_add"], buttonClicked, false ) GUI["btn_delete"] = guiCreateButton(0.8183,0.4671,0.1655,0.0728,"Délète",true,GUI["window"]) addEventHandler ("onClientGUIClick", GUI["btn_delete"], buttonClicked, false ) guiWindowSetSizable(GUI["window"], false) guiWindowSetMovable(GUI["window"], false) guiSetVisible(GUI["window"], false) open = false end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()) , createWindow) function editCellAccepted() if isElement(GUI["theedit"]) then guiGridListSetItemText(GUI["grid"], selectedRow, selectedCol, guiGetText(GUI["theedit"]), false, false) if (selectedCol == GUI["col_color"]) then guiGridListSetItemColor(GUI["grid"], selectedRow, selectedCol, getColorFromString(guiGetText(GUI["theedit"]))) end destroyElement(GUI["theedit"]) end guiSetInputEnabled(false) end function editCellLostFocus() if isElement(GUI["theedit"]) then destroyElement(GUI["theedit"]) end guiSetInputEnabled(false) end function editCellContent() selectedRow, selectedCol = guiGridListGetSelectedItem(GUI["grid"]) if (selectedRow ~= -1 and selectedCol ~= -1) then local text = guiGridListGetItemText( GUI["grid"], selectedRow, selectedCol ) local x,y = getCursorPosition() if isElement(GUI["theedit"]) then destroyElement(GUI["theedit"]) end GUI["theedit"] = guiCreateEdit ( x, y, 0.125, 0.025, text, true) addEventHandler("onClientGUIAccepted", GUI["theedit"], editCellAccepted, true) addEventHandler("onClientGUIBlur", GUI["theedit"], editCellLostFocus, true) guiSetInputEnabled(true) end end function buttonClicked() if (source == GUI["btn_close"]) then wannaTogglePanel() end if (source == GUI["btn_load"]) then triggerServerEvent( "gimmeTheFuckinList", getLocalPlayer()) end if (source == GUI["btn_add"]) then local row = guiGridListAddRow ( GUI["grid"] ) guiGridListSetItemText(GUI["grid"], row, GUI["col_name"], "-", false, false ) guiGridListSetItemText(GUI["grid"], row, GUI["col_color"], "#FFFFFF", false, false ) guiGridListSetItemColor(GUI["grid"], row, GUI["col_color"], getColorFromString("#FFFFFF")) guiGridListSetItemText(GUI["grid"], row, GUI["col_tag"], "-", false, false ) guiGridListSetItemText(GUI["grid"], row, GUI["col_group"], "-", false, false ) guiGridListSetItemText(GUI["grid"], row, GUI["col_required"], "tag", false, false ) end if (source == GUI["btn_delete"]) then local thebadbadrow = guiGridListGetSelectedItem(GUI["grid"]) guiGridListRemoveRow (GUI["grid"], thebadbadrow) end if (source == GUI["btn_save"]) then local rowCount = guiGridListGetRowCount(GUI["grid"]) local i = 0 local theteams = {} while i <= rowCount - 1 do local teamname = guiGridListGetItemText(GUI["grid"], i, GUI["col_name"]) theteams[teamname] = {} theteams[teamname].name = teamname theteams[teamname].color = guiGridListGetItemText(GUI["grid"], i, GUI["col_color"]) theteams[teamname].tag = guiGridListGetItemText(GUI["grid"], i, GUI["col_tag"]) theteams[teamname].aclGroup = guiGridListGetItemText(GUI["grid"], i, GUI["col_group"]) theteams[teamname].required = guiGridListGetItemText(GUI["grid"], i, GUI["col_required"]) i = i + 1 end triggerServerEvent( "hereIzDaFuckinList", getLocalPlayer(), theteams) end end function wannaTogglePanel() open = not open showCursor ( open ) guiSetVisible(GUI["window"], open) if isElement(GUI["theedit"]) then guiSetVisible(GUI["theedit"], open) end if (open == true) then triggerServerEvent( "gimmeTheFuckinList", getLocalPlayer()) end end addEvent("opendaShitForme", true) addEventHandler("opendaShitForme", getRootElement(), wannaTogglePanel) function loadDaList(theteams) guiGridListClear(GUI["grid"]) for name,data in pairs(theteams) do local row = guiGridListAddRow ( GUI["grid"] ) guiGridListSetItemText(GUI["grid"], row, GUI["col_name"], data.name, false, false ) local color = {getColorFromString(data.color)} if not color[1] then color = {255,255,255} end guiGridListSetItemText(GUI["grid"], row, GUI["col_color"], data.color, false, false ) guiGridListSetItemColor(GUI["grid"], row, GUI["col_color"], unpack(color)) guiGridListSetItemText(GUI["grid"], row, GUI["col_tag"], data.tag, false, false ) guiGridListSetItemText(GUI["grid"], row, GUI["col_group"], data.aclGroup, false, false ) guiGridListSetItemText(GUI["grid"], row, GUI["col_required"], data.required, false, false ) end end addEvent("hereIsDaListNub", true) addEventHandler("hereIsDaListNub", getRootElement(), loadDaList) Config.xml "Fast Fucking War" tag="-ffw-" color="#FF9e00" aclGroup="-" required="-ffw-"> "Pure Skills" tag="~Ps|" color="#00FF00" aclGroup="-" required="~Ps|"> "-Xtreme Pro Racers-" tag="-|XpR|-" color="#777777" aclGroup="-" required="-|XpR|-"> meta.xml "Autoteams Manager" author="fabienwang" type="script" version="1.2" /> server.lua teams = {} function toggleClientPanel(player) triggerClientEvent(player, "opendaShitForme", getRootElement() ) end function onSomeoneLoggedInOwner() local accountName = getAccountName(getPlayerAccount(source)) if isObjectInACLGroup("user."..accountName,aclGetGroup("Owner")) then unbindKey(source,"o","down", toggleClientPanel) bindKey(source,"o","down", toggleClientPanel) end end addEventHandler("onPlayerLogin", getRootElement(), onSomeoneLoggedInOwner) function onSomeoneLoggedInMananger() local accountName = getAccountName(getPlayerAccount(source)) if isObjectInACLGroup("user."..accountName,aclGetGroup("ClanMananger")) then unbindKey(source,"o","down", toggleClientPanel) bindKey(source,"o","down", toggleClientPanel) end end addEventHandler("onPlayerLogin", getRootElement(), onSomeoneLoggedInMananger) function onSomeoneLoggedInAdmin() local accountName = getAccountName(getPlayerAccount(source)) if isObjectInACLGroup("user."..accountName,aclGetGroup("Admin")) then unbindKey(source,"o","down", toggleClientPanel) bindKey(source,"o","down", toggleClientPanel) end end addEventHandler("onPlayerLogin", getRootElement(), onSomeoneLoggedInAdmin) function sendGridtoClient() local theteams = {} local rootNode = xmlLoadFile("config.xml") local children = xmlNodeGetChildren(rootNode) for _,node in pairs(children) do local attributes = xmlNodeGetAttributes(node) local name = attributes.name theteams[name] = attributes end xmlUnloadFile(rootNode) triggerClientEvent(source, "hereIsDaListNub", getRootElement(), theteams) end addEvent("gimmeTheFuckinList", true) addEventHandler("gimmeTheFuckinList", getRootElement(), sendGridtoClient) function saveNewTeams(theteams) local thexml = xmlCreateFile("config.xml", "teams") for name,settings in next,theteams do local child = xmlCreateChild(thexml, "team") xmlNodeSetAttribute(child, "name", name) xmlNodeSetAttribute(child, "tag", settings.tag) xmlNodeSetAttribute(child, "color", settings.color) xmlNodeSetAttribute(child, "aclGroup", settings.aclGroup) xmlNodeSetAttribute(child, "required", settings.required) end xmlSaveFile(thexml) xmlUnloadFile(thexml) initiate() end addEvent("hereIzDaFuckinList", true) addEventHandler("hereIzDaFuckinList", getRootElement(), saveNewTeams) ------------ -- Events -- ------------ function playerJoined() check(source) end addEventHandler("onPlayerJoin",getRootElement(),playerJoined) function playerChangedNick(oldNick,newNick) -- Use timer to wait until the nick really has changed setTimer(check,100,1,source) end addEventHandler("onPlayerChangeNick",getRootElement(),playerChangedNick) function playerQuit() removePlayerFromTeam(source) end addEventHandler("onPlayerQuit",getRootElement(),playerQuit) -- Check for ACL Groups on login/logout function loggedIn() check(source) end addEventHandler("onPlayerLogin",getRootElement(),loggedIn) function loggedOut() check(source) unbindKey(source,"o","down", toggleClientPanel) end addEventHandler("onPlayerLogout",getRootElement(),loggedOut) --- -- Reads the settings and creates the teams if enabled. -- function initiate() teams = {} for k,v in pairs(getElementsByType("team")) do local players = getPlayersInTeam (v) for playerKey, playerValue in ipairs ( players ) do setPlayerTeam( playerValue, nil) end destroyElement(v) end local rootNode = xmlLoadFile("config.xml") local children = xmlNodeGetChildren(rootNode) if children == false then outputDebugString("children == false") return end for _,node in pairs(children) do local attributes = xmlNodeGetAttributes(node) local name = attributes.name teams[name] = attributes if not toboolean(get("noEmptyTeams")) then local color = {getColorFromString(attributes.color)} if not color[1] then color = {255,255,255} end teams[name].team = createTeam(name,unpack(color)) end end for k,v in pairs(getElementsByType("player")) do check(v) end xmlUnloadFile(rootNode) end addEventHandler("onResourceStart",getResourceRootElement(),initiate) --------------- -- Functions -- --------------- --- -- Checks the player's nick and ACL Groups and sets his team if necessary. -- -- @param player player: The player element -- function check(player) if not isElement(player) or getElementType(player) ~= "player" then debug("No player") return end local nick = getPlayerName(player) --set player white setPlayerNametagColor(player, 255,255,255) local accountName = getAccountName(getPlayerAccount(player)) for name,data in pairs(teams) do local tagMatch = false local aclGroupMatch = false if data.tag ~= nil and string.find(nick,data.tag,1,true) then tagMatch = true end if data.aclGroup ~= nil and accountName and isObjectInACLGroup("user."..accountName,aclGetGroup(data.aclGroup)) then aclGroupMatch = true end if data.required == "both" then if tagMatch and aclGroupMatch then addPlayerToTeam(player,name) --Check Vehicle color (and set it to team color) if isPedInVehicle(player) then local vehicle = getPedOccupiedVehicle(player) if getPedOccupiedVehicleSeat(player) == 0 then if getPlayerTeam(player) then local r,g,b = getTeamColor(getPlayerTeam(player)) setVehicleColor(vehicle,r,g,b,r,g,b,r,g,b,r,g,b) setPlayerNametagColor(player, r,g,b) else setVehicleColor(vehicle,255,255,255,255,255,255,255,255,255,255,255,255) end end end return end else if tagMatch or aclGroupMatch then addPlayerToTeam(player,name) --Check Vehicle color (and set it to team color) if isPedInVehicle(player) then local vehicle = getPedOccupiedVehicle(player) if getPedOccupiedVehicleSeat(player) == 0 then if getPlayerTeam(player) then local r,g,b = getTeamColor(getPlayerTeam(player)) setVehicleColor(vehicle,r,g,b,r,g,b,r,g,b,r,g,b) setPlayerNametagColor(player, r,g,b) else setVehicleColor(vehicle,255,255,255,255,255,255,255,255,255,255,255,255) end end end return end end end removePlayerFromTeam(player) --Check Vehicle color (and set it to team color) if isPedInVehicle(player) then local vehicle = getPedOccupiedVehicle(player) if getPedOccupiedVehicleSeat(player) == 0 then if getPlayerTeam(player) then local r,g,b = getTeamColor(getPlayerTeam(player)) setVehicleColor(vehicle,r,g,b,r,g,b,r,g,b,r,g,b) setPlayerNametagColor(player, r,g,b) else setVehicleColor(vehicle,255,255,255,255,255,255,255,255,255,255,255,255) end end end end --- -- Adds a player to the team appropriate for the name. -- It is not checked if the team is really defined in the table, since -- it should only be called if it is. -- -- Creates the team if it doesn't exist. -- -- @param player player: The player element -- @param string name: The name of the team -- function addPlayerToTeam(player,name) local oldteam = getPlayerTeam(player) local team = teams[name].team if not isElement(team) or getElementType(team) ~= "team" then local color = {getColorFromString(teams[name].color)} if not color[1] then color = {255,255,255} end team = createTeam(teams[name].name,unpack(color)) teams[name].team = team elseif team == oldteam then return end triggerEvent("onPlayerTeamChange", player, oldteam, team) setPlayerTeam(player,team) debug("Added player '"..
  5. But, ACL have rights, i need to onClientGuiClick add selected user of gridlist to acl asigned to button.
  6. Hi everybody, i have created a gui panel the funxtion of this panel is on a gridlist show players the selected player if click a button will add to determinated acl else the panel have a "Current Rank:" label these should show the acl where player is on. So i dont know firts, how to get player list, then the label, and put functions to buttons.
  7. ¿Como lograste lo de hacer lo de las gridlist, es que yo tambien toy haciendo uno T-t
  8. Gracias. Ya solo era cuestión de un logout & quedo !, Enserio quiero agradecerles a todos aqui, a Bc por darme la idea del espaciado, Ati, por ayudarme a fixear la cosa esta, a Hypex por darme el codigo inicial de los rank, Gracias a todos!
  9. Ya lo cambie funciono, pero ahora surgio otro problema... Funciona & todo, pero algunos players no aparece el rank arriba, por ejemplo mi compañero owner aparecio sin nada, el tipo ese de verde deberia decir "Miembro" o "Member" & nda, por que?
  10. Oye hay un error, Aparece y todo, pero mira... El script lo que esta haciendo es mostrarme mi rango arriga de todos los players, exeptuando los del acl "everyone" por que no estan en el server-side, pero, aque se debe igualmente a los demas admins y mods que tengo les muestra lo mismo, su propio rango arriba de todos. que hago?
  11. Miren esto Diganme que tal? Pienso meterlo con el race.zip Agregandolo al meta.xml Lo renombre de nategas.lua a nametags_c.lua nametag = {} local nametags = {} local g_screenX,g_screenY = guiGetScreenSize() local bHideNametags = false local NAMETAG_SCALE = 0.3 --Overall adjustment of the nametag, use this to resize but constrain proportions local NAMETAG_ALPHA_DISTANCE = 50 --Distance to start fading out local NAMETAG_DISTANCE = 120 --Distance until we're gone local NAMETAG_ALPHA = 120 --The overall alpha level of the nametag --The following arent actual pixel measurements, they're just proportional constraints local NAMETAG_TEXT_BAR_SPACE = 2 local NAMETAG_WIDTH = 50 local NAMETAG_HEIGHT = 5 local NAMETAG_TEXTSIZE = 0.3 local NAMETAG_OUTLINE_THICKNESS = 1.2 -- local NAMETAG_ALPHA_DIFF = NAMETAG_DISTANCE - NAMETAG_ALPHA_DISTANCE NAMETAG_SCALE = 1/NAMETAG_SCALE * 800 / g_screenY -- Ensure the name tag doesn't get too big local maxScaleCurve = { {0, 0}, {3, 3}, {13, 5} } -- Ensure the text doesn't get too small/unreadable local textScaleCurve = { {0, 0.8}, {0.8, 1.2}, {99, 99} } -- Make the text a bit brighter and fade more gradually local textAlphaCurve = { {0, 0}, {25, 100}, {120, 190}, {255, 190} } function nametag.create ( player ) nametags[player] = true end function nametag.destroy ( player ) nametags[player] = nil end function renderNametagsForPlayers() -- Hideous quick fix -- for i,player in ipairs(g_Players) do if player ~= g_Me then setPlayerNametagShowing ( player, false ) if not nametags[player] then nametag.create ( player ) end end end if bHideNametags then return end local x,y,z = getCameraMatrix() if getElementData(localPlayer,"loginState") then return end for player in pairs(nametags) do while true do if not isPedInVehicle(player) or isPlayerDead(player) then break end local vehicle = getPedOccupiedVehicle(player) local px,py,pz = getElementPosition ( vehicle ) local pdistance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz ) if pdistance <= NAMETAG_DISTANCE then --Get screenposition local sx,sy = getScreenFromWorldPosition ( px, py, pz+0.95, 0.06 ) if not sx or not sy then break end --Calculate our components local scale = 1/(NAMETAG_SCALE * (pdistance / NAMETAG_DISTANCE)) local alpha = ((pdistance - NAMETAG_ALPHA_DISTANCE) / NAMETAG_ALPHA_DIFF) alpha = (alpha < 0) and NAMETAG_ALPHA or NAMETAG_ALPHA-(alpha*NAMETAG_ALPHA) scale = math.evalCurve(maxScaleCurve,scale) local textscale = math.evalCurve(textScaleCurve,scale) local textalpha = math.evalCurve(textAlphaCurve,alpha) local outlineThickness = NAMETAG_OUTLINE_THICKNESS*(scale) --Draw our text local r,g,b = 255,255,255 local team = getPlayerTeam(player) if team then r,g,b = getTeamColor(team) end local offset = (scale) * NAMETAG_TEXT_BAR_SPACE/2 local rank = getElementData(localPlayer, "ACL") or "" dxDrawText (rank.." \n"..getPlayerName(player), sx, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, raceInterface.font, "center", "bottom", false, false, false, true ) --We draw three parts to make the healthbar. First the outline/background local drawX = sx - NAMETAG_WIDTH*scale/2 drawY = sy + offset local width,height = NAMETAG_WIDTH*scale, NAMETAG_HEIGHT*scale --dxDrawRectangle ( drawX, drawY, width, height, tocolor(0,0,0,alpha) ) --Next the inner background local health = getElementHealth(vehicle) health = math.max(health - 250, 0)/750 local p = -510*(health^2) local r,g = math.max(math.min(p + 255*health + 255, 255), 0), math.max(math.min(p + 765*health, 255), 0) --[[dxDrawRectangle ( drawX + outlineThickness, drawY + outlineThickness, width - outlineThickness*2, height - outlineThickness*2, tocolor(r,g,0,0.4*alpha) ) --Finally, the actual health --dxDrawRectangle ( drawX + outlineThickness, drawY + outlineThickness, health*(width - outlineThickness*2), height - outlineThickness*2, tocolor(r,g,0,alpha) ) ]] end break end end end ---------------THE FOLLOWING IS THE MANAGEMENT OF NAMETAGS----------------- addEventHandler('onClientResourceStart', g_ResRoot, function() for i,player in ipairs(getElementsByType"player") do if player ~= g_Me then nametag.create ( player ) end end end ) addEventHandler ( "onClientPlayerJoin", g_Root, function() if source == g_Me then return end setPlayerNametagShowing ( source, false ) nametag.create ( source ) end ) addEventHandler ( "onClientPlayerQuit", g_Root, function() nametag.destroy ( source ) end ) addEvent ( "onClientScreenFadedOut", true ) addEventHandler ( "onClientScreenFadedOut", g_Root, function() bHideNametags = true end ) addEvent ( "onClientScreenFadedIn", true ) addEventHandler ( "onClientScreenFadedIn", g_Root, function() bHideNametags = false end ) Este es un archivo que use como base para obeter el rango nametags_s.lua addEventHandler( 'onPlayerLogin', root, function ( ) local account = getPlayerAccount( source ) if account and not isGuestAccount( account ) then local accountName = getAccountName( account ); if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Owner" ) ) then setElementData(source, "ACL", "Owner") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "ClanMananger" ) ) then setElementData(source, "ACL", "Clan-Mananger") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then setElementData(source, "ACL", "Admin") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "SuperModerador" ) ) then setElementData(source, "ACL", "SuperModerador") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Moderador" ) ) then setElementData(source, "ACL", "Moderador") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Miembro" ) ) then setElementData(source, "ACL", "Miembro") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "MiembroTrial" ) ) then setElementData(source, "ACL", "MiembroTrial") end end end ) addEventHandler( 'onPlayerLogout', root, function ( ) local acl = getElementData(source, "ACL") if acl then removeElementData(source,"ACL") end end)
  12. Te mando el codigo del client por pm? o aqui?
  13. Alguien me puede ayudar a terminar un panel? Es de un set de rank de acl osea al seleccionar el player agrega el account al acl group del boton. & tengo una duda, si se podra hacer otro panel para editar cuentas, editarla en el sentido de editar el accountname & asi Gracias, espero su respuesta .
  14. En la comunidad en ingles me dieron algo asi, pero tiene un error, me muestra mi propio rango sobre el nick de todos los players, y asi mismo, si otro player tiene un rango, le muestra solo el suyo.& no funciona cuando lo estas "specteando" Client.lua addEventHandler ( "onClientRender", getRootElement ( ), function ( ) local PlayerX, PlayerY, PlayerZ = getElementPosition ( getLocalPlayer ( ) ) for i, v in ipairs ( getElementsByType("player") ) do if v == getLocalPlayer() then else local PedX, PedY, PedZ = getElementPosition ( v ) local dist = getDistanceBetweenPoints3D ( PlayerX, PlayerY, PlayerZ, PedX, PedY, PedZ ) local PX, PY, PZ = getElementPosition ( getLocalPlayer ( ) ) local PeX, PeY, PeZ = getElementPosition(v) local Rot = findRotation(PeX, PeY, PX, PY) if dist <= 40 then local scx, scy = getScreenFromWorldPosition ( PedX, PedY, PedZ + 1.2, -50, true ) if isLineOfSightClear ( PlayerX, PlayerY, PlayerZ, PedX, PedY, PedZ, true, false, false, false ) and scx and scy then local alpha = 200 local r = 0 local g = 150 local b = 200 local scale = 2 local scale3d = true local font = "default-bold" local text = getElementData(localPlayer, "ACL") or "" dxDrawText ( text, scx, scy, scx, scy, tocolor ( r, g, b, alpha ), scale, font, "center", "center",true,true,true,true) local rem, asd, asd2 = getTimerDetails(InterTimer) local p = rem / 500 if not val1 or not val2 then return end local v1,v2,v3 = interpolateBetween(val1, 0,0, val2, 0,0, p, "Linear") local MyScale = ( ( v1 / 100 ) * 1.3 ) /( ( 1360 / x ) * ( 768 / y ) ) if dist <= 10 then if not getKeyBoundToFunction(ChallengePlayer) then bindKey("H", "down", ChallengePlayer, v) end local scx2, scy2 = getScreenFromWorldPosition ( PedX, PedY, PedZ + 1, -50, true ) local alpha2 = 255 dxDrawText ( "#66ffaaPress #ffffffH #66ffaaTo Challenge", scx2, scy2, scx2, scy2, tocolor ( r, g, b, alpha2 ), MyScale * 1.5, font, "center", "center",false,false,false,true ) else if getKeyBoundToFunction(ChallengePlayer) then unbindKey("H","down",ChallengePlayer) end end else alpha = 0 end Server.lua addEventHandler( 'onPlayerLogin', root, function ( ) local account = getPlayerAccount( source ) if account and not isGuestAccount( account ) then local accountName = getAccountName( account ); if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Owner" ) ) then setElementData(source, "ACL", "Owner") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "ClanMananger" ) ) then setElementData(source, "ACL", "Clan-Mananger") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then setElementData(source, "ACL", "Admin") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "SuperModerador" ) ) then setElementData(source, "ACL", "SuperModerador") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Moderador" ) ) then setElementData(source, "ACL", "Moderador") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Miembro" ) ) then setElementData(source, "ACL", "Miembro") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "MiembroTrial" ) ) then setElementData(source, "ACL", "MiembroTrial") end end end ) addEventHandler( 'onPlayerLogout', root, function ( ) local acl = getElementData(source, "ACL") if acl then removeElementData(source,"ACL") end end)
  15. Pues, basicamente, uso el ACL, & el autoteams, te setea el team dependiendo el acl que estes, ej Team:FFW Server Owner ACL:Owner & me lo setea.
  16. So?!?!?! Any one know what to do?
  17. nametag = {} local nametags = {} local g_screenX,g_screenY = guiGetScreenSize() local bHideNametags = false local NAMETAG_SCALE = 0.40 --Overall adjustment of the nametag, use this to resize but constrain proportions local NAMETAG_ALPHA_DISTANCE = 100 --Distance to start fading out local NAMETAG_DISTANCE = 100 --Distance until we're gone local NAMETAG_ALPHA = 120 --The overall alpha level of the nametag --The following arent actual pixel measurements, they're just proportional constraints local NAMETAG_TEXT_BAR_SPACE = 2 local NAMETAG_WIDTH = 40 local NAMETAG_HEIGHT = 4 local NAMETAG_TEXTSIZE = 0.3 local NAMETAG_OUTLINE_THICKNESS = 1.2 -- local NAMETAG_ALPHA_DIFF = NAMETAG_DISTANCE - NAMETAG_ALPHA_DISTANCE NAMETAG_SCALE = 1/NAMETAG_SCALE * 800 / g_screenY -- Ensure the name tag doesn't get too big local maxScaleCurve = { {0, 0}, {3, 3}, {13, 5} } -- Ensure the text doesn't get too small/unreadable local textScaleCurve = { {0, 0.8}, {0.8, 1.2}, {99, 99} } -- Make the text a bit brighter and fade more gradually local textAlphaCurve = { {0, 0}, {25, 100}, {120, 190}, {255, 190} } function nametag.create ( player ) nametags[player] = true end function nametag.destroy ( player ) nametags[player] = nil end ---------------THE FOLLOWING IS THE MANAGEMENT OF NAMETAGS----------------- addEventHandler('onClientResourceStart', g_ResRoot, function() for i,player in ipairs(getElementsByType"player") do if player ~= g_Me then nametag.create ( player ) end end end ) addEventHandler ( "onClientPlayerJoin", g_Root, function() if source == g_Me then return end setPlayerNametagShowing ( source, false ) nametag.create ( source ) end ) addEventHandler ( "onClientPlayerQuit", g_Root, function() nametag.destroy ( source ) end ) addEvent ( "onClientScreenFadedOut", true ) addEventHandler ( "onClientScreenFadedOut", g_Root, function() bHideNametags = true end ) addEvent ( "onClientScreenFadedIn", true ) addEventHandler ( "onClientScreenFadedIn", g_Root, function() bHideNametags = false end ) addEventHandler ( "onClientRender", g_Root, function() -- Hideous quick fix -- for i,player in ipairs(g_Players) do if player ~= g_Me then setPlayerNametagShowing ( player, false ) if not nametags[player] then nametag.create ( player ) end end end if bHideNametags then return end local x,y,z = getCameraMatrix() for player in pairs(nametags) do while true do if not isPedInVehicle(player) or isPlayerDead(player) then break end local vehicle = getPedOccupiedVehicle(player) local px,py,pz = getElementPosition ( vehicle ) local pdistance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz ) if pdistance <= NAMETAG_DISTANCE then --Get screenposition local sx,sy = getScreenFromWorldPosition ( px, py, pz+0.95, 0.06 ) if not sx or not sy then break end --Calculate our components local scale = 1/(NAMETAG_SCALE * (pdistance / NAMETAG_DISTANCE)) local alpha = ((pdistance - NAMETAG_ALPHA_DISTANCE) / NAMETAG_ALPHA_DIFF) alpha = (alpha < 0) and NAMETAG_ALPHA or NAMETAG_ALPHA-(alpha*NAMETAG_ALPHA) scale = math.evalCurve(maxScaleCurve,scale) local textscale = math.evalCurve(textScaleCurve,scale) local textalpha = math.evalCurve(textAlphaCurve,alpha) local outlineThickness = NAMETAG_OUTLINE_THICKNESS*(scale) --Draw our text local r,g,b = 255,255,255 local team = getPlayerTeam(player) if team then r,g,b = getTeamColor(team) end local offset = (scale) * NAMETAG_TEXT_BAR_SPACE/2 --dxDrawText ( getPlayerName(player), sx, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, "default", "center", "bottom", false, false, false ) dxDrawText ( getPlayerName(player), sx + 1, sy - offset + 1, sx + 1, sy - offset + 1, tocolor(0,0,0,255), textscale*NAMETAG_TEXTSIZE, "bankgothic", "center", "bottom", false, false, false ) dxDrawColorText( getPlayerNametagText(player), sx, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, 'bankgothic', 'center', 'bottom' ) --We draw three parts to make the healthbar. First the outline/background local drawX = sx - NAMETAG_WIDTH*scale/2 drawY = sy + offset local width,height = NAMETAG_WIDTH*scale, NAMETAG_HEIGHT*scale dxDrawRectangle ( drawX, drawY, width, height, tocolor(0,0,0,alpha) ) --Next the inner background local health = getElementHealth(vehicle) health = math.max(health - 250, 0)/750 local p = -510*(health^2) --local r,g = math.max(math.min(p + 255*health + 255, 255), 0), math.max(math.min(p + 765*health, 255), 0) dxDrawRectangle ( drawX + outlineThickness, drawY + outlineThickness, width - outlineThickness*2, height - outlineThickness*2, tocolor(178,178,178,0.4*alpha) ) --Finally, the actual health dxDrawRectangle ( drawX + outlineThickness, drawY + outlineThickness, health*(width - outlineThickness*2), height - outlineThickness*2, tocolor(r,g,b,alpha) ) end break end end end ) function dxDrawColorText(str, ax, ay, bx, by, color, scale, font, alignX, alignY) if alignX then if alignX == "center" then local w = dxGetTextWidth(str:gsub("#%x%x%x%x%x%x",""), scale, font) ax = ax + (bx-ax)/2 - w/2 elseif alignX == "right" then local w = dxGetTextWidth(str:gsub("#%x%x%x%x%x%x",""), scale, font) ax = bx - w end end if alignY then if alignY == "center" then local h = dxGetFontHeight(scale, font) ay = ay + (by-ay)/2 - h/2 elseif alignY == "bottom" then local h = dxGetFontHeight(scale, font) ay = by - h end end local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local last = 1 while s do if cap == "" and col then color = tocolor(tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)), 255) end if s ~= 1 or cap ~= "" then local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font) ax = ax + w color = tocolor(tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)), 255) end last = e + 1 s, e, cap, col = str:find(pat, last) end if last <= #str then cap = str:sub(last) local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font) end end Este es el nametags del race.zip.
  18. i comes with race_votingserver.lua, but doesnt show message when players gets hunter.
×
×
  • Create New...