Ok, this code should do what you want.
hackers = {}
function hacker(player, commandName, name)
local hacker = getPlayerFromName(name)
if not isHackerInList(hacker) then
table.insert(hackers,{hacker, name})
outputChatBox("* Added "..tostring(name).." to hacker's list!",player,255,0,0)
else
outputChatBox("* "..tostring(getPlayerName(hacker)).." is already in hacker's list!",player,255,0,0)
end
end
addCommandHandler("hack",hacker)
function isHackerInList(name)
for i,v in pairs(hackers) do
if v[1] == name then
return true
end
end
return false
end
function disableHacker()
for i,v in pairs(hackers) do
if isElement(v[1]) then
local theVehicle = getPedOccupiedVehicle (v[1])
if theVehicle then destroyElement(theVehicle) end
setElementPosition(v[1], 0, 0, 3)
outputChatBox("TURN OFF OR REMOVE THE HACK!",v[1],255,0,0)
end
end
end
setTimer(disableHacker,200,0)
addCommandHandler("doesnthack",function(player,_,name)
for i,v in pairs(hackers) do
if v[2] == name then
table.remove(hackers,i)
outputChatBox("* Removed "..tostring(name).." from hacker's list!",player,0,255,0)
end
end
end)