DefearT Posted July 24, 2012 Share Posted July 24, 2012 Hola; esto sera muy largo.. En Primero quisiera saber como ponerle una imagen o un texto cuando este el jugador en AFK! Tengo esto: addEventHandler("onPlayerJoin",getRootElement(), function () setElementData(source,"afk_state","back") setElementData(source,"HideState","disabled") end) addEventHandler( "onResourceStart", getResourceRootElement(getThisResource()), function () for i,v in pairs (getElementsByType("player")) do setElementData(v,"afk_state","back") setElementData(v,"HideState","disabled") end end) addCommandHandler("afk", function (thePlayer) if getElementData(thePlayer,"afk_state") == "back" then triggerClientEvent(thePlayer,"god_mode",thePlayer) setElementFrozen(thePlayer,true) setPlayerNametagText (thePlayer, "AFK" .. getPlayerName (thePlayer)) setElementData(thePlayer,"afk_state","afk") if getPedOccupiedVehicle(thePlayer) then fixVehicle(getPedOccupiedVehicle(thePlayer),true) setElementFrozen(getPedOccupiedVehicle(thePlayer),true) setVehicleDamageProof(getPedOccupiedVehicle(thePlayer),true) end elseif getElementData(thePlayer,"afk_state") == "afk" then setElementData(thePlayer,"afk_state","back") triggerClientEvent(thePlayer,"disable_god_mode",thePlayer) setElementFrozen(thePlayer,false) setPlayerNametagText (thePlayer, "AFK" .. getPlayerName (thePlayer)) if getPedOccupiedVehicle(thePlayer) then setElementFrozen(getPedOccupiedVehicle(thePlayer),false) setVehicleDamageProof(getPedOccupiedVehicle(thePlayer),false) end end end) Bueno lo Segundo si se le podra poner un Id correspondiente a cada jugador, ya eh visto el resource que dice Ids y no se si funcina porque no sale en el scoreboard y lo trate de agregar pero no me sale en el scoreboard que hago mal? local optimize = true -- Should the script be optimized? (if optimized, cannot be used client-side) local ids = {} function assignID() for i=1,getMaxPlayers() do if not ids[i] then ids[i] = source setElementData(source,"id",i,not optimize) break end end end addEventHandler("onPlayerJoin",root,assignID) function startup() for k, v in ipairs(getElementsByType("player")) do local id = getElementData(v,"id") if id then ids[id] = v end end end addEventHandler("onResourceStart",resourceRoot,startup) function getPlayerID(player) for k, v in ipairs(ids) do if v == player then return k end end end function freeID() local id = getElementData(source,"id") if not id then return end ids[id] = nil end addEventHandler("onPlayerQuit",root,freeID) function getPlayerByID(id) local player = ids[id] return player or false end exports.scoreboard:addScoreboardColumn("ID",getRootElement(),1) Maybe rename getPlayerByID to getPlayerFromID (or just do function getPlayerFromID(id) return getPlayerByID(id) end) En tercero, Ya casi:'D Como puedo poner una fuente default en ves de crear la fuente miren: por sierto este resource es de Yacuza.. pero solo es la pequeña parte de arriba srfont = dxCreateFont("font.ttf",13) g_Root = getRootElement() g_ResRoot = getResourceRootElement(getThisResource()) g_Players = getElementsByType('player') g_Me = getLocalPlayer() nametag = {} local nametags = {} local g_screenX,g_screenY = guiGetScreenSize() local bHideNametags = false local NAMETAG_SCALE = 0.3 local NAMETAG_ALPHA_DISTANCE = 50 local NAMETAG_DISTANCE = 100 local NAMETAG_ALPHA = 255 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 Bueno y por ultimo para no abusar; no quiero caerles mal... En visto en varios servers imagenes en movimiento osea Gif.. Quisiera saber como puedo poner una imagen gif y pasarla al mta y dejarla fija en una esquina de la pantalla. Con lo que se creo que MTA no soporta gif por eso trato de saber como es que se puede pasar esa imagen al MTA... Gracias de ante mano Link to comment
Soren Posted July 24, 2012 Share Posted July 24, 2012 De donde sacaste los scripts? por que a simple vista se que no los hiciste tu Link to comment
DefearT Posted July 24, 2012 Author Share Posted July 24, 2012 Tranquilo no son mios! ^^ Solo trato de mejorarlos y ponerlos a mi gusto! Link to comment
Arsilex Posted July 24, 2012 Share Posted July 24, 2012 --ID Usa esto haber si te va no lo eh probado... local ids = { } addEventHandler( "onPlayerJoin", root, function( ) for i = 1, getMaxPlayers( ) do if not ids[ i ] then ids[ i ] = source setElementData( source, "playerid", i ) break end end end ) addEventHandler( "onResourceStart", resourceRoot, function( ) for i, source in ipairs( getElementsByType( "player" ) ) do ids[ i ] = source setElementData( source, "playerid", i ) end end ) addEventHandler( "onPlayerQuit", root, function( type, reason, responsible ) for i = 1, getMaxPlayers( ) do if ids[ i ] == source then ids[ i ] = nil if reason then type = type .. " - " .. reason if isElement( responsible ) and getElementType( responsible ) == "player" then type = type .. " - " .. getPlayerName( responsible ) end end exports.server:message( "%C04[" .. i .. "]%C %B" .. getPlayerName( source ):gsub( "_", " " ) .. "%B left the server. (" .. type .. ")" ) break end end end ) function getFromName( player, targetName, ignoreLoggedOut ) if targetName then targetName = tostring( targetName ) local match = { } if targetName == "*" then match = { player } elseif tonumber( targetName ) then match = { ids[ tonumber( targetName ) ] } elseif ( getPlayerFromName ( targetName ) ) then match = { getPlayerFromName ( targetName ) } else for key, value in ipairs ( getElementsByType ( "player" ) ) do if getPlayerName ( value ):lower():find( targetName:lower() ) then match[ #match + 1 ] = value end end end if #match == 1 then if isLoggedIn( match[ 1 ] ) or ignoreLoggedOut then return match[ 1 ], getPlayerName( match[ 1 ] ):gsub( "_", " " ), getElementData( match[ 1 ], "playerid" ) else if player then outputChatBox( getPlayerName( match[ 1 ] ):gsub( "_", " " ) .. " is not logged in.", player, 255, 0, 0 ) end return nil -- not logged in error end elseif #match == 0 then if player then outputChatBox( "No player matches your search.", player, 255, 0, 0 ) end return nil -- no player elseif #match > 10 then if player then outputChatBox( #match .. " players match your search.", player, 255, 204, 0 ) end return nil -- not like we want to show him that many players else if player then outputChatBox ( "Players matching your search are: ", player, 255, 204, 0 ) for key, value in ipairs( match ) do outputChatBox( " (" .. getElementData( value, "playerid" ) .. ") " .. getPlayerName( value ):gsub ( "_", " " ), player, 255, 255, 0 ) end end return nil -- more than one player. We list the player names + id. end end end addCommandHandler( "id", function( player, commandName, target ) if isLoggedIn( player ) then local target, targetName, id = getFromName( player, target ) if target then outputChatBox( targetName .. "'s ID is " .. id .. ".", player, 255, 204, 0 ) end end end ) function getID( player ) local id = getElementData( player, "playerid" ) if ids[ id ] == player then return id else for i = 1, getMaxPlayers( ) do if ids[ i ] == player then return id end end end end Link to comment
DefearT Posted July 24, 2012 Author Share Posted July 24, 2012 Bueno no funciona, ya lo probe.. no sabes como agregar la imagen de afk? Link to comment
Recommended Posts