Jump to content

Turf system


TheIceman1

Recommended Posts

Posted (edited)

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

Need paid scripter just pm me i will accept every job!

Posted

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 ) 

Looking for tutorials or information? check out: www.simpleask.co.uk

Posted

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

Need paid scripter just pm me i will accept every job!

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

Need paid scripter just pm me i will accept every job!

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

Need paid scripter just pm me i will accept every job!

Posted

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 ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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 ) 

Need paid scripter just pm me i will accept every job!

Posted

Do you get any errors?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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

Need paid scripter just pm me i will accept every job!

Posted

And it doesn't say anything on chat box either?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Maybe is the problem here?

local beachTurfA = createRadarArea( 352.93, -2025.23, 58, -65, 255, 255, 255, 125 ) 
local beachTurfC = createColRectangle ( 352.93, -2025.23, 58, -65 ) 

Need paid scripter just pm me i will accept every job!

Posted

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 ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted (edited)
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

Need paid scripter just pm me i will accept every job!

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