kieran Posted June 28, 2017 Posted June 28, 2017 Hey, so I am messing with radar areas but I am having problems with seeing if there is a normal player in it, I thought I could just re use an old script and lay a col square over my radar area, but it doesn't seem to be working. Basically I am trying to make admin zone and put in an event that only applies to normal players and not admins, here's my code. Area = createColRectangle ( 424.7353515625, 2474.77734375, 43, 43) --the col square +1 size because I'm messing with it right now. Radar = createRadarArea ( 379.3740234375, 2475.5185546875, 42, -42, 0, 255, 0, 255) --the radarArea (copied from king of the hill example.) function adminArea ( thePlayer, matchingDimension ) if (getElementType(thePlayer) == "player") then if not ( aclGetGroup ( "Admin" ) ) and ( isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(player)), aclGetGroup ( "Admin" ) ) ) then --is "if not" wrong? What should be here? (I know that it's completly wrong, but gives an idea of what I'm trying to do.) killPed ( thePlayer, thePlayer ) --For testing purposes trying to kill player. end end end addEventHandler ( "onColShapeHit", Area, adminArea ) --Do I need to put in any add ons?
WorthlessCynomys Posted June 28, 2017 Posted June 28, 2017 if (getElementType(thePlayer) == "player") then local account = getPlayerAccount(thePlayer) if (isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("admin") == true) then -- Do something end end
kieran Posted June 28, 2017 Author Posted June 28, 2017 (edited) 24 minutes ago, StormFighter said: if (getElementType(thePlayer) == "player") then local account = getPlayerAccount(thePlayer) if (isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("admin") == true) then -- Do something end end I am trying to make it so that if the player is NOT and admin he will die entering the col shape, but I don't know how to check if it is normal player as all aclGroups that can be players are "Everyone".... I hope that makes it a little clearer I have also tried the following but no luck. Area = createColRectangle ( 424.7353515625, 2474.77734375, 43, 43) Radar = createRadarArea ( 379.3740234375, 2475.5185546875, 42, -42, 0, 255, 0, 255) function Enter ( thePlayer, matchingDimension ) if (getElementType(thePlayer) == "player") then if ( aclGetGroup ( "Admin" ) ) and ( isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(player)), aclGetGroup ( "Admin" ) ) ) then return else killPed ( thePlayer, thePlayer ) end end end addEventHandler ( "onColShapeHit", Area, Enter ) Edited June 28, 2017 by kieran
WorthlessCynomys Posted June 28, 2017 Posted June 28, 2017 (edited) if (getElementType(thePlayer) == "player") then -- If the element is a player local acc = getPlayerAccount(thePlayer) -- Get it's account if (isObjectInACLGroup("user."..getAccountName(acc), aclGetGroup("admin")) == false) then -- If the object is not in the admin acl group killPed(thePlayer, thePlayer) -- Kill it end end Edited June 28, 2017 by StormFighter Fix
kieran Posted June 28, 2017 Author Posted June 28, 2017 (edited) 14 minutes ago, StormFighter said: WARNING: test/AdminZone.lua:95: Bad argument @ 'isObjectInACLGroup' [Expected acl-group at argument 2, got boolean] error.... Here is full code. Area = createColRectangle ( 424.7353515625, 2474.77734375, 43, 43) --line 87 Radar = createRadarArea ( 379.3740234375, 2475.5185546875, 42, -42, 0, 255, 0, 255) function Enter ( thePlayer, matchingDimension ) if (getElementType(thePlayer) == "player") then local account = getPlayerAccount(thePlayer) if (isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("admin") == false)) then -- 95, whereit says there is problem. :/ killPed(thePlayer, thePlayer) end end -- This code checks if the player is in the admin acl group and if not, then kill the player. end addEventHandler ( "onColShapeHit", Area, Enter ) --line 101 There is also one marker, but that just opens 2 gates... Edited June 28, 2017 by kieran
WorthlessCynomys Posted June 28, 2017 Posted June 28, 2017 That means that the group is not existing. Try it with big A. So aclGetGroup("Admin") 1
kieran Posted June 28, 2017 Author Posted June 28, 2017 1 minute ago, StormFighter said: That means that the group is not existing. Try it with big A. So aclGetGroup("Admin") never mind, fix you gave worked (I had col out of radar haha) thanks a lot mate!
WorthlessCynomys Posted June 28, 2017 Posted June 28, 2017 Just a little tip. Use development mode. So on admin panel, you have a command line, use either that or write a script. setDevelopmentMode(true) -- client side command then in the ingame console (F8): showcol maaagiiic 1
kieran Posted June 28, 2017 Author Posted June 28, 2017 1 minute ago, StormFighter said: Just a little tip. Use development mode. So on admin panel, you have a command line, use either that or write a script. setDevelopmentMode(true) -- client side command then in the ingame console (F8): showcol maaagiiic You're a true genius thank you
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