Jump to content

Help [TURF]


JkR

Recommended Posts

        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
  
  
       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
  
  
       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
  
        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
  
        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
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
  
  
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
  
  
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
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
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
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
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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...