Jump to content

Can anyone help me with this script?


Recommended Posts

Hello,

I tried to make a script that will kill you if you are no admin in a specific zone. But nothing happens when i spawn as a normal player. Can anyone look at the script?

myMarker = createMarker ( -3456, 1555, 2, 'cylinder', 100.0, 225, 0, 0, 0 ) 
  
function markerHit (player) 
local theAccount = getPlayerAccount(player) 
if theAccount then 
local accountName = getAccountName(theAccount) 
if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then 
outputChatBox ( "** You have entered the admin base **", hitElement, 255, 0, 0 ) 
else 
killPlayer ( hitElement ) 
  
addEventHandler( "onMarkerHit", theMarker ) 
  

Link to comment
Hello,

I tried to make a script that will kill you if you are no admin in a specific zone. But nothing happens when i spawn as a normal player. Can anyone look at the script?

1. you have player defined and then use hitElement (which is nil)

2. you should check if element that hit the marker is a player at all

3. you've lost all "end"s somewhere

4. didn't add the function to handle your onMarkerHit event

5. marker is called "myMarker" but you're sticking an event to "theMarker"

myMarker = createMarker ( -3456, 1555, 2, 'cylinder', 100.0, 225, 0, 0, 0 ) 
  
function markerHit(hitElement) -- 1 
  if getElementType(hitElement) ~= "player" then return false end -- 1,2 
  local theAccount = getPlayerAccount(hitElement) -- 1 
  if theAccount then 
    local accountName = getAccountName(theAccount) 
    if isObjectInACLGroup("user."..accountName, aclGetGroup("Admin")) then 
      outputChatBox("** You have entered the admin base **", hitElement, 255, 0, 0) 
    else 
      killPlayer(hitElement) 
    end -- 3 
  end -- 3 
end -- 3 
addEventHandler("onMarkerHit", myMarker, markerHit) -- 4,5 
  

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