Jump to content

Turf system


TheIceman1

Recommended Posts

When i enter the turf, nothing happens.(Using castillos gang system.)

local beachTurfA = createRadarArea( 352.93, -2025.23, 100, -90, 255, 255, 255, 125 ) 
local beachTurfC = createColRectangle ( 352.93, -2025.23, 100, -90 ) 
  
function beachTurf(player) 
    if (getElementData( player, "gang" )) then 
     local gang = getElementData( player, "gang" ) 
     local r, g, b = exports [ "gang_system" ]:getGangColor ( gang ) 
     setRadarAreaFlashing ( beachTurfA, true ) 
     exports ["guimessages"] : outputServer ( player, "You entered the turf!" , 255, 0, 0 ) 
     beachturfTimer = setTimer ( function(player) 
     setRadarAreaColor ( beachTurfA, r, g, b, 100 ) 
     exports ["guimessages"] : outputServer ( player, "Congratulations,your gang take this turf!" , 255, 0, 0 ) 
     givePlayerMoney ( player, 2000 ) 
     setRadarAreaFlashing ( beachTurfA, false ) 
     end, 10000, 1 ) 
    end 
end 
addEventHandler ( "onColShapeHit", beachTurfC, beachTurf ) 

Edited by Guest
Link to comment

try this and tell me what output's in the chat:

function beachTurf(player) 
    if (getElementData( player, "gang" )) then 
     local playerGang = getElementData( player, "gang" ) 
     if (playerGang) then 
     outputChatBox('executed', player, 255, 255, 255) 
     else 
     outputChatBox('failed',player,255,255,255) 
     end 
     local r, g, b = exports [ "gang_system" ]:getGangColor ( playerGang ) 
     setRadarAreaFlashing ( beachTurfA, true ) 
     exports ["guimessages"] : outputServer ( player, "You entered the turf!" , 255, 0, 0 ) 
     beachturfTimer = setTimer ( function(player) 
     setRadarAreaColor ( beachTurfA, r, g, b, 100 ) 
     exports ["guimessages"] : outputServer ( player, "Congratulations,your gang take this turf!" , 255, 0, 0 ) 
     givePlayerMoney ( player, 2000 ) 
     setRadarAreaFlashing ( beachTurfA, false ) 
     end, 10000, 1 ) 
    end 
end 
addEventHandler ( "onColShapeHit", beachTurfC, beachTurf ) 

Link to comment
I got the message in chat "executed," and I got the message("guimessages") "You entered the turf!" and "You left the turf!",but in debug script says "Bad argument @ setRadarAreaColor [ Expected number at argument 2, got table]

Bad argument @ "givePlayerMoney".

And it happens only when i left turf.

Link to comment
function beachTurf(player) 
    if (getElementData( player, "gang" )) then 
     local playerGang = getElementData( player, "gang" ) 
     if (playerGang) then 
     outputChatBox('executed', player, 255, 255, 255) 
     else 
     outputChatBox('failed',player,255,255,255) 
     end 
     local r, g, b = exports [ "gang_system" ]:getGangColor ( playerGang ) 
     setRadarAreaFlashing ( beachTurfA, true ) 
     exports ["guimessages"] : outputServer ( player, "You entered the turf!" , 255, 0, 0 ) 
     beachturfTimer = setTimer ( function(player) 
     setRadarAreaColor ( beachTurfA, tonumber(r), tonumber(g), tonumber(b), 100 ) 
     exports ["guimessages"] : outputServer ( player, "Congratulations,your gang take this turf!" , 255, 0, 0 ) 
     givePlayerMoney ( player, 2000 ) 
     setRadarAreaFlashing ( beachTurfA, false ) 
     end, 10000, 1 ) 
    end 
end 
addEventHandler ( "onColShapeHit", beachTurfC, beachTurf ) 

Nothing happens.

Link to comment

getGangColor returns a table, you must unpack it.

function beachTurf(player) 
    if (getElementData( player, "gang" )) then 
     local playerGang = getElementData( player, "gang" ) 
     if (playerGang) then 
     outputChatBox('executed', player, 255, 255, 255) 
     else 
     outputChatBox('failed',player,255,255,255) 
     end 
     local r, g, b = unpack ( exports [ "gang_system" ]:getGangColor ( playerGang ) ) 
     setRadarAreaFlashing ( beachTurfA, true ) 
     exports ["guimessages"] : outputServer ( player, "You entered the turf!" , 255, 0, 0 ) 
     beachturfTimer = setTimer ( function(player) 
     setRadarAreaColor ( beachTurfA, tonumber(r), tonumber(g), tonumber(b), 100 ) 
     exports ["guimessages"] : outputServer ( player, "Congratulations,your gang take this turf!" , 255, 0, 0 ) 
     givePlayerMoney ( player, 2000 ) 
     setRadarAreaFlashing ( beachTurfA, false ) 
     end, 10000, 1 ) 
    end 
end 
addEventHandler ( "onColShapeHit", beachTurfC, beachTurf ) 

Link to comment

Why this dont work?Nothing happens when i enter the turf.

function beachTurf(player) 
    if (getElementData( player, "gang" )) then 
     local playerGang = getElementData( player, "gang" ) 
     if (playerGang) then 
     local r, g, b = unpack ( exports [ "gang_system" ]:getGangColor ( playerGang ) ) 
     setRadarAreaFlashing ( beachTurfA, true ) 
     exports ["guimessages"] : outputServer ( player, "You entered the turf!" , 255, 0, 0 ) 
     beachturfTimer = setTimer ( function(player) 
     setRadarAreaColor ( beachTurfA, tonumber(r), tonumber(g), tonumber(b), 100 ) 
     exports ["guimessages"] : outputServer ( player, "Congratulations,your gang take this turf!" , 255, 0, 0 ) 
     givePlayerMoney ( player, 2000 ) 
     setRadarAreaFlashing ( beachTurfA, false ) 
     end, 10000, 1 ) 
     end 
    end 
end 
addEventHandler ( "onColShapeHit", beachTurfC, beachTurf ) 

Link to comment
function beachTurf ( player ) 
    local playerGang = getElementData ( player, "gang" ) 
    if ( playerGang ) then 
        local r, g, b = unpack ( exports [ "gang_system" ]:getGangColor ( playerGang ) ) 
        setRadarAreaFlashing ( beachTurfA, true ) 
        exports ["guimessages"] : outputServer ( player, "You entered the turf!" , 255, 0, 0 ) 
        beachturfTimer = setTimer ( 
            function ( player ) 
                setRadarAreaColor ( beachTurfA, tonumber(r), tonumber(g), tonumber(b), 100 ) 
                exports ["guimessages"] : outputServer ( player, "Congratulations,your gang take this turf!" , 255, 0, 0 ) 
                givePlayerMoney ( player, 2000 ) 
                setRadarAreaFlashing ( beachTurfA, false ) 
            end 
            ,10000, 1 
        ) 
    else 
        outputChatBox ( "YOU ARE NOT IN A GANG!" ) 
    end 
end 
addEventHandler ( "onColShapeHit", beachTurfC, beachTurf ) 

Try that and see what it outputs.

Link to comment
function beachTurf ( player ) 
    local playerGang = getElementData ( player, "gang" ) 
    if ( playerGang ) then 
        local r, g, b = unpack ( exports [ "gang_system" ]:getGangColor ( playerGang ) ) 
        setRadarAreaFlashing ( beachTurfA, true ) 
        exports ["guimessages"] : outputServer ( player, "You entered the turf!" , 255, 0, 0 ) 
        beachturfTimer = setTimer ( 
            function ( player ) 
                setRadarAreaColor ( beachTurfA, tonumber(r), tonumber(g), tonumber(b), 100 ) 
                exports ["guimessages"] : outputServer ( player, "Congratulations,your gang take this turf!" , 255, 0, 0 ) 
                givePlayerMoney ( player, 2000 ) 
                setRadarAreaFlashing ( beachTurfA, false ) 
            end 
            ,10000, 1 
        ) 
    else 
        outputChatBox ( "YOU ARE NOT IN A GANG!" ) 
    end 
end 
addEventHandler ( "onColShapeHit", beachTurfC, beachTurf ) 

Try that and see what it outputs.

Dont work,no errors.

Link to comment

The problem is on the colshape, you set negative size, that made the colshape to create wrong.

local beachTurfA = createRadarArea( 352.93, -2025.23, 58, 65, 255, 255, 255, 125 ) 
local beachTurfC = createColRectangle ( 352.93, -2025.23, 58, 65 ) 
  
function beachTurf ( player ) 
    local playerGang = getElementData ( player, "gang" ) 
    if ( playerGang ) then 
        local r, g, b = unpack ( exports [ "gang_system" ]:getGangColor ( playerGang ) ) 
        setRadarAreaFlashing ( beachTurfA, true ) 
        exports ["guimessages"] : outputServer ( player, "You entered the turf!" , 255, 0, 0 ) 
        beachturfTimer = setTimer ( 
            function ( player ) 
                setRadarAreaColor ( beachTurfA, tonumber(r), tonumber(g), tonumber(b), 100 ) 
                exports ["guimessages"] : outputServer ( player, "Congratulations,your gang take this turf!" , 255, 0, 0 ) 
                givePlayerMoney ( player, 2000 ) 
                setRadarAreaFlashing ( beachTurfA, false ) 
            end 
            ,10000, 1 
        ) 
    end 
end 
addEventHandler ( "onColShapeHit", beachTurfC, beachTurf ) 

Link to comment
The problem is on the colshape, you set negative size, that made the colshape to create wrong.
local beachTurfA = createRadarArea( 352.93, -2025.23, 58, 65, 255, 255, 255, 125 ) 
local beachTurfC = createColRectangle ( 352.93, -2025.23, 58, 65 ) 
  
function beachTurf ( player ) 
    local playerGang = getElementData ( player, "gang" ) 
    if ( playerGang ) then 
        local r, g, b = unpack ( exports [ "gang_system" ]:getGangColor ( playerGang ) ) 
        setRadarAreaFlashing ( beachTurfA, true ) 
        exports ["guimessages"] : outputServer ( player, "You entered the turf!" , 255, 0, 0 ) 
        beachturfTimer = setTimer ( 
            function ( player ) 
                setRadarAreaColor ( beachTurfA, tonumber(r), tonumber(g), tonumber(b), 100 ) 
                exports ["guimessages"] : outputServer ( player, "Congratulations,your gang take this turf!" , 255, 0, 0 ) 
                givePlayerMoney ( player, 2000 ) 
                setRadarAreaFlashing ( beachTurfA, false ) 
            end 
            ,10000, 1 
        ) 
    end 
end 
addEventHandler ( "onColShapeHit", beachTurfC, beachTurf ) 

Working,but I have not got the money.And i have not got message "Congratulations,your gang take this turf!"

Debug says: Bad argument @"givePlayerMoney"

Edited by Guest
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...