Drakath Posted August 20, 2012 Share Posted August 20, 2012 Hello, I keep getting warning messages: WARNING: script\server.lua:15: Bad argument @ 'hasObjectPermissionTo' Can anyone help? Line 15: if hasObjectPermissionTo(thePlayer, "command.slap", false) then Link to comment
Drakath Posted August 20, 2012 Author Share Posted August 20, 2012 radar = createRadarArea(2418.4255371094, -1735,121.6306152344,100,0,150,0,153) setElementData(radar,"zombieProof",true) staffZone = createColRectangle (2418.4255371094, -1735,121.6306152344,100) addEventHandler("onColShapeHit", staffZone, function(h) if not isElement(h) then return end if getElementData(h,"zombie") then killPed(h) end end) function enterArea(thePlayer) local posX, posY = getElementPosition(thePlayer) local inArea = isInsideRadarArea(radar, posX, posY) if (inArea) then if hasObjectPermissionTo(thePlayer, "command.slap", false) then outputChatBox("Welcome to the Staff Zone", thePlayer, 0, 255, 0, true) else triggerClientEvent(thePlayer, "displayTimer", thePlayer) end end end addEventHandler("onColShapeHit", staffZone, enterArea) function warp() local posX, posY = getElementPosition(source) local inArea = isInsideRadarArea(radar, posX, posY) if (inArea) then if hasObjectPermissionTo(source, "command.slap", false) then outputChatBox("Welcome to the Staff Zone", source, 0, 255, 0, true) else outputChatBox("You are not allowed in this area!", source, 255, 0, 0, true) if isPedInVehicle ( source ) then local playerVehicle = getPedOccupiedVehicle ( source ) setElementPosition(playerVehicle, 2341.2072753906, -1658.8668212891, 13.379216194153) else setElementPosition(source, 2341.2072753906, -1658.8668212891, 13.379216194153) end end end end addEvent("warp", true) addEventHandler("warp", root, warp) Link to comment
Castillo Posted August 20, 2012 Share Posted August 20, 2012 This only happens when you enter with a vehicle as well, right? Edit: You can use this: radar = createRadarArea(2418.4255371094, -1735,121.6306152344,100,0,150,0,153) setElementData(radar,"zombieProof",true) staffZone = createColRectangle (2418.4255371094, -1735,121.6306152344,100) addEventHandler("onColShapeHit", staffZone, function(h) if not isElement(h) then return end if getElementData(h,"zombie") then killPed(h) end end) function enterArea(thePlayer) if ( getElementType ( thePlayer ) == "player" ) then local posX, posY = getElementPosition(thePlayer) local inArea = isInsideRadarArea(radar, posX, posY) if (inArea) then if hasObjectPermissionTo(thePlayer, "command.slap", false) then outputChatBox("Welcome to the Staff Zone", thePlayer, 0, 255, 0, true) else triggerClientEvent(thePlayer, "displayTimer", thePlayer) end end end end addEventHandler("onColShapeHit", staffZone, enterArea) function warp() local posX, posY = getElementPosition(source) local inArea = isInsideRadarArea(radar, posX, posY) if (inArea) then if hasObjectPermissionTo(source, "command.slap", false) then outputChatBox("Welcome to the Staff Zone", source, 0, 255, 0, true) else outputChatBox("You are not allowed in this area!", source, 255, 0, 0, true) if isPedInVehicle ( source ) then local playerVehicle = getPedOccupiedVehicle ( source ) setElementPosition(playerVehicle, 2341.2072753906, -1658.8668212891, 13.379216194153) else setElementPosition(source, 2341.2072753906, -1658.8668212891, 13.379216194153) end end end end addEvent("warp", true) addEventHandler("warp", root, warp) Link to comment
Drakath Posted August 20, 2012 Author Share Posted August 20, 2012 No, I'm not in vehicle and it keeps giving me this error Link to comment
Castillo Posted August 20, 2012 Share Posted August 20, 2012 Well, here it only did the bad argument when I entered with a vehicle. It outputs: Welcome to the Staff Zone when I enter the zone, no errors. Link to comment
Drakath Posted August 20, 2012 Author Share Posted August 20, 2012 Yeah your script works. Thanks Link to comment
TAPL Posted August 20, 2012 Share Posted August 20, 2012 viewtopic.php?f=91&t=46926 viewtopic.php?f=91&t=46929 viewtopic.php?f=91&t=46941 Was this code need to have 3 topics? Please in the future keep it in one topic. 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