damien111 Posted January 31, 2013 Share Posted January 31, 2013 I need help with figuring out why my War Script wont work, it will only let it be taken over once ( the 1 turf), and i also need help on keeping from more npc's spawning everytime someone enters, i just want it to happen once, when it is being taken over. server local pArea = createRadarArea( -1442.904296875, -971.251953125, 100, 100, 0, 0, 0, 125 ) local pCuboid = createColRectangle( -1442.904296875, -971.251953125, 100, 100 ) BigSmokes = createTeam("Nazis", 255, 0, 255) addEventHandler("onResourceStart",resourceRoot,function() end ) addEventHandler('onColShapeHit', root, function( p ) -- you should have added player param here local pTeam = getPlayerTeam( p ) local iR, iG, iB = getTeamColor( pTeam ) local rR, rG, rB = getRadarAreaColor ( pArea ) if (getPlayerTeam( p )) then if( source == pCuboid ) then if ( iR == rR and iG == rG and iB == rB ) then outputChatBox("Entering Friendly Area!", p, 0, 255, 0) else setElementData( p, "Turfing", true) outputChatBox("You Are Occupying This Land!", p, 255,255,0) setRadarAreaFlashing( pArea, true ) -- source is the col shape, you should use 'p', the player arg local owners = getElementData( pCuboid, "Owner" ) local teamShit = getElementData( pCuboid, "Team" ) if(owners == "Poland")then call(getResourceFromName("slothbot"), "spawnBot", -1428.177734375, -958.3681640625, 200.8858947753, 0, 34, 0, 0, teamShit, 33, "waiting") call(getResourceFromName("slothbot"), "spawnBot", -1430.244140625, -954.5, 200.92562866211, 0, 34, 0, 0, teamShit, 33, "waiting") call(getResourceFromName("slothbot"), "spawnBot", -1425.169921875, -951.3232421875, 201.09375, 0, 34, 0, 0, teamShit, 33, "waiting") call(getResourceFromName("slothbot"), "spawnBot", -1421.9306640625, -966.28125, 200.76762390137, 0, 34, 0, 0, teamShit, 33, "waiting") elseif(owners == "America")then call(getResourceFromName("slothbot"), "spawnBot", -1428.177734375, -958.3681640625, 200.8858947753, 0, 23, 0, 0, teamShit, 33, "waiting") call(getResourceFromName("slothbot"), "spawnBot", -1430.244140625, -954.5, 200.92562866211, 0, 23, 0, 0, teamShit, 33, "waiting") call(getResourceFromName("slothbot"), "spawnBot", -1425.169921875, -951.3232421875, 201.09375, 0, 23, 0, 0, teamShit, 33, "waiting") call(getResourceFromName("slothbot"), "spawnBot", -1421.9306640625, -966.28125, 200.76762390137, 0, 23, 0, 0, teamShit, 33, "waiting") elseif(owners == "Britain")then call(getResourceFromName("slothbot"), "spawnBot", -1428.177734375, -958.3681640625, 200.8858947753, 0, 37, 0, 0, teamShit, 33, "waiting") call(getResourceFromName("slothbot"), "spawnBot", -1430.244140625, -954.5, 200.92562866211, 0, 35, 0, 0, teamShit, 33, "waiting") call(getResourceFromName("slothbot"), "spawnBot", -1425.169921875, -951.3232421875, 201.09375, 0, 37, 0, 0, teamShit, 33, "waiting") call(getResourceFromName("slothbot"), "spawnBot", -1421.9306640625, -966.28125, 200.76762390137, 0, 35, 0, 0, teamShit, 33, "waiting") elseif(owners == "Italy")then call(getResourceFromName("slothbot"), "spawnBot", -1428.177734375, -958.3681640625, 200.8858947753, 0, 33, 0, 0, teamShit, 33, "waiting") call(getResourceFromName("slothbot"), "spawnBot", -1430.244140625, -954.5, 200.92562866211, 0, 33, 0, 0, teamShit, 33, "waiting") call(getResourceFromName("slothbot"), "spawnBot", -1425.169921875, -951.3232421875, 201.09375, 0, 33, 0, 0, teamShit, 33, "waiting") call(getResourceFromName("slothbot"), "spawnBot", -1421.9306640625, -966.28125, 200.76762390137, 0, 33, 0, 0, teamShit, 33, "waiting") else call(getResourceFromName("slothbot"), "spawnBot", -1428.177734375, -958.3681640625, 200.8858947753, 0, 311, 0, 0, BigSmokes, 33, "waiting") call(getResourceFromName("slothbot"), "spawnBot", -1430.244140625, -954.5, 200.92562866211, 0, 311, 0, 0, BigSmokes, 33, "waiting") call(getResourceFromName("slothbot"), "spawnBot", -1425.169921875, -951.3232421875, 201.09375, 0, 311, 0, 0, BigSmokes, 33, "waiting") call(getResourceFromName("slothbot"), "spawnBot", -1421.9306640625, -966.28125, 200.76762390137, 0, 311, 0, 0, BigSmokes, 33, "waiting") end wave1 = setTimer( function() setRadarAreaColor (pArea, iR, iG, iB, 100) outputChatBox( "Congratulations, #FFFF00 you have taken the land!", p, 0, 255, 0, true ) local playersTeam = getElementData ( p, "country" ) setElementData( pCuboid, "Owner", playersTeam ) setRadarAreaFlashing( pArea, false ) setElementData( pCuboid, "Team", pTeam ) if(playersTeam == "Poland")then call(getResourceFromName("slothbot"), "spawnBot", -1404.1083984375, -964.0966796875, 199.4368896484, 0, 34, 0, 0, pTeam, 33, "guarding") call(getResourceFromName("slothbot"), "spawnBot", -1423.859375, -962.6943359375, 200.80470275879, 0, 34, 0, 0, pTeam, 33, "guarding") call(getResourceFromName("slothbot"), "spawnBot", -1421.6552734375, -962.1630859375, 200.76458740234, 0, 34, 0, 0, pTeam, 33, "guarding") elseif(playersTeam == "America")then call(getResourceFromName("slothbot"), "spawnBot", -1404.1083984375, -964.0966796875, 199.4368896484, 0, 23, 0, 0, pTeam, 33, "guarding") call(getResourceFromName("slothbot"), "spawnBot", -1423.859375, -962.6943359375, 200.80470275879, 0, 23, 0, 0, pTeam, 33, "guarding") call(getResourceFromName("slothbot"), "spawnBot", -1421.6552734375, -962.1630859375, 200.76458740234, 0, 23, 0, 0, pTeam, 33, "guarding") elseif(playersTeam == "Britain")then call(getResourceFromName("slothbot"), "spawnBot", -1404.1083984375, -964.0966796875, 199.4368896484, 0, 35, 0, 0, pTeam, 33, "guarding") call(getResourceFromName("slothbot"), "spawnBot", -1423.859375, -962.6943359375, 200.80470275879, 0, 35, 0, 0, pTeam, 33, "guarding") call(getResourceFromName("slothbot"), "spawnBot", -1421.6552734375, -962.1630859375, 200.76458740234, 0, 35, 0, 0, pTeam, 33, "guarding") elseif(playersTeam == "Italy")then call(getResourceFromName("slothbot"), "spawnBot", -1404.1083984375, -964.0966796875, 199.4368896484, 0, 33, 0, 0, pTeam, 33, "guarding") call(getResourceFromName("slothbot"), "spawnBot", -1423.859375, -962.6943359375, 200.80470275879, 0, 33, 0, 0, pTeam, 33, "guarding") call(getResourceFromName("slothbot"), "spawnBot", -1421.6552734375, -962.1630859375, 200.76458740234, 0, 33, 0, 0, pTeam, 33, "guarding") else outputChatBox("Dafuq, you arent in a country..", p) end end, 60000, 1 ) end end end end ) addEventHandler( 'onColShapeLeave', root, function( ) if( source == pCuboid ) then setRadarAreaFlashing( pArea, false ) if isTimer( wave1 ) then setElementData( p, "Turfing", false) killTimer( wave1 ) end end end ) addEventHandler( "onPlayerWasted", getRootElement( ), function() yesorno = getElementData( p, "Turfing") if(yesorno) then setRadarAreaFlashing( pArea, false ) if isTimer( wave1 ) then setElementData( p, "Turfing", false) killTimer( wave1 ) end end end ) 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