Jump to content

Any scripts on a secure zone


Recommended Posts

6ArHxiMr'3a[Z]eF, your code is wrong, and please stop typing in that stupid bold text, it's annoying.

I added some explanation in the script, you still need to edit some stuff.

  
local chekName = "staff" -- a variable( this variable is for the team chekker) 
  
local marker = createMarker ( x, y, z, "cylinder", size, 255, 0, 0, 255 ) 
--Creating a marker here, still need to fill in the x,y,z and the size, after that, you need to change the alpha if the size is good and position (changing [size, 255, 0, 0, 255]  to [size, 255, 0, 0, 0] 
  
--Adding a event handler on the marker to a function. 
addEventHandler( "onMarkerHit", marker, 
function ( player ) -- the argument from "onMarkerHit" (the hit element) 
if getElementType(player) == "player" then 
local pTeam = getPlayerTeam ( player ) -- this will get the players team 
if pTeam then -- chek if the player is in a team 
local pTeamName = getTeamName ( pTeam ) -- get's the name of the playersTeam 
if pTeamName == chekName then -- chek if the players team name matches with the variable 
outputChatBox ( "*Welcome, "..getPlayerName ( player ).."!", player, 255, 0, 0) -- if its in the team then output: "Welcome, yourname !" 
else -- if the team isn't matching 
setElementPosition ( player, x,y,z ) -- change this to the warp point if the player isn't in the team. 
end 
end 
end 
end 
) 

Edited by Guest
Link to comment
6ArHxiMr'3a[Z]eF, your code is wrong, and please stop typing in that stupid bold text, it's annoying.

I added some explanation in the script, you still need to edit some stuff.

  
local chekName = "staff" -- a variable( this variable is for the team chekker) 
  
local marker = createMarker ( x, y, z, "cylinder", size, 255, 0, 0, 255 ) 
--Creating a marker here, still need to fill in the x,y,z and the size, after that, you need to change the alpha if the size is good and position (changing [size, 255, 0, 0, 255]  to [size, 255, 0, 0, 0] 
  
--Adding a event handler on the marker to a function. 
addEventHandler( "onMarkerHit", marker, 
function ( player ) -- the argument from "onMarkerHit" (the hit element) 
local pTeam = getPlayerTeam ( player ) -- this will get the players team 
if pTeam then -- chek if the player is in a team 
local pTeamName = getTeamName ( pTeam ) -- get's the name of the playersTeam 
if pTeamName == chekName then -- chek if the players team name matches with the variable 
outputChatBox ( "*Welcome, "..getPlayerName ( player ).."!", player, 255, 0, 0) -- if its in the team then output: "Welcome, yourname !" 
else -- if the team isn't matching 
setElementPosition ( player, x,y,z ) -- change this to the warp point if the player isn't in the team. 
end 
end 
end 
) 

what's wrong with mine?

Link to comment
Ok explain everything for me please juste xplain all for it to work i need it to work at the doherty sf garage

this explain everything

local marker = createMarker ( x, y, z, "cylinder", 1.5, 255, 0, 0, 170 ) 
  
addEventHandler( "onMarkerHit", 
function ( player ) 
local PlayerTeam = getPlayerTeam ( player ) 
local Team = getTeamFromName ( "staff" ) 
    if playerTeam == Team then 
    outputChatBox ( "* welcome Staff ", player, 255, 0, 0) 
    else 
    killPed(player) 
    end 
end 
) 

# Replace

1- x, y ,x == the position for the area

Suppose that a bird touching the circle! What will happen in your opinion?

use getElementType to define it.

Link to comment

only this?

local marker = createMarker ( x, y, z, "cylinder", 1.5, 255, 0, 0, 170 ) 
  
addEventHandler( "onMarkerHit", 
function ( player ) 
    if getElementType(player) == "player" then 
    local PlayerTeam = getPlayerTeam ( player ) 
    local Team = getTeamFromName ( "staff" ) 
        if playerTeam == Team then 
        outputChatBox ( "* welcome Staff ", player, 255, 0, 0) 
        else 
        killPed(player) 
        end 
    end 
end 
) 

Link to comment
only this?
local marker = createMarker ( x, y, z, "cylinder", 1.5, 255, 0, 0, 170 ) 
  
addEventHandler( "onMarkerHit", 
function ( player ) 
    if getElementType(player) == "player" then 
    local PlayerTeam = getPlayerTeam ( player ) 
    local Team = getTeamFromName ( "staff" ) 
        if playerTeam == Team then 
        outputChatBox ( "* welcome Staff ", player, 255, 0, 0) 
        else 
        killPed(player) 
        end 
    end 
end 
) 

You still don't see the bug? :o " addEventHandler( "onMarkerHit", " isn't attached on something, also see my edited code, that one will work

Link to comment

hahaha i forget it

why you didnt told me the bug :lol:

local marker = createMarker ( x, y, z, "cylinder", 1.5, 255, 0, 0, 170 ) 
  
addEventHandler( "onMarkerHit", marker, 
function ( player ) 
    if getElementType(player) == "player" then 
    local PlayerTeam = getPlayerTeam ( player ) 
    local Team = getTeamFromName ( "staff" ) 
        if playerTeam == Team then 
        outputChatBox ( "* welcome Staff ", player, 255, 0, 0) 
        else 
        killPed(player) 
        end 
    end 
end 
) 

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