Jump to content

Crappy Trufs System


Axel

Recommended Posts

So i made this crappy turfs system:

ingeriimortii=createRadarArea( 1165, -933,400,200,0,0,255,50) 
dragoniirosi=createRadarArea( 2611, -2053,200,160,255,0,0,50) 
dcol = createColRectangle ( 2611, -2053, 200, 160 ) 
icol = createColRectangle ( 1165, -933,400,200 ) 
  
function radar (source) 
setRadarAreaColor ( dragoniirosi, 0,0,255, 50 ) 
setRadarAreaFlashing ( dragoniirosi, false ) 
exports.global:giveMoney(source, 5) 
end 
  
function radar2 (source) 
setRadarAreaFlashing ( dragoniirosi, false ) 
setRadarAreaColor ( dragoniirosi, 255,0,0, 50 ) 
exports.global:giveMoney(source, 5) 
end 
  
function enter( source ) 
if getPlayerTeam(source) == getTeamFromName("Dragonii Rosii") then 
outputChatBox("Bine ai revenit Membru al Dragoniilor Rosii!",source,255,0,0) 
setRadarAreaFlashing ( dragoniirosi, true ) 
setTimer ( radar2, 5000, 5000) 
elseif getPlayerTeam(source) == getTeamFromName("Ingerii Mortii") then 
outputChatBox("Ai atacat teritoriul Dragoniilor Rosii!",source,255,0,0) 
setTimer ( radar, 5000, 5000) 
setRadarAreaFlashing ( dragoniirosi, true ) 
else 
outputChatBox("Ai intrat pe teriroruil unu-i gang ai grija sa nu fi atacat!",source,255,0,0) 
end 
end 
addEventHandler ( "onColShapeHit", dcol, enter ) 
  
function enter2( source ) 
if getPlayerTeam(source) == getTeamFromName("Ingerii Mortii") then 
outputChatBox("Bine ai revenit Membru al Ingerii Mortii!",source,0,0,255) 
setRadarAreaFlashing ( ingeriimortii, false ) 
setTimer ( radar4, 5000, 5000) 
elseif getPlayerTeam(source) == getTeamFromName("Dragonii Rosii") then 
outputChatBox("Ai atacat teritoriul Ingerilor Mortii!",source,0,0,255) 
setTimer ( radar5, 5000, 5000) 
setRadarAreaFlashing ( ingeriimortii, true ) 
else 
outputChatBox("Ai intrat pe teriroruil unu-i gang ai grija sa nu fi atacat!",source,255,0,0) 
end 
end 
addEventHandler ( "onColShapeHit", icol, enter2 ) 

I need some help in better way of creating turfs, a way to check if the player is inside it and if he exits the attacking stops.. and maybe some advice how to make it better

Link to comment
ingeriimortii = createRadarArea( 1165, -933,400,200,0,0,255,50) 
dragoniirosi = createRadarArea( 2611, -2053,200,160,255,0,0,50) 
dcol = createColRectangle ( 2611, -2053, 200, 160 ) 
icol = createColRectangle ( 1165, -933,400,200 ) 
  
local uTimers = { } 
  
function radar ( source ) 
    setRadarAreaColor ( dragoniirosi, 0,0,255, 50 ) 
    setRadarAreaFlashing ( dragoniirosi, false ) 
    exports.global:giveMoney( source, 5 ) 
end 
  
function radar2 ( source ) 
    setRadarAreaFlashing ( dragoniirosi, false ) 
    setRadarAreaColor ( dragoniirosi, 255,0,0, 50 ) 
    exports.global:giveMoney( source, 5 ) 
end 
  
function onColShapeHit( hitElement ) 
    if getElementType( hitElement ) == 'player' then 
        if getPlayerTeam( hitElement ) == getTeamFromName( "Ingerii Mortii" ) then 
            outputChatBox( "Bine ai revenit Membru al Ingerii Mortii!",hitElement,0,0,255 ) 
            setRadarAreaFlashing ( ingeriimortii, false ) 
            --setTimer ( radar4, 5000, 5000 ) -- radar4 is nil 
            uTimers[ hitElement ] = setTimer( radar,5000,5000,hitElement ) -- maybe it? 
        elseif getPlayerTeam( hitElement ) == getTeamFromName( "Dragonii Rosii" ) then 
            outputChatBox( "Ai atacat teritoriul Ingerilor Mortii!",hitElement,0,0,255 ) 
            --setTimer ( radar5, 5000, 5000) -- radar5 is nil 
            uTimers[ hitElement ] = setTimer( radar2,5000,5000,hitElement ) -- maybe it? 
            setRadarAreaFlashing ( ingeriimortii, true ) 
        else 
            outputChatBox("Ai intrat pe teriroruil unu-i gang ai grija sa nu fi atacat!",hitElement,255,0,0) 
        end 
    end 
end 
addEventHandler ( "onColShapeHit", icol, onColShapeHit ) 
addEventHandler ( "onColShapeHit", dcol, onColShapeHit ) 
  
addEventHandler( 'onPlayerQuit',root, 
    function( ) 
        uTimers[ source ] = nil 
    end 
)    

Link to comment
  • 2 weeks later...
  • 4 months later...

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