GameZoneX Posted May 19, 2011 Share Posted May 19, 2011 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
Aibo Posted May 19, 2011 Share Posted May 19, 2011 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
GameZoneX Posted May 19, 2011 Author Share Posted May 19, 2011 Can you tell me anything about the spaces and the end's? I don't understand when to use them. Link to comment
Aibo Posted May 19, 2011 Share Posted May 19, 2011 "spaces" (or tabs) is "indentation": http://en.wikipedia.org/wiki/Indent_style as for «end», it is used to close functions/statements (if, for, while, etc.). you should read about programming/scripting in general. 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