Jump to content

Flag


Arsilex

Recommended Posts

no yo no quero el script ese cambia el admin y no por que carga mucho despues

tengo esto

exports.scoreboard:addScoreboardColumn('Country') 
exports.scoreboard:addScoreboardColumn('Home') 
function showHome () 
local Home = call(getResourceFromName("admin"), "getPlayerCountry", source) 
    setElementData(source,"Country",Home) 
end 
addEventHandler("onPlayerJoin",getRootElement(),showHome) 

lo quero que me digan que llamada tengo que poner ._.

Link to comment
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 

ese sirve?

Link to comment

Fijate haciendo

  
exports.scoreboard:addScoreboardColumn('ID') 
  
function agregarID() 
  
for i,v in ipairs(getElementsByType("player")) do 
local id = getPlayerID(v) 
setElementData(v,"ID",id) 
end 
end 
addEventHandler("onResourceStart",getRootElement(),agregarID) 
  
-- No se si esta bien, sino la otra es 
  
function agregarIDenJoin() 
  
local id = getPlayerID(source) 
setElementData(source,"ID",id) 
end 
addEventHandler("onPlayerJoin",getRootElement(),agregarIDenJoin) 
  
  

La segunda estoy seguro que debe funcionar, la primera no se porque puede ser que la data se le setea a todos y no uno a cada uno.

Link to comment

Sorry, despues de testear me funciono haciendo esto...

Pones ese script de la community que posteastes aqui :

  
  
local optimize = true -- Should the script be optimized? (if optimized, cannot be used client-side) 
local ids = {} 
exports.scoreboard:scoreboardAddColumn( "ID",90 ) -- La columna de ID 
  
function assignID() 
    for i=1,getMaxPlayers() do 
        if not ids[i] then 
            ids[i] = source 
            setElementData(source,"id",i,not optimize) 
            setElementData(source,"ID",i) -- Cuando entra al juego, se le asigna la ID 
            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 
  

Ahi puse los comentarios de lo que cambie

Ojala te sirva

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...