manve1 Posted August 28, 2012 Share Posted August 28, 2012 I'm trying to make a turf system for everyone in this community, as i see that people like turfing and are trying to make it, but they just can't and i just started scripting, and the script gets boolen. hillRadar = createRadarArea ( 2130, 728, 200, -100, 0, 255, 0, 175 ) cuboid = createColCuboid( 2133.1950683594, 633.66455078125, 10, 197.5, 92, 12 ) function flash() local posX, posY = getElementPosition( theElement ) if isInsideRadarArea ( hillRadar, posX, posY ) then setRadarAreaColor ( hillRadar, 0, 0, 255, 255 ) setRadarAreaFlashing ( hillRadar, true ) end end setTimer ( flash, 1000, 1 ) Link to comment
Anderl Posted August 28, 2012 Share Posted August 28, 2012 Create a col shape in same place as radar area and check when you enter the col shape with onColShapeHit. Link to comment
manve1 Posted August 28, 2012 Author Share Posted August 28, 2012 I have on same place the Col shape ( Col cuboid ) and i still get it boolen hillRadar = createRadarArea ( 2130, 728, 200, -100, 0, 255, 0, 175 ) cuboid = createColCuboid( 2133.1950683594, 633.66455078125, 10, 197.5, 92, 12 ) function flash() posX, posY = getElementPosition( ) if isInsideRadarArea ( hillRadar, posX, posY ) then setRadarAreaColor ( hillRadar, 0, 0, 255, 255 ) setRadarAreaFlashing ( hillRadar, true ) end end setTimer ( flash, 1000, 1 ) addEventHandler("onColShapeHit", cuboid, flash) heres the new LUA Link to comment
TAPL Posted August 28, 2012 Share Posted August 28, 2012 What the hell is this? posX, posY = getElementPosition( ) Link to comment
Anderl Posted August 28, 2012 Share Posted August 28, 2012 I have on same place the Col shape ( Col cuboid ) and i still get it boolen hillRadar = createRadarArea ( 2130, 728, 200, -100, 0, 255, 0, 175 ) cuboid = createColCuboid( 2133.1950683594, 633.66455078125, 10, 197.5, 92, 12 ) function flash() posX, posY = getElementPosition( ) if isInsideRadarArea ( hillRadar, posX, posY ) then setRadarAreaColor ( hillRadar, 0, 0, 255, 255 ) setRadarAreaFlashing ( hillRadar, true ) end end setTimer ( flash, 1000, 1 ) addEventHandler("onColShapeHit", cuboid, flash) heres the new LUA Because you just got some shit handler and pasted on your code and you want it to work. Server-side: local pArea = createRadarArea( 2130, 728, 200, -100, 0, 255, 0, 175 ) local pCuboid = createColCuboid( 2133.1950683594, 633.66455078125, 10, 197.5, 92, 12 ) addEventHandler( 'onColShapeHit', root, function( ) if( source == pCuboid ) then setRadarAreaColor( pArea, 0, 0, 255, 255 ) setRadarAreaFlashing( pArea, true ) end end ) addEventHandler( 'onColShapeLeave', root, function( ) if( source == pCuboid ) then setRadarAreaColor( pArea, 0, 255, 0, 175 ) setRadarAreaFlashing( pArea, false ) end end ) P.S.: You should also make a well developed system for multiple areas, and if you are going to release it, make it easy for people to add/edit areas and change settings. Link to comment
manve1 Posted August 28, 2012 Author Share Posted August 28, 2012 How can i make like if the player team gets the turf, it set the color to it, and when he leaves the turf, it stay's the same color as the player team color? P.S. I'm trying to learn scripting, I'm n00b at it, sorry if i ask something not even serious and very easy scripts. Link to comment
Anderl Posted August 28, 2012 Share Posted August 28, 2012 Set area color to the player team's color using getTeamColor and setRadarAreaColor and don't set its color back when leave the area. Link to comment
manve1 Posted August 28, 2012 Author Share Posted August 28, 2012 I get errors, as i said, I am still learning, and by doing complicated scripts i learn faster, and i don't know whats wrong now, im trying lots of different way's, and getting errors, local pArea = createRadarArea( 2130, 728, 200, -100, 0, 255, 0, 175 ) local pCuboid = createColCuboid( 2133.1950683594, 633.66455078125, 10, 197.5, 92, 12 ) addEventHandler( 'onColShapeHit', root, function( ) if( source == pCuboid ) then setRadarAreaFlashing( pArea, true ) local r, g, b local playerTeam = getPlayerTeam( source ) r, g, b = getTeamColor ( playerTeam ) setRadarAreaColor ( pArea, r, g, b, 175 ) end end ) addEventHandler( 'onColShapeLeave', root, function( ) if( source == pCuboid ) then setRadarAreaFlashing( pArea, false ) end end ) debug: Link to comment
Anderl Posted August 28, 2012 Share Posted August 28, 2012 local pArea = createRadarArea( 2130, 728, 200, -100, 0, 255, 0, 175 ) local pCuboid = createColCuboid( 2133.1950683594, 633.66455078125, 10, 197.5, 92, 12 ) addEventHandler( 'onColShapeHit', root, function( p ) -- you should have added player param here if( source == pCuboid ) then setRadarAreaFlashing( pArea, true ) local pTeam = getPlayerTeam( p ) -- source is the col shape, you should use 'p', the player arg local iR, iG, iB = getTeamColor( pTeam ) setRadarAreaColor( pArea, iR, iG, iB, 175 ) end end ) addEventHandler( 'onColShapeLeave', root, function( ) if( source == pCuboid ) then setRadarAreaFlashing( pArea, false ) end end ) Read comments to see what was wrong. Also, don't forget that you'll have to save areas' settings otherwise everything will return to its default settings after restart resource/restart server. 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