Jump to content

help


golanu21

Recommended Posts

local warn = {} 
function command (sourcePlayer, command, who) 
    if not who then 
        outputChatBox ( "Syntaxa Invalida:/warn NUMEJUCATOR." ) 
        return 
    end 
    name = getPlayerFromName(who) 
    if name then 
         local acc = getPlayerAccount ( sourcePlayer ) 
        local accName = getAccountName ( getPlayerAccount ( sourcePlayer ) ) -- get his account name 
            if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
                if not warn[ name ] then  -- hasn't got a warning yet 
                    warn[ name ] = 1 
                else 
                    warn[ name ] = warn[ name ] + 1 --alredy has waring(s), so give one more 
                    carne = setAccountData(acc, "warns", warn[ name ]) 
                    outputChatBox("Administratorul   " ..accName.." la avertizat pe : "..who..", si acum are "..warn[name].." avertisment(e)", getRootElement(), 255, 0, 0) 
                end 
                    if carne then 
                        outputChatBox("asdadad") 
                        end 
                    if warn[name] >= 3 then -- 3 warnings = ban 
                     
                        banPlayer(name, true, who, false, sourcePlayer, "Avertismente.", 0 ) 
                        outputChatBox("Jucatorul "..who.." a fost banat permanent din cauza avertisementelor.", getRootElement(), 255, 0, 0) 
                    end 
                end 
            end 
        end 
addCommandHandler("warn", command) 
  
  
addEventHandler("onPlayerLogin", getRootElement(), 
function (_, acc) 
if (acc) then 
carr = getAccountData(acc, "warns") 
end 
if carr then 
warn[ name ] = warn[ name ] 
outputChatBox("gfgfg") 
end 
end) 

the text asdadad is there... the account information is saved... but on Player Login ,, the text gfgfg is there but when i wse the command /warn..is start for the first number. 0

Link to comment
carne = setAccountData(acc, "warns", warn[ name ]) 

You are setting the warns of the player who executed the command, not whose who get warned.

And for the loign:

addEventHandler("onPlayerLogin", getRootElement(), 
    function (_, acc) 
        if (acc) then 
            carr = getAccountData(acc, "warns") 
        end 
        if carr then 
            warn[ source ] = tonumber ( carr ) 
            outputChatBox("gfgfg") 
        end 
    end) 

Link to comment
local warn = { } 
  
function command ( sourcePlayer, command, who ) 
    if ( not who ) then 
        outputChatBox ( "Syntaxa Invalida:/warn NUMEJUCATOR.", sourcePlayer ) 
        return 
    end 
  
    local name = getPlayerFromName ( who ) 
    if ( name ) then 
        local acc = getPlayerAccount ( sourcePlayer ) 
        local accName = getAccountName ( getPlayerAccount ( sourcePlayer ) ) -- get his account name 
        if isObjectInACLGroup ( "user.".. accName, aclGetGroup ( "Admin" ) ) then 
            if ( not warn[ name ] ) then  -- hasn't got a warning yet 
                warn [ name ] = 1 
            else 
                warn [ name ] = ( warn [ name ] + 1 ) --alredy has waring(s), so give one more 
                carne = setAccountData ( acc, "warns", warn [ name ] ) 
                outputChatBox ( "Administratorul ".. accName .." la avertizat pe : ".. who ..", si acum are ".. warn [ name ] .." avertisment(e)", getRootElement(), 255, 0, 0 ) 
            end 
            if ( carne ) then 
                outputChatBox ( "asdadad" ) 
            end 
            if ( warn [ name ] >= 3 ) then -- 3 warnings = ban 
                banPlayer ( name, true, who, false, sourcePlayer, "Avertismente.", 0 ) 
                outputChatBox ( "Jucatorul ".. who .." a fost banat permanent din cauza avertisementelor.", getRootElement(), 255, 0, 0 ) 
            end 
        end 
    end 
end 
addCommandHandler ( "warn", command ) 
  
addEventHandler ( "onPlayerLogin", getRootElement(), 
    function ( _, acc ) 
        local warns = tonumber ( getAccountData ( acc, "warns" ) ) or 0 
        warn [ name ] = warns 
    end 
) 

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...