Jump to content

[AJUDA] Setelementdata


Recommended Posts

serials = { 
    {"01",2}, 
    {"02",2} 
  
} 
  
  
function banotrotipo (player) 
    for i , playerserial in ipairs(serials) do 
     outputChatBox(tostring(playerserial[1])) 
   
    local serialdoplayer = getPlayerSerial(source) 
    local accountaplayer = getPlayerAccount(source) 
    if (serialdoplayer == playerserial[1]) then 
    if player then 
  
    setElementData(player, "MAX_Slots", -1) 
    outputChatBox(tostring(player))    
       end 
     end 
   end 
end 
  
  
--function punisao () 
  
    --setElementData(source, "MAX_Slots", -1) 
     
--end 
addEventHandler( "onPlayerLogin",getRootElement(),banotrotipo,source) 

o erro que da e em setElementData(player, "MAX_Slots", -1)

o resto esta funcionando so tirei o serial dali de cima para evitar coloka aki =)

Link to comment
serials = { 
    {"01",2}, 
    {"02",2} 
} 
  
  
function banotrotipo () 
    for i , playerserial in ipairs(serials) do 
     outputChatBox(tostring(playerserial[1])) 
  
    local serialdoplayer = getPlayerSerial(source) 
    local accountaplayer = getPlayerAccount(source) 
    if (serialdoplayer == playerserial[1]) then 
    if source then 
  
    setElementData(source, "MAX_Slots", -1) 
    outputChatBox(getPlayerName(source))   
       end 
     end 
   end 
end 
addEventHandler( "onPlayerLogin",getRootElement(),banotrotipo,source) 

Link to comment
serials = { 
    {"01",2}, 
    {"02",2} 
} 
  
  
function banotrotipo () 
    for i , playerserial in ipairs(serials) do 
     outputChatBox(tostring(playerserial[1])) 
  
    local serialdoplayer = getPlayerSerial(source) 
    local accountaplayer = getPlayerAccount(source) 
    if (serialdoplayer == playerserial[1]) then 
    if source then 
  
    setElementData(source, "MAX_Slots", -1) 
    outputChatBox(getPlayerName(source))   
       end 
     end 
   end 
end 
addEventHandler( "onPlayerLogin",getRootElement(),banotrotipo,source) 

nao da erro nenhum mais tb nao acontece nada ,, o setelementdata continua nao aplicando ..

Link to comment
serials = { 
    {"SERIAL AQUI",2} 
} 
  
function banotrotipo ( ) 
    for _, v in ipairs ( serials ) do 
        if ( getPlayerSerial ( source ) == v[1] ) do 
            setElementData( source, "MAX_Slots", -1 ) 
            outputChatBox( tostring(source) )   
        end 
    end 
end 
addEventHandler( "onPlayerLogin",getRootElement(),banotrotipo) 

Ou:

serials = { 
    ["SERIAL AQUI"] = true 
} 
  
function banotrotipo ( ) 
    if serials[getPlayerSerial ( source )] then 
        setElementData( source, "MAX_Slots", -1 ) 
        outputChatBox( tostring(source) )   
    end 
end 
addEventHandler( "onPlayerLogin",getRootElement(),banotrotipo) 

Link to comment
serials = { 
    {"SERIAL AQUI",2} 
} 
  
function banotrotipo ( ) 
    for _, v in ipairs ( serials ) do 
        if ( getPlayerSerial ( source ) == v[1] ) do 
            setElementData( source, "MAX_Slots", -1 ) 
            outputChatBox( tostring(source) )   
        end 
    end 
end 
addEventHandler( "onPlayerLogin",getRootElement(),banotrotipo) 

Ou:

serials = { 
    ["SERIAL AQUI"] = true 
} 
  
function banotrotipo ( ) 
    if serials[getPlayerSerial ( source )] then 
        setElementData( source, "MAX_Slots", -1 ) 
        outputChatBox( tostring(source) )   
    end 
end 
addEventHandler( "onPlayerLogin",getRootElement(),banotrotipo) 

bom o seu primeiro retorno no chat userdata: 00005876

mais nao foi aplicado o setelement

Link to comment

Tente isto:

serials = { 
    ["9C9F3B55D9D7BB7135FF274D3BF444E4"] = true, 
    ["1D6F76CF8D7193792D13789849498452"] = true, 
} 
  
function aologar() 
local serial = serials[getPlayerSerial(source)] 
    if serial == true then 
        setElementData(source, "MAX_Slots", -1) 
        outputChatBox(source.."; Nick:"..getPlayerName(source)) 
        outputChatBox(tonumber(getElementData(source, "MAX_Slots"))) 
    end 
end 
addEventHandler("onPlayerLogin",getRootElement(),aologar) 

Link to comment
serials = { 
    ["0116586626DD995B46B8B69F1A1B1BE3"] = true, 
} 
  
function onPlayerLogin() 
    if serials[getPlayerSerial(source)] then 
        setElementData(source, "MAX_Slots",-1) 
        --outputDebugString(getElementData(source,"MAX_Slots"))   
    end 
end 
addEventHandler("onPlayerLogin",root,onPlayerLogin) 

Link to comment
serials = { 
    ["0116586626DD995B46B8B69F1A1B1BE3"] = true, 
} 
  
function onPlayerLogin() 
    if serials[getPlayerSerial(source)] then 
        setElementData(source, "MAX_Slots",-1) 
        --outputDebugString(getElementData(source,"MAX_Slots"))   
    end 
end 
addEventHandler("onPlayerLogin",root,onPlayerLogin) 

nao funciono amigo

Impossível, Todos os códigos aqui postados funcionam perfeitamente, tem certeza que é esse o nome da element data que você quer setar e que o código esta no lado do servidor?

sim ta em lado servidor.

Link to comment
Eu testei o código que eu postei aqui, e funcionou perfeitamente.

na minha opnião o codigo devia fica assim...

serials = { 
    ["0000000000000000000000000000000"] = true, 
} 
  
function onPlayerLogin() 
    if serials[getPlayerSerial(source)] then 
        setElementData(source, "MAX_Slots",-1) 
        --outputDebugString(getElementData(source,"MAX_Slots"))   
        outputChatBox("OK VOCE TA LOGADO") 
        local slotsplayers = getElementData(source, "MAX_Slots") 
        outputChatBox(slotsplayers) 
    end 
end 
  
  
  
function delaytimefunction () 
  
    setTimer(onPlayerLogin,2000,1) 
end 
  
addEventHandler("onPlayerLogin",root,delaytimefunction) 

mais eu to meio q apredendo ainda.. entao da erro na linha 6 q seria o getplayerserial

Link to comment
Não há necessidade de um timer. Você esta trocando o serial que está na tabela pelo seu serial? Oque você está tentando criar? E poste seu meta.xml aqui.

sim to trocando o serial.. como falei acho que o timer resolve.. mais eu nao sei leva o source para a função q foi chamada pelo timer.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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