xXMADEXx Posted January 23, 2013 Share Posted January 23, 2013 Hey guys, i am making a jail system. For some reason, if the "p2" is in a vehicle, it wont destroy it, and i dont know how to make it so that it will not jail an unknown player. any help? --[[ Author: RoG Scripting Team Name: RoG Jail System File: server.lua type: server Copywrite (c) Revolution of Gaming ]] function jail(p1,_,p2,...) local text = table.concat({...}, " ") local nick=getPlayerName(p1) local nick2=getPlayerFromName(p2) local data=getElementData(p1,"Job") -- if (data=="Staff") then if (p2) and (...) then if isPedInVehicle(p2) then destroyElement(getPedOccupiedVehicle(p2)) end setElementPosition(nick2,264.1982421875, 77.5634765625, 1001.0390625) setElementInterior(nick2,6) triggerClientEvent(getRootElement(),"message:addMessage",getRootElement(),getPlayerName(nick2) .." Has Been Jailed By Admin ".. nick .." For: ".. text, 255, 0, 0) destroyElement(vehicle) else triggerClientEvent(p1,"message:addMessage",p1,"Usage: /jail [name] [reason]", 255, 0, 0) end end end addCommandHandler("jail",jail) Link to comment
Malicious Hero. Posted January 23, 2013 Share Posted January 23, 2013 Try this. --[[ Author: RoG Scripting Team Name: RoG Jail System File: server.lua type: server Copywrite (c) Revolution of Gaming ]] function jail(p1,_,p2,...) local text = table.concat({...}, " ") local nick=getPlayerName(p1) local nick2=getPlayerFromName(p2) local data=getElementData(p1,"Job") -- if (data=="Staff") then if (p2) and (...) then local veh = getPedOccupiedVehicle( p2 ) if veh ~= false then destroyElement( veh ) end setElementPosition(nick2,264.1982421875, 77.5634765625, 1001.0390625) setElementInterior(nick2,6) triggerClientEvent(getRootElement(),"message:addMessage",getRootElement(),getPlayerName(nick2) .." Has Been Jailed By Admin ".. nick .." For: ".. text, 255, 0, 0) destroyElement(vehicle) else triggerClientEvent(p1,"message:addMessage",p1,"Usage: /jail [name] [reason]", 255, 0, 0) end end end addCommandHandler("jail",jail) Link to comment
TAPL Posted January 23, 2013 Share Posted January 23, 2013 Line 23, vehicle is not defined. destroyElement(vehicle) 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