
Untitled
By: a guest on
May 15th, 2012 | syntax:
Lua | size: 1.43 KB | hits: 23 | expires: Never
arrestedPlayers = {}
function onPlayerNightstickArrest ( attacker, weapon, bodypart, loss )
if isElement(attacker) and (weapon == 3) then
if (getTeamName(getPlayerTeam(attacker)) == "Police") or (getTeamName(getPlayerTeam(attacker)) == "SWAT") or (getTeamName(getPlayerTeam(attacker)) == "Military Forces") then
if not(getElementData ( source, "isPlayerArrested" )) and ( getPlayerWantedLevel(source) > 0 ) then
setElementData ( source, "isPlayerArrested", true )
toggleAllControls ( source, false, true, false )
giveWeapon ( source, 0, 0, true )
triggerClientEvent( source, "onClientFollowTheCop", source, attacker, source)
outputChatBox("You got arrest by " .. getPlayerName(attacker) .. "!", source, 0, 225, 0)
outputChatBox("You arrested " .. getPlayerName(source) .. "!", attacker, 0, 225, 0)
table.insert( arrestedPlayers, attacker, source )
end
end
end
end
addEventHandler ( "onPlayerDamage", root, onPlayerNightstickArrest )
function onOfficerReleasePrisoner ( playerSource, commandName, prisoner )
local thePrisoner = getPlayerFromName( prisoner )
if arrestedPlayers[playerSource][thePrisoner] then
outputChatBox("Ok")
else
outputChatBox("No")
end
end
addCommandHandler( "release", onOfficerReleasePrisoner )
function canOfficerArrest( officer )
if #arrestedPlayers[officer] >= 2 then
return false
else
return true
end
endPosition ( source, x + 2, y + 2, z )