JkR Posted February 14, 2015 Posted February 14, 2015 if (getPlayerTeam(p)) then NeedMsg(p,1) local pTeam = getPlayerTeam( p ) local teamName = getTeamName(pTeam) == "Equipo2" local iR, iG, iB = getTeamColor( pTeam ) local rR, gG, bB = getRadarAreaColor( pArea1 ) local data = getElementData(pCuboid1, "friendly") if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) and ( data == "yes" ) then HI! i want to make a turf but it can only take a team, I try this, but not work, any help?
JkR Posted February 14, 2015 Author Posted February 14, 2015 Explain more plzany debug error I want to make one team can take the turf, no errors in the debugscript
darhal Posted February 14, 2015 Posted February 14, 2015 if (getPlayerTeam(p)) then NeedMsg(p,1) local pTeam = getPlayerTeam( p ) local teamName = getTeamName(pTeam) == "Equipo2" local iR, iG, iB = getTeamColor( pTeam ) local rR, gG, bB = getRadarAreaColor( pArea1 ) local data = getElementData(pCuboid1, "friendly") if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) and ( data == "yes" ) and teamName then the code is messy because i use phone
JkR Posted February 14, 2015 Author Posted February 14, 2015 if (getPlayerTeam(p)) then NeedMsg(p,1) local pTeam = getPlayerTeam( p ) local teamName = getTeamName(pTeam) == "Equipo2" local iR, iG, iB = getTeamColor( pTeam ) local rR, gG, bB = getRadarAreaColor( pArea1 ) local data = getElementData(pCuboid1, "friendly") if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) and ( data == "yes" ) and teamName then the code is messy because i use phone Doesn't work
darhal Posted February 14, 2015 Posted February 14, 2015 Whats the team name you want to take thz turf
darhal Posted February 14, 2015 Posted February 14, 2015 if (getPlayerTeam(p)) then NeedMsg(p,1) local pTeam = getPlayerTeam( p ) local teamName = getTeamName(pTeam) == "Equipo2" local iR, iG, iB = getTeamColor( pTeam ) local rR, gG, bB = getRadarAreaColor( pArea1 ) local data = getElementData(pCuboid1, "friendly") if teamName then
JkR Posted February 14, 2015 Author Posted February 14, 2015 Whats the team name you want to take thz turf "Equipo2"
JkR Posted February 14, 2015 Author Posted February 14, 2015 if (getPlayerTeam(p)) then NeedMsg(p,1) local pTeam = getPlayerTeam( p ) local teamName = getTeamName(pTeam) == "Equipo2" local iR, iG, iB = getTeamColor( pTeam ) local rR, gG, bB = getRadarAreaColor( pArea1 ) local data = getElementData(pCuboid1, "friendly") if teamName then doesn't work too
JkR Posted February 14, 2015 Author Posted February 14, 2015 function NeedMsg(p,n,getOwnedBy) if (n) then outputChatBox(unpack(messages[n])) end end --[[ ZONE CREATION ]]-- addEventHandler('onColShapeHit', pCuboid1, function(p) NeedMsg(p,6) if (getPlayerTeam(p)) then NeedMsg(p,1) local pTeam = getPlayerTeam( p ) local teamName = getTeamName(pTeam) == "Equipo2" local iR, iG, iB = getTeamColor( pTeam ) local rR, gG, bB = getRadarAreaColor( pArea1 ) local data = getElementData(pCuboid1, "friendly") if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) and ( data == "yes" ) then elseif ( pTeam ) and ( teamName ) then else setRadarAreaFlashing( pArea1, true ) capturing = setTimer( function( ) setElementData(pCuboid1, "friendly", "yes") setElementData(pCuboid1, "ownedBy", getTeamName(pTeam)) givePlayerMoney( p, 4000 ) NeedMsg(p,4) setRadarAreaColor( pArea1, iR, iG, iB ) setRadarAreaFlashing( pArea1, false ) end, 6000, 1 ) end else NeedMsg(p,3) end if (getPedOccupiedVehicle( p )) then NeedMsg(p,5) end end ) addEventHandler('onColShapeLeave', pCuboid1, function(p) setRadarAreaFlashing( pArea1, false ) if isTimer(capturing) then killTimer(capturing) end NeedMsg(p,7) end )
darhal Posted February 14, 2015 Posted February 14, 2015 function NeedMsg(p,n,getOwnedBy)if (n) thenoutputChatBox(unpack(messages[n]))end end addEventHandler('onColShapeHit', pCuboid1, function(p) NeedMsg(p,6) if (getPlayerTeam(p)) then NeedMsg(p,1) local pTeam = getPlayerTeam( p ) local teamName = getTeamName(pTeam) == "Equipo2" local iR, iG, iB = getTeamColor( pTeam ) local rR, gG, bB = getRadarAreaColor( pArea1 ) local data = getElementData(pCuboid1, "friendly") if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) and ( data == "yes" )then return end elseif ( pTeam ) and ( teamName ) then setRadarAreaFlashing( pArea1, true ) capturing = setTimer( function( ) setElementData(pCuboid1, "friendly", "yes") setElementData(pCuboid1, "ownedBy", getTeamName(pTeam)) givePlayerMoney( p, 4000 ) NeedMsg(p,4) setRadarAreaColor( pArea1, iR, iG, iB ) setRadarAreaFlashing( pArea1, false ) end, 6000, 1 ) end else NeedMsg(p,3) end if (getPedOccupiedVehicle( p )) then NeedMsg(p,5) end end)addEventHandler('onColShapeLeave', pCuboid1, function(p) setRadarAreaFlashing( pArea1, false ) if isTimer(capturing) then killTimer(capturing) end NeedMsg(p,7) end)
JkR Posted February 14, 2015 Author Posted February 14, 2015 function NeedMsg(p,n,getOwnedBy)if (n) thenoutputChatBox(unpack(messages[n]))end end addEventHandler('onColShapeHit', pCuboid1, function(p) NeedMsg(p,6) if (getPlayerTeam(p)) then NeedMsg(p,1) local pTeam = getPlayerTeam( p ) local teamName = getTeamName(pTeam) == "Equipo2" local iR, iG, iB = getTeamColor( pTeam ) local rR, gG, bB = getRadarAreaColor( pArea1 ) local data = getElementData(pCuboid1, "friendly") if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) and ( data == "yes" )then return end elseif ( pTeam ) and ( teamName ) then setRadarAreaFlashing( pArea1, true ) capturing = setTimer( function( ) setElementData(pCuboid1, "friendly", "yes") setElementData(pCuboid1, "ownedBy", getTeamName(pTeam)) givePlayerMoney( p, 4000 ) NeedMsg(p,4) setRadarAreaColor( pArea1, iR, iG, iB ) setRadarAreaFlashing( pArea1, false ) end, 6000, 1 ) end else NeedMsg(p,3) end if (getPedOccupiedVehicle( p )) then NeedMsg(p,5) end end)addEventHandler('onColShapeLeave', pCuboid1, function(p) setRadarAreaFlashing( pArea1, false ) if isTimer(capturing) then killTimer(capturing) end NeedMsg(p,7) end) Can you send me the ordered code?
JkR Posted February 14, 2015 Author Posted February 14, 2015 Does it work ? No, because it's all in one line...
darhal Posted February 14, 2015 Posted February 14, 2015 It should work evean at one line mta dont care about the organization of the code
JkR Posted February 14, 2015 Author Posted February 14, 2015 It should work evean at one line mta dont care about the organization of the code doesn't work
JR10 Posted February 15, 2015 Posted February 15, 2015 function NeedMsg(p,n,getOwnedBy) if (n) then outputChatBox(unpack(messages[n])) end end --[[ ZONE CREATION ]]-- addEventHandler('onColShapeHit', pCuboid1, function(p) NeedMsg(p,6) local pTeam = getPlayerTeam( p ) if (not pTeam) then return end local teamName = getTeamName(pTeam) if (teamName == "Equipo2") then NeedMsg(p,1) local iR, iG, iB = getTeamColor( pTeam ) local rR, gG, bB = getRadarAreaColor( pArea1 ) local data = getElementData(pCuboid1, "friendly") if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) and ( data == "yes" ) then elseif ( pTeam ) and ( teamName ) then else setRadarAreaFlashing( pArea1, true ) capturing = setTimer( function( ) setElementData(pCuboid1, "friendly", "yes") setElementData(pCuboid1, "ownedBy", getTeamName(pTeam)) givePlayerMoney( p, 4000 ) NeedMsg(p,4) setRadarAreaColor( pArea1, iR, iG, iB ) setRadarAreaFlashing( pArea1, false ) end, 6000, 1 ) end else NeedMsg(p,3) end if (getPedOccupiedVehicle( p )) then NeedMsg(p,5) end end ) addEventHandler('onColShapeLeave', pCuboid1, function(p) setRadarAreaFlashing( pArea1, false ) if isTimer(capturing) then killTimer(capturing) end NeedMsg(p,7) end )
JkR Posted February 15, 2015 Author Posted February 15, 2015 function NeedMsg(p,n,getOwnedBy) if (n) then outputChatBox(unpack(messages[n])) end end --[[ ZONE CREATION ]]-- addEventHandler('onColShapeHit', pCuboid1, function(p) NeedMsg(p,6) local pTeam = getPlayerTeam( p ) if (not pTeam) then return end local teamName = getTeamName(pTeam) if (teamName == "Equipo2") then NeedMsg(p,1) local iR, iG, iB = getTeamColor( pTeam ) local rR, gG, bB = getRadarAreaColor( pArea1 ) local data = getElementData(pCuboid1, "friendly") if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) and ( data == "yes" ) then elseif ( pTeam ) and ( teamName ) then else setRadarAreaFlashing( pArea1, true ) capturing = setTimer( function( ) setElementData(pCuboid1, "friendly", "yes") setElementData(pCuboid1, "ownedBy", getTeamName(pTeam)) givePlayerMoney( p, 4000 ) NeedMsg(p,4) setRadarAreaColor( pArea1, iR, iG, iB ) setRadarAreaFlashing( pArea1, false ) end, 6000, 1 ) end else NeedMsg(p,3) end if (getPedOccupiedVehicle( p )) then NeedMsg(p,5) end end ) addEventHandler('onColShapeLeave', pCuboid1, function(p) setRadarAreaFlashing( pArea1, false ) if isTimer(capturing) then killTimer(capturing) end NeedMsg(p,7) end ) Now works team, but when you enter the turf being the team not the turf is won
JkR Posted February 15, 2015 Author Posted February 15, 2015 You have two checks that you don't handle. which?
JR10 Posted February 15, 2015 Posted February 15, 2015 f ( iR == rR ) and ( iG == gG ) and ( iB == bB ) and ( data == "yes" ) then elseif ( pTeam ) and ( teamName ) then If the first one doesn't resolve to true, the second one will. You don't have any code under elseif, so nothing will happen. Perhaps this is what you want: function NeedMsg(p,n,getOwnedBy) if (n) then outputChatBox(unpack(messages[n])) end end --[[ ZONE CREATION ]]-- addEventHandler('onColShapeHit', pCuboid1, function(p) NeedMsg(p,6) local pTeam = getPlayerTeam( p ) if (not pTeam) then return end local teamName = getTeamName(pTeam) if (teamName == "Equipo2") then NeedMsg(p,1) local iR, iG, iB = getTeamColor( pTeam ) local rR, gG, bB = getRadarAreaColor( pArea1 ) local data = getElementData(pCuboid1, "friendly") if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) and ( data == "yes" ) then setRadarAreaFlashing( pArea1, true ) capturing = setTimer( function( ) setElementData(pCuboid1, "friendly", "yes") setElementData(pCuboid1, "ownedBy", getTeamName(pTeam)) givePlayerMoney( p, 4000 ) NeedMsg(p,4) setRadarAreaColor( pArea1, iR, iG, iB ) setRadarAreaFlashing( pArea1, false ) end, 6000, 1 ) end else NeedMsg(p,3) end if (getPedOccupiedVehicle( p )) then NeedMsg(p,5) end end ) addEventHandler('onColShapeLeave', pCuboid1, function(p) setRadarAreaFlashing( pArea1, false ) if isTimer(capturing) then killTimer(capturing) end NeedMsg(p,7) end ) Again I'm not sure.
JkR Posted February 15, 2015 Author Posted February 15, 2015 f ( iR == rR ) and ( iG == gG ) and ( iB == bB ) and ( data == "yes" ) then elseif ( pTeam ) and ( teamName ) then If the first one doesn't resolve to true, the second one will. You don't have any code under elseif, so nothing will happen. Perhaps this is what you want: function NeedMsg(p,n,getOwnedBy) if (n) then outputChatBox(unpack(messages[n])) end end --[[ ZONE CREATION ]]-- addEventHandler('onColShapeHit', pCuboid1, function(p) NeedMsg(p,6) local pTeam = getPlayerTeam( p ) if (not pTeam) then return end local teamName = getTeamName(pTeam) if (teamName == "Equipo2") then NeedMsg(p,1) local iR, iG, iB = getTeamColor( pTeam ) local rR, gG, bB = getRadarAreaColor( pArea1 ) local data = getElementData(pCuboid1, "friendly") if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) and ( data == "yes" ) then setRadarAreaFlashing( pArea1, true ) capturing = setTimer( function( ) setElementData(pCuboid1, "friendly", "yes") setElementData(pCuboid1, "ownedBy", getTeamName(pTeam)) givePlayerMoney( p, 4000 ) NeedMsg(p,4) setRadarAreaColor( pArea1, iR, iG, iB ) setRadarAreaFlashing( pArea1, false ) end, 6000, 1 ) end else NeedMsg(p,3) end if (getPedOccupiedVehicle( p )) then NeedMsg(p,5) end end ) addEventHandler('onColShapeLeave', pCuboid1, function(p) setRadarAreaFlashing( pArea1, false ) if isTimer(capturing) then killTimer(capturing) end NeedMsg(p,7) end ) Again I'm not sure. Forget it, i fix it was elseif ( pTeam ) and ( teamName ) then
JkR Posted February 15, 2015 Author Posted February 15, 2015 I have new problem!!! messages to all players are shown, and I want to show only the source messages = { [1] = {"Sobrevive 10 minutos para capturar esta zona",p,255, 255, 255,true}, [2] = {"Entrando a una zona aliada",p,255, 255, 255,true}, [3] = {"Necesitas estar en un clan para conquistar un turf",p,255, 255, 255,true}, [4] = {"Has capturado la zona",p,255, 255, 255,true}, [5] = {"Debes entrar a la zona sin vehiculos",p,255, 255, 255,true}, [6] = {"Estas entrando a una zona",p,255, 255, 255,true}, [7] = {"Estas saliendo de una zona",p,255, 255, 255,true} } function NeedMsg(p,n,source) if (n) then outputChatBox(unpack(messages[n])) end end
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