Jump to content

SAFEZONE


bosslorenz

Recommended Posts

safeZone = createColRectangle ( 1837.4000244141, 1283.0999755859, 195, 165)

safeArea = createRadarArea ( 1837.4000244141, 1283.0999755859, 195, 165, 0, 255, 0, 150)

setElementData (safeArea,"zombieProof",true)

function safeZoneEnter ( thePlayer, matchingDimension )

if getElementType( thePlayer ) ~= "player" then return end

outputChatBox ( "* You Have Entered The *LV MAFIA* Base! *", thePlayer, 200, 0, 100 )

toggleControl ( thePlayer, "fire", false )

toggleControl ( thePlayer, "next_weapon", true )

toggleControl ( thePlayer, "previous_weapon", true )

setPedWeaponSlot ( thePlayer, 0 )

toggleControl ( thePlayer, "aim_weapon", false )

toggleControl ( thePlayer, "vehicle_fire", false )

toggleControl ( thePlayer, "vehicle_secondary_fire", false )

end

addEventHandler ( "onColShapeHit", safeZone, safeZoneEnter )

function safeZoneExit ( thePlayer, matchingDimension )

if getElementType( thePlayer ) ~= "player" then return end

outputChatBox ( "* You Have Left The *LV MAFIA* Base! *", thePlayer, 200, 0, 100 )

toggleControl ( thePlayer, "fire", true )

toggleControl ( thePlayer, "next_weapon", true )

toggleControl ( thePlayer, "previous_weapon", true )

toggleControl ( thePlayer, "aim_weapon", true )

toggleControl ( thePlayer, "vehicle_fire", true )

toggleControl ( thePlayer, "vehicle_secondary_fire", true )

end

addEventHandler ( "onColShapeLeave", safeZone, safeZoneExit )

addEventHandler ( "onColShapeHit", safeZone,

function ( hitElement )

if getElementType( hitElement ) == "ped" then

setRadarAreaFlashing(safeArea, false)

setElementData (safeZone,"zombieProof", true)

killPed(hitElement)

end

end

)

safeZone2 = createColRectangle ( 96.5, 1798.8000488281, 195, 165)

safeArea2 = createRadarArea ( 96.5, 1798.8000488281, 195, 165, 0, 255, 0, 150)

setElementData (safeArea2,"zombieProof",true)

function safeZoneEnter2 ( thePlayer, matchingDimension )

if getElementType( thePlayer ) ~= "player" then return end

outputChatBox ( "* You Have Entered The *MILITARY* Base! *", thePlayer, 0, 255, 0 )

toggleControl ( thePlayer, "fire", false )

toggleControl ( thePlayer, "next_weapon", true )

toggleControl ( thePlayer, "previous_weapon", true )

setPedWeaponSlot ( thePlayer, 0 )

toggleControl ( thePlayer, "aim_weapon", false )

toggleControl ( thePlayer, "vehicle_fire", false )

toggleControl ( thePlayer, "vehicle_secondary_fire", false )

end

addEventHandler ( "onColShapeHit", safeZone2, safeZoneEnter2 )

function safeZoneExit2 ( thePlayer, matchingDimension )

if getElementType( thePlayer ) ~= "player" then return end

outputChatBox ( "* You Have Left The *MILITARY* Base! *", thePlayer, 0, 255, 0 )

toggleControl ( thePlayer, "fire", true )

toggleControl ( thePlayer, "next_weapon", true )

toggleControl ( thePlayer, "previous_weapon", true )

toggleControl ( thePlayer, "aim_weapon", true )

toggleControl ( thePlayer, "vehicle_fire", true )

toggleControl ( thePlayer, "vehicle_secondary_fire", true )

end

addEventHandler ( "onColShapeLeave", safeZone2, safeZoneExit2 )

addEventHandler ( "onColShapeHit", safeZone2,

function ( hitElement )

if getElementType( hitElement ) == "ped" then

setRadarAreaFlashing(safeArea2, false)

setElementData (safeZone2,"zombieProof", true)

killPed(hitElement)

end

end

)

WARNING : Duplicate script file in resource 'editor_test' : 'safe1.lua'

Cant solve this problem. Can anyone help me?

Link to comment
team1 = createTeam ( "MILITARY", 0, 255, 0 )

team2 = createTeam ( "LV MAFIA", 200, 0, 100 )

setTeamFriendlyFire ("MILITARY", false )

setTeamFriendlyFire ("LV MAFIA", false )

local changeTeam = function (player,key)

if key == "F1" then

setPlayerTeam(player,team1)

spawnPlayer (player, 202.39999389648, 1858.4000244141, 13.10000038147, 0, 312, 0, 0)

outputChatBox("You have joined MILITARY", source, 0, 255, 0)

giveWeapon ( player, 31, 200 )

elseif key == "F2" then

setPlayerTeam(player,team2)

spawnPlayer (player, 1932.3000488281, 1345, 10, 90, math.random ( 125,127) , 0, 0)

outputChatBox("You have joined LV MAFIA", source, 0, 255, 0)

giveWeapon ( player, 27, 200 )

end

setCameraTarget(player)

end

function setCameraOnPlayerJoin()

fadeCamera(source, true, 5)

setCameraMatrix(source, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234,99.881813049316)

bindKey(source,"F1","down",changeTeam)

bindKey(source,"F2","down",changeTeam)

setPlayerTeam ( source, nil )

end

addEventHandler("onPlayerJoin", root, setCameraOnPlayerJoin)

addEventHandler("onPlayerWasted", root, setCameraOnPlayerJoin)

function unbind ()

unbindKey ( source, "F1" )

unbindKey ( source, "F2" )

end

function CHATBOX ()

outputChatBox("Press F1 to choose MILITARY", source, 0, 255, 0)

end

function CHATBOX2 ()

outputChatBox("Press F2 to choose LV MAFIA", source, 200, 0, 100)

end

addEventHandler ("onPlayerSpawn", root, unbind )

addEventHandler ("onPlayerJoin", root, CHATBOX )

addEventHandler ("onPlayerJoin", root, CHATBOX2 )

addEventHandler ("onPlayerWasted", root, CHATBOX )

addEventHandler ("onPlayerWasted", root, CHATBOX2 )

Also here, Bad argument @ .setTeamFriendlyFire. [Expected team at argument 1, got string .MILITARY.]

Also here, Bad argument @ .setTeamFriendlyFire. [Expected team at argument 1, got string .LV MAFIA.]

Link to comment
team1 = createTeam ( "MILITARY", 0, 255, 0 )

team2 = createTeam ( "LV MAFIA", 200, 0, 100 )

setTeamFriendlyFire ("MILITARY", false )

setTeamFriendlyFire ("LV MAFIA", false )

local changeTeam = function (player,key)

if key == "F1" then

setPlayerTeam(player,team1)

spawnPlayer (player, 202.39999389648, 1858.4000244141, 13.10000038147, 0, 312, 0, 0)

outputChatBox("You have joined MILITARY", source, 0, 255, 0)

giveWeapon ( player, 31, 200 )

elseif key == "F2" then

setPlayerTeam(player,team2)

spawnPlayer (player, 1932.3000488281, 1345, 10, 90, math.random ( 125,127) , 0, 0)

outputChatBox("You have joined LV MAFIA", source, 0, 255, 0)

giveWeapon ( player, 27, 200 )

end

setCameraTarget(player)

end

function setCameraOnPlayerJoin()

fadeCamera(source, true, 5)

setCameraMatrix(source, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234,99.881813049316)

bindKey(source,"F1","down",changeTeam)

bindKey(source,"F2","down",changeTeam)

setPlayerTeam ( source, nil )

end

addEventHandler("onPlayerJoin", root, setCameraOnPlayerJoin)

addEventHandler("onPlayerWasted", root, setCameraOnPlayerJoin)

function unbind ()

unbindKey ( source, "F1" )

unbindKey ( source, "F2" )

end

function CHATBOX ()

outputChatBox("Press F1 to choose MILITARY", source, 0, 255, 0)

end

function CHATBOX2 ()

outputChatBox("Press F2 to choose LV MAFIA", source, 200, 0, 100)

end

addEventHandler ("onPlayerSpawn", root, unbind )

addEventHandler ("onPlayerJoin", root, CHATBOX )

addEventHandler ("onPlayerJoin", root, CHATBOX2 )

addEventHandler ("onPlayerWasted", root, CHATBOX )

addEventHandler ("onPlayerWasted", root, CHATBOX2 )

Also tested this :

outputChatBox("You have joined LV MAFIA", source, 0, 255, 0)
Sends to all players in server. Just want to be send to someone who pick F2.
Link to comment

Recommendation; use the LUA Tags instead of the Quote tags.

 

The difference,

Without;

function onJoin()

         outputChatBox("Welcome To The Server", source, 255, 0, 0)

end

addEventHandler("onPlayerJoin", root, onJoin)

 

With

function onJoin() 
         setPedArmor(source, 100) 
         outputChatBox("Welcome To The Server", source, 255, 0, 0) 
end 
addEventHandler("onPlayerJoin", root, onJoin) 

Regards Viruz

Link to comment

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