'~DaLesTe^' Posted July 10, 2015 Posted July 10, 2015 function getPlayerFromID(id) return call(getResourceFromName("game_id2"), "getPlayerFromID", tonumber(id)) end function getPlayerID(player) return getElementData(player,"id") end function criarGang ( source, commandName, teamName ) local getaMoney = getPlayerMoney (source) if teamName then if getaMoney <5000 then outputChatBox("#7d26cd[sERVER] #FF0000Você não tem dinheiro suficiente para criar uma gang valor 5000$",source,255,255,255,true) else if ( getPlayerTeam(source) ~= false ) and ( countPlayersInTeam(getPlayerTeam(source)) == 1 ) then destroyElement(getPlayerTeam(source)) outputChatBox("#F4A460[sERVER]#F08080 Sua gang antiga foi deletada e foi criada uma nova!",source,255,255,255,true) end local newTeam = createTeam ( teamName) if newTeam then takePlayerMoney (source,300 ) local getGang = getTeamName ( newTeam ) setTeamColor (newTeam,math.random(0,255), math.random(0,255), math.random(0,255)) setPlayerTeam ( source, newTeam ) local playerTeam = getPlayerTeam( source ) outputChatBox("#43CD80[GANG] #FFFFFFGang criada com sucesso!",source, 255, 255, 255, true) end end else outputChatBox("#43CD80[GANG] #FFFFFFUso correto: /gangcriar [nome]",source,255,255,255,true) end end addCommandHandler("gangcriar",criarGang) addEventHandler("onPlayerLogin",root,function() local team = getAccountData (getPlayerAccount(source), "team") if (team==getTeamName(getTeamFromName(team))) then setPlayerTeam(source, getTeamFromName(team)) end end) function save() local team = getPlayerTeam(source) local account = getPlayerAccount(source) if not isGuestAccount(account) then if(team)then setAccountData(account, "team", getTeamName(team)) end end end addEventHandler("onPlayerLogout", root, save) addEventHandler("onPlayerQuit", root, save) function sairDaGang(source) local playerTeam = getPlayerTeam (source) if (playerTeam) then setPlayerTeam (source, nil) outputChatBox("#43CD80[GANG] #FFFFFFVocê saiu da gang",source,255,255,255,true) else outputChatBox("#43CD80[GANG] #ffffffVocê não tem gang",source,255,255,255,true) end end addCommandHandler("gangsair", sairDaGang) function desfazerGang (source) local playerVeri = getPlayerTeam (source) if (playerVeri) then destroyElement (playerVeri) outputChatBox("#43CD80[GANG] #FFFFFFVocê deletou sua gang",source,255,255,255,true) else outputChatBox("#43CD80[GANG] #FFFFFFVocê não tem gang",source,255,255,255,true) end end addCommandHandler("gangdeletar", desfazerGang) function enviarGang(source,cmd,targetPlayer) local target = getPlayerFromID (targetPlayer) local geta = getPlayerFromID (target) gang = getPlayerTeam (source) local getName = getTeamFromName(source) lala = getTeamName(source) local convidado = true setElementData(target, "gangConvite", gang, false) if gang == getName then outputChatBox("#43CD80[GANG] #FFFFFFVocê não pertence a nenhuma gang",source, 255, 255, 255, true) else outputChatBox("#43CD80[GANG] #FFFFFFConvite de recrutamento enviado para o Jogador " ..getPlayerName(target).. " ID: "..targetPlayer,source, 255, 255, 255, true) outputChatBox("#43CD80[GANG] #FFFFFFVocê foi convidado para a gang #43CD80" ..getTeamName(gang).. " #FFFFFFuse #43CD80/gangaceitar #FFFFFFpara entrar na Gang: #ffffff "..getTeamName(gang),target, 255, 255, 255, true) end end addCommandHandler("gangconvidar", enviarGang) function Recrutamento(source) local gangConvite = getElementData(source, "gangConvite") if isElement(gangConvite) then outputChatBox("#43CD80[GANG] #FFFFFFVocê entrou na gang "..getTeamName(gang),source, 255, 255, 255, true) setPlayerTeam (source, gangConvite) else outputChatBox("#43CD80[GANG] #FFFFFFVocê não foi convidado para nenhuma gang",source, 255, 255, 255, true) end end addCommandHandler("gangaceitar",Recrutamento) function gangCommands(thePlayer) outputChatBox ( "#7d26cd[GANG] #ffffffUse /gangcriar | /gangconvidar ID/Nome | /gangabandonar | /gangsair | /gangdeletar", thePlayer, 255, 255, 255, true ) end addCommandHandler ( "gang", gangCommands ) function getPlayerFromParticalName(thePlayerName) local thePlayer = getPlayerFromName(thePlayerName) if thePlayer then return thePlayer end for _,thePlayer in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), thePlayerName:lower(), 1, true) then return thePlayer end end return false end Since it is not possible to create a separate group named, for example, / gangcriar TE ST, which form the group only as the first word after space In conclusion it is not possible to create a gang with separate letters
DNL291 Posted July 11, 2015 Posted July 11, 2015 Use table.concat. function criarGang ( source, commandName, ... ) local getaMoney = getPlayerMoney (source) local teamName = table.concat({...}, " ") if teamName then if getaMoney <5000 then outputChatBox("#7d26cd[sERVER] #FF0000Você não tem dinheiro suficiente para criar uma gang valor 5000$",source,255,255,255,true) else if ( getPlayerTeam(source) ~= false ) and ( countPlayersInTeam(getPlayerTeam(source)) == 1 ) then destroyElement(getPlayerTeam(source)) outputChatBox("#F4A460[sERVER]#F08080 Sua gang antiga foi deletada e foi criada uma nova!",source,255,255,255,true) end local newTeam = createTeam ( teamName) if newTeam then takePlayerMoney (source,300 ) local getGang = getTeamName ( newTeam ) setTeamColor (newTeam,math.random(0,255), math.random(0,255), math.random(0,255)) setPlayerTeam ( source, newTeam ) local playerTeam = getPlayerTeam( source ) outputChatBox("#43CD80[GANG] #FFFFFFGang criada com sucesso!",source, 255, 255, 255, true) end end else outputChatBox("#43CD80[GANG] #FFFFFFUso correto: /gangcriar [nome]",source,255,255,255,true) end end addCommandHandler("gangcriar",criarGang)
'~DaLesTe^' Posted July 22, 2015 Author Posted July 22, 2015 How can I setting a tag to a player through his gang / group? Example /gangtag TST and the player gets the tag to insert Portuguese: Como posso fazer um comando que ao digitar /gangtag e logo em seguida a tag por exemplo: /gangtag TST o jogador receba a tag inserida em seu Nome : [TST]PlayerName..
DNL291 Posted July 22, 2015 Posted July 22, 2015 addCommandHandler( "gangtag", function ( source, cmdname, tag ) if tag and tag:len() <= 3 then return outputChatBox("A tag deve ter no máximo 3 caracteres.", source, 230, 0, 0) end if getPlayerTeam(source) and tag then setPlayerName(source, "["..tag.."]"..getPlayerName(source)) elseif not tag then outputChatBox("Sintaxe: /gangtag ", source, 230, 0, 0) end end )
'~DaLesTe^' Posted July 22, 2015 Author Posted July 22, 2015 addCommandHandler( "gangtag", function ( source, cmdname, tag ) if tag and tag:len() <= 3 then return outputChatBox("A tag deve ter no máximo 3 caracteres.", source, 230, 0, 0) end if getPlayerTeam(source) and tag then setPlayerName(source, "["..tag.."]"..getPlayerName(source)) elseif not tag then outputChatBox("Sintaxe: /gangtag ", source, 230, 0, 0) end end ) Portuguese: Quando vou digitar o comando diz que a tag deve ter no maximo 3 caracteres , mas está com 3 caracteres sim e não funciona English: When I type the command says that the tag must have at most three characters, but is 3 letters and don't work
GTX Posted July 22, 2015 Posted July 22, 2015 If you type in Portuguese, why don't you take this into Portuguese language forum? Anyways; addCommandHandler( "gangtag", function ( source, cmdname, tag ) if tag and tag:len() < 3 then return outputChatBox("A tag deve ter no máximo 3 caracteres.", source, 230, 0, 0) end if getPlayerTeam(source) and tag then setPlayerName(source, "["..tag.."]"..getPlayerName(source)) elseif not tag then outputChatBox("Sintaxe: /gangtag ", source, 230, 0, 0) end end )
'~DaLesTe^' Posted July 23, 2015 Author Posted July 23, 2015 If you type in Portuguese, why don't you take this into Portuguese language forum?Anyways; addCommandHandler( "gangtag", function ( source, cmdname, tag ) if tag and tag:len() < 3 then return outputChatBox("A tag deve ter no máximo 3 caracteres.", source, 230, 0, 0) end if getPlayerTeam(source) and tag then setPlayerName(source, "["..tag.."]"..getPlayerName(source)) elseif not tag then outputChatBox("Sintaxe: /gangtag ", source, 230, 0, 0) end end ) Thus a name that exceeds the number of characters not will have the tag Added ..
DNL291 Posted July 23, 2015 Posted July 23, 2015 Actually, I checked if the length of the tag was less or equal than 3, but I should check if it's greater. addCommandHandler( "gangtag", function ( source, cmdname, tag ) if tag and ( tag:len() > 3 or tag:len() == 0 ) then return outputChatBox("A tag deve ter no máximo 3 caracteres.", source, 230, 0, 0) end if getPlayerTeam(source) and tag then setPlayerName(source, "["..tag.."]"..getPlayerName(source)) elseif not tag then outputChatBox("Sintaxe: /gangtag ", source, 230, 0, 0) end end )
'~DaLesTe^' Posted July 23, 2015 Author Posted July 23, 2015 Actually, I checked if the length of the tag was less or equal than 3, but I should check if it's greater. addCommandHandler( "gangtag", function ( source, cmdname, tag ) if tag and ( tag:len() > 3 or tag:len() == 0 ) then return outputChatBox("A tag deve ter no máximo 3 caracteres.", source, 230, 0, 0) end if getPlayerTeam(source) and tag then setPlayerName(source, "["..tag.."]"..getPlayerName(source)) elseif not tag then outputChatBox("Sintaxe: /gangtag ", source, 230, 0, 0) end end ) É possivel adicionar a tag sem ser no Nome do Jogador mas sim uma tag Tipo desta forma: outputChatBox("#FF881F[" ..tag.. "]#FF0000 "..getPlayerName(source).."#FFFFFF(ID:"..IDx(source) ..")#FFFFFF:FFFFFF "..msg.."", getRootElement(), r, g, b, true)
t3wz Posted July 23, 2015 Posted July 23, 2015 É possivel adicionar a tag sem ser no Nome do Jogador mas sim uma tag Tipo desta forma: outputChatBox("#FF881F[" ..tag.. "]#FF0000 "..getPlayerName(source).."#FFFFFF(ID:"..IDx(source) ..")#FFFFFF:FFFFFF "..msg.."", getRootElement(), r, g, b, true) Please use only english in this section. if you want to speak in Portuguese go to this section.
'~DaLesTe^' Posted July 23, 2015 Author Posted July 23, 2015 É possivel adicionar a tag sem ser no Nome do Jogador mas sim uma tag Tipo desta forma: outputChatBox("#FF881F[" ..tag.. "]#FF0000 "..getPlayerName(source).."#FFFFFF(ID:"..IDx(source) ..")#FFFFFF:FFFFFF "..msg.."", getRootElement(), r, g, b, true) Please use only english in this section. if you want to speak in Portuguese go to this section. Sorry: English: It is possible to add the tag without being in the Player name but a tag Type this: outputChatBox("#FF881F[" ..tag.. "]#FF0000 "..getPlayerName(source).."#FFFFFF(ID:"..IDx(source) ..")#FFFFFF:FFFFFF "..msg.."", getRootElement(), r, g, b, true)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now