Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 15th, 2012  |  syntax: Lua  |  size: 1.43 KB  |  hits: 23  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. arrestedPlayers = {}
  2.  
  3. function onPlayerNightstickArrest ( attacker, weapon, bodypart, loss )
  4.         if isElement(attacker) and (weapon == 3) then
  5.                 if (getTeamName(getPlayerTeam(attacker)) == "Police") or (getTeamName(getPlayerTeam(attacker)) == "SWAT") or (getTeamName(getPlayerTeam(attacker)) == "Military Forces") then
  6.                         if not(getElementData ( source, "isPlayerArrested" )) and ( getPlayerWantedLevel(source) > 0 ) then    
  7.                                 setElementData ( source, "isPlayerArrested", true )
  8.                                 toggleAllControls ( source, false, true, false )
  9.                                 giveWeapon ( source, 0, 0, true )
  10.                                 triggerClientEvent( source, "onClientFollowTheCop", source, attacker, source)
  11.                                 outputChatBox("You got arrest by " .. getPlayerName(attacker) .. "!", source, 0, 225, 0)
  12.                                 outputChatBox("You arrested " .. getPlayerName(source) .. "!", attacker, 0, 225, 0)
  13.                                 table.insert( arrestedPlayers, attacker, source )
  14.                         end
  15.                 end
  16.         end
  17. end
  18. addEventHandler ( "onPlayerDamage", root, onPlayerNightstickArrest )
  19.  
  20. function onOfficerReleasePrisoner ( playerSource, commandName, prisoner )
  21.         local thePrisoner = getPlayerFromName( prisoner )
  22.         if arrestedPlayers[playerSource][thePrisoner] then
  23.                 outputChatBox("Ok")
  24.         else
  25.                 outputChatBox("No")
  26.         end
  27. end
  28. addCommandHandler( "release", onOfficerReleasePrisoner )
  29.  
  30. function canOfficerArrest( officer )
  31.         if #arrestedPlayers[officer] >= 2 then
  32.                 return false
  33.         else
  34.                 return true
  35.         end
  36. endPosition ( source, x + 2, y + 2, z )