Jump to content

Skin Privado Por Cuentas [Derechos Propios]


Recommended Posts

Posted

Veo que estás comenazando, eso sólo sirve para una cuenta. Podrías hacer una tabla con varias cuentas. Si tienes alguna duda sobre ello no dudes en preguntar :)

Posted

por ejemplo yo cree otro para clanes , me base al gang system de castillo

function SkinClan ( player)

if getElementType (player) == "player" and

if getElementData(source, "gang" ) == "Clan" then

setElementModel(player, 299)

setElementData(player, "skin",299)

outputChatBox("#5000FF[skin]:#FFFFFFTes has puesto tu Skin",player,255,255,255,true)

else

outputChatBox("#5000FF[skin]:#FFFFFFAcceso Denegado",player,84,84,84,true)

end

end

end

addCommandHandler("skin",SkinClan)

Posted
dany solo lo cree para una cuenta xD , y gracias por la idea de las tablas

En el título del post dice "cuentas", aquí te dejo un código mejorado por si te sirve.

accountTable = {"manolo", "farragusa", "follamierda"} 
  
function isAccountInTable(account) 
    for i = 1, #accountTable do 
        if accountTable[i] == account then 
            return true 
        elseif i == #accountTable and accountTable[i] ~= account then 
            return false 
        end 
    end 
end 
  
addCommandHandler("skin", 
    function(player) 
        local playerAccount = getPlayerAccount(player) 
        local accountName = getAccountName(playerAccount) 
        if isAccountInTable(accountName) == true then 
            outputChatBox("#5000FF[skin]#FFFFFF Te has puesto tu skin.", player, 84, 84, 84, true) 
            setElementModel(player, 299) 
            setElementData(player, "skin", 299) 
        else 
            outputChatBox("#5000FF[skin]#FFFFFF Acceso denegado.", player, 84, 84, 84, true) 
        end 
    end 
) 

PD: También, si quieres, se puede hacer un skin distinto para cada cuenta.

  • 2 weeks later...
Posted

La funcion compara valores sin sentido, lo que aumenta el uso de CPU, usa el de color verde, en vez del rojo (Que es el original)

function isAccountInTable(account) 
    for i = 1, #accountTable do 
        if accountTable[i] == account then 
            return true 
        elseif i == #accountTable and accountTable[i] ~= account then 
            return false 
        end 
    end 
end 

function isAccountInTable(account) 
    for k,v in ipairs(accountTable) do 
        if v == account then 
            return true 
        end 
    end 
return false 
end 

Posted
La funcion compara valores sin sentido, lo que aumenta el uso de CPU, usa el de color verde, en vez del rojo (Que es el original)

function isAccountInTable(account) 
    for i = 1, #accountTable do 
        if accountTable[i] == account then 
            return true 
        elseif i == #accountTable and accountTable[i] ~= account then 
            return false 
        end 
    end 
end 

function isAccountInTable(account) 
    for k,v in ipairs(accountTable) do 
        if v == account then 
            return true 
        end 
    end 
return false 
end 

Tienes razón, lo tendré en cuenta para la próx.

Posted

No hace falta hacer loops, lo podes hacer de esta manera:

local accountsTable = 
    { 
        [ "bob" ] = true, 
        [ "bob2" ] = true, 
        [ "bob3" ] = true 
    } 
  
function isAccountInTable ( account ) 
    return ( accountsTable [ account ] or false ) 
end 

  • 1 year later...
  • 3 weeks later...
  • Recently Browsing   0 members

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