JkR Posted February 14, 2015 Share 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? Link to comment
darhal Posted February 14, 2015 Share Posted February 14, 2015 Explain more plz any debug error Link to comment
JkR Posted February 14, 2015 Author Share Posted February 14, 2015 Explain more plzany debug error I want to make one team can take the turf, no errors in the debugscript Link to comment
darhal Posted February 14, 2015 Share 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 Link to comment
JkR Posted February 14, 2015 Author Share 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 Link to comment
darhal Posted February 14, 2015 Share Posted February 14, 2015 Whats the team name you want to take thz turf Link to comment
darhal Posted February 14, 2015 Share 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 Link to comment
JkR Posted February 14, 2015 Author Share Posted February 14, 2015 Whats the team name you want to take thz turf "Equipo2" Link to comment
JkR Posted February 14, 2015 Author Share 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 Link to comment
JkR Posted February 14, 2015 Author Share 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 ) Link to comment
darhal Posted February 14, 2015 Share 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) Link to comment
JkR Posted February 14, 2015 Author Share 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? Link to comment
JkR Posted February 14, 2015 Author Share Posted February 14, 2015 Does it work ? No, because it's all in one line... Link to comment
darhal Posted February 14, 2015 Share Posted February 14, 2015 It should work evean at one line mta dont care about the organization of the code Link to comment
JkR Posted February 14, 2015 Author Share Posted February 14, 2015 It should work evean at one line mta dont care about the organization of the code doesn't work Link to comment
JR10 Posted February 15, 2015 Share 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 ) Link to comment
JkR Posted February 15, 2015 Author Share 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 Link to comment
JR10 Posted February 15, 2015 Share Posted February 15, 2015 You have two checks that you don't handle. Link to comment
JkR Posted February 15, 2015 Author Share Posted February 15, 2015 You have two checks that you don't handle. which? Link to comment
JR10 Posted February 15, 2015 Share 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. Link to comment
JkR Posted February 15, 2015 Author Share 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 Link to comment
JkR Posted February 15, 2015 Author Share 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 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