TheIceman1 Posted February 22, 2013 Posted February 22, 2013 (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 February 22, 2013 by Guest
manve1 Posted February 22, 2013 Posted February 22, 2013 Event handler say's you made it when you leave it, not when you enter it
TheIceman1 Posted February 22, 2013 Author Posted February 22, 2013 (edited) Ahh,i didnt see. Edited February 22, 2013 by Guest
TheIceman1 Posted February 22, 2013 Author Posted February 22, 2013 I fix it,but still nothing happens
manve1 Posted February 22, 2013 Posted February 22, 2013 you sure exports are correct? and is there any debug error?
manve1 Posted February 22, 2013 Posted February 22, 2013 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 )
TheIceman1 Posted February 22, 2013 Author Posted February 22, 2013 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".
TheIceman1 Posted February 22, 2013 Author Posted February 22, 2013 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.
TheIceman1 Posted February 22, 2013 Author Posted February 22, 2013 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.
Castillo Posted February 22, 2013 Posted February 22, 2013 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 )
TheIceman1 Posted February 22, 2013 Author Posted February 22, 2013 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 )
Castillo Posted February 22, 2013 Posted February 22, 2013 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.
TheIceman1 Posted February 22, 2013 Author Posted February 22, 2013 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.
Castillo Posted February 22, 2013 Posted February 22, 2013 And it doesn't say anything on chat box either?
TheIceman1 Posted February 22, 2013 Author Posted February 22, 2013 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 )
Castillo Posted February 22, 2013 Posted February 22, 2013 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 )
TheIceman1 Posted February 22, 2013 Author Posted February 22, 2013 (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 February 22, 2013 by Guest
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