addEventHandler("onPlayerJoin", root, --for the purpose of this tutorial only, really you should use a saving system
function()
setElementData(source, "wantedLevel", 0)
end
)
function warpToJail(wantedLevel)
if (getElementType(source) == "player") then
if getElementData(source, wantedLevel) == 3 then
setElementInterior(source, interior) --insert interior of jail
setElementPosition(source, posX, posY, posZ) --insert position of jail
setElementRotation(source, rotX, rotY, rotZ) --set the players rotation if need be
outputChatBox("You have been sent to jail!", source, 255, 0, 0) --output a message to the player who was jailed
end
end
end
addEventHandler("onElementDataChange", root, warpToJail)
Then you will need a system to add wanted levels to players and preferably a saving system to save the wanted level for each player. To accomplish this you should use MySQL or SQLite to save the players data into a table in a database every time they log out and retrieve it when they log back in.