MaRcell Posted August 19, 2016 Share Posted August 19, 2016 I'm good with a problem with my gang system when the player dies he leaves the gang someone could help ? function criarGang ( source, commandName, teamName ) local getaMoney = getPlayerMoney (source) if teamName then if getaMoney <400000 then outputChatBox("#F4A460[sERVER]#F08080 Você não tem dinheiro suficiente para criar uma gang Valor 4.000$",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,400000 ) 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("#F4A460[sERVER]#F08080 Gang criada com sucesso!! Valor 4.000$",source, 255, 255, 255, true) end end else outputChatBox("#F4A460[sERVER]#F08080 Uso correto: /fundargang [nome]",source,255,255,255,true) end end addCommandHandler("fundargang",criarGang) addEventHandler("onPlayerLogin",root,function() local team = getAccountData (getPlayerAccount(source), "team") if (team==getTeamName(getTeamFromName(team))) then setPlayerTeam(source, getTeamFromName(team)) end end) 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("#F4A460[sERVER]#F08080 Você saiu da gang",source,255,255,255,true) else outputChatBox("#F4A460[sERVER]#F08080 Você não tem gang",source,255,255,255,true) end end addCommandHandler("abandonargang", sairDaGang) function desfazerGang (source) local playerVeri = getPlayerTeam (source) if (playerVeri) then destroyElement (playerVeri) outputChatBox("#F4A460[sERVER]#F08080 Você deletou sua gang",source,255,255,255,true) else outputChatBox("#F4A460[sERVER]#F08080 Você não tem gang",source,255,255,255,true) end end addCommandHandler("deletargang", desfazerGang) function enviarGang(source,cmd,targetPlayer) local target = getPlayerFromName (targetPlayer) local geta = getPlayerName (target) gang = getPlayerTeam (source) local getName = getTeamFromName(source) lala = getTeamName(source) local convidado = true setElementData(target, "gangConvite", gang, false) if gang == getName then outputChatBox("#F4A460[sERVER]#F08080 Você não pertence a nenhuma gang",source, 255, 255, 255, true) else outputChatBox("#F4A460[sERVER]#F08080 Convite de recrutamento enviado para "..targetPlayer,source, 255, 255, 255, true) outputChatBox("#F4A460[sERVER]#F08080 Você foi convidado para o recrutamento digite /aceitargang Gang: "..getTeamName(gang),target, 255, 255, 255, true) end end addCommandHandler("recrutargang", enviarGang) function Recrutamento(source) local gangConvite = getElementData(source, "gangConvite") if isElement(gangConvite) then outputChatBox("#F4A460[sERVER]#F08080 Você entrou na gang "..getTeamName(gang),source, 255, 255, 255, true) setPlayerTeam (source, gangConvite) else outputChatBox("#F4A460[sERVER]#F08080 Você não foi convidado para nenhuma gang",source, 255, 255, 255, true) end end addCommandHandler("aceitargang",Recrutamento) Link to comment
..:D&G:.. Posted August 20, 2016 Share Posted August 20, 2016 That code shows nothing regarding to your issue. Try looking in the other script files, look for the event "onPlayerWasted" Link to comment
MaRcell Posted August 20, 2016 Author Share Posted August 20, 2016 the problem will be that you can ta in gamemode play ? Link to comment
roaddog Posted August 20, 2016 Share Posted August 20, 2016 Add this addEventHandler("onPlayerSpawn", root, function() local team = getAccountData (getPlayerAccount(source), "team") local team = getTeamFromName(team) if not team then return end setPlayerTeam(source, team) end) Link to comment
MaRcell Posted August 20, 2016 Author Share Posted August 20, 2016 add in my gang system? Link to comment
MaRcell Posted August 21, 2016 Author Share Posted August 21, 2016 still dying and leaving the gang / = Link to comment
roaddog Posted August 21, 2016 Share Posted August 21, 2016 Anything in debugscript 3? Link to comment
MaRcell Posted August 21, 2016 Author Share Posted August 21, 2016 not to anything error in / debugscript 3 Link to comment
roaddog Posted August 21, 2016 Share Posted August 21, 2016 Try debugging the script like put outputChatBox(tostring(team)) after line 2 and 3 and 5 Link to comment
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