Created
September 14, 2014 03:30
-
-
Save anonymous/26d8d036b20d74133867 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cCriar (player, cmd, cor, tag, ...) | |
local account = getPlayerAccount(player) | |
if cor and tag and {...} then | |
if tag:len() < 6 then | |
if not({...} == "") then | |
local name = table.concat({...}," ") | |
if checkTeamName(name) == false then | |
if hex2rgb(cor) then | |
createTeam(name, hex2rgb(cor)) | |
outputChatBox ("Clã criado com sucesso!", player) | |
-- ARMAZENAR TAG | |
-- ARMAZENAR NOME | |
-- ARMAZENAR COR | |
-- ARMAZENAR LÍDER | |
else | |
outputChatBox ("Código de cor inválido.", player) | |
end | |
else | |
outputChatBox ("Nome da gang já em uso.", player) | |
end | |
else | |
outputChatBox ("Mencione o nome do clã corretamente.", player) | |
end | |
else | |
outputChatBox ("Limite de caracteres da tag excedido. (Limite: 5)", player) | |
end | |
else | |
outputChatBox ("Alguns argumentos estão faltando.", player) | |
end | |
end | |
addCommandHandler ("ccriar", cCriar) | |
function checkTeamName(name) | |
for i,t in ipairs(getElementsByType('team')) do | |
if name == getTeamName(t) then | |
return true | |
else | |
return false | |
end | |
end | |
end | |
function hex2rgb(hex) | |
hex = hex:gsub("#","") | |
return tonumber("0x"..hex:sub(1,2)), tonumber("0x"..hex:sub(3,4)), tonumber("0x"..hex:sub(5,6)) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment