nokizorque

Untitled

Dec 16th, 2015
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.35 KB | None | 0 0
  1. vowels = {["a"] = true, ["e"] = true, ["i"] = true, ["o"] = true, ["u"] = true}
  2.  
  3. function warpToPlayer(plr)
  4.    
  5. end
  6. addEvent("UCDadmin.warpToPlayer", true)
  7. addEventHandler("UCDadmin.warpToPlayer", root, warpToPlayer)
  8.  
  9. function warpPlayerTo(plr, warpTo)
  10.    
  11. end
  12. addEvent("UCDadmin.warpPlayerTo", true)
  13. addEventHandler("UCDadmin.warpPlayerTo", root, warpPlayerTo)
  14.  
  15. function reconnectPlayer(plr)
  16.     if (plr and client and isPlayerAdmin(client)) then
  17.         if (isPlayerOwner(plr) and not isPlayerOwner(client)) then return end
  18.         exports.UCDdx:new(client, "You have reconnected "..plr.name, 0, 255, 0)
  19.         plr:redirect("", getServerPort()) -- Redirects to the same server with the same port
  20.         outputChatBox(plr.name.." has been reconnected by "..client.name, root, 255, 140, 0)
  21.     end
  22. end
  23. addEvent("UCDadmin.reconnect", true)
  24. addEventHandler("UCDadmin.reconnect", root, reconnectPlayer)
  25.  
  26. function kickPlayer_(plr, reason)
  27.     if (plr and client and reason and isPlayerAdmin(client)) then
  28.         if (isPlayerOwner(plr) and not isPlayerOwner(client)) then return end
  29.         if reason == " " or reason == "" then
  30.             exports.UCDdx:new(client, "You have kicked "..plr.name, 0, 255, 0)
  31.             plr:kick(client)
  32.             outputChatBox(plr.name.." has been kicked by "..client.name, root, 255, 140, 0)
  33.             return
  34.         end
  35.         exports.UCDdx:new(client, "You have kicked "..plr.name.." for '"..reason.."'", 0, 255, 0)
  36.         plr:kick(client, reason) -- Set char limit on client [64]
  37.         outputChatBox(plr.name.." has been kicked by "..client.name.." ("..reason..")", root, 255, 140, 0)
  38.     end
  39. end
  40. addEvent("UCDadmin.kick", true)
  41. addEventHandler("UCDadmin.kick", root, kickPlayer_)
  42.  
  43. function freezePlayer(ele, plr_)
  44.     if (ele and isElement(ele)) then
  45.         if (ele.type == "player") then
  46.             if ele.frozen then
  47.                 ele.frozen = false
  48.                 toggleAllControls(ele, true)
  49.                 exports.UCDdx:new(ele, "You have been unfrozen by "..client.name, 0, 255, 0)
  50.                 exports.UCDdx:new(client, "You have unfrozen "..ele.name, 0, 255, 0)
  51.             else
  52.                 ele.frozen = true
  53.                 exports.UCDdx:new(ele, "You have been frozen by "..client.name, 0, 255, 0)
  54.                 exports.UCDdx:new(client, "You have frozen "..ele.name, 0, 255, 0)
  55.                 toggleAllControls(ele, false, true, false)
  56.             end
  57.         elseif (ele.type == "vehicle") then
  58.             if ele.frozen then
  59.                 ele.frozen = false
  60.                 for _, plr in pairs(ele.occupants) do
  61.                     exports.UCDdx:new(plr, "The vehicle you are currently in has been unfrozen by "..client.name, 0, 255, 0)
  62.                 end
  63.                 exports.UCDdx:new(client, "You have unfrozen "..plr_.name.."'s "..ele.name, 0, 255, 0)
  64.             else
  65.                 ele.frozen = true
  66.                 for _, plr in pairs(ele.occupants) do
  67.                     exports.UCDdx:new(plr, "The vehicle you are currently in has been frozen by "..client.name, 0, 255, 0)
  68.                 end
  69.                 exports.UCDdx:new(client, "You have frozen "..plr_.name.."'s "..ele.name, 0, 255, 0)
  70.             end
  71.         end
  72.     end
  73. end
  74. addEvent("UCDadmin.freeze", true)
  75. addEventHandler("UCDadmin.freeze", root, freezePlayer)
  76.  
  77. function shoutToPlayer(plr, text)
  78.     -- Have to make this post GUI
  79. end
  80. addEvent("UCDadmin.shout", true)
  81. addEventHandler("UCDadmin.shout", root, shoutToPlayer)
  82.  
  83. function spectatePlayer(plr)
  84.     if (isPlayerOwner(plr) and not isPlayerOwner(client)) then return false end
  85.     if (getPlayerAdminRank(plr) == 5 and getPlayerAdminRank(client) ~= 5) then return false end
  86.    
  87. end
  88. addEvent("UCDadmin.spectate", true)
  89. addEventHandler("UCDadmin.spectate", root, spectatePlayer)
  90.  
  91. function slapPlayer(plr, hp)
  92.     if (plr and client and hp and isPlayerAdmin(client)) then
  93.         plr:kill()
  94.         exports.UCDdx:new(client, "You have slapped "..plr.name.." for "..hp.." HP", 0, 255, 0)
  95.         exports.UCDdx:new(plr, "You have been slapped by "..client.name.." for "..hp.." HP", 0, 255, 0)
  96.     end
  97. end
  98. addEvent("UCDadmin.slap", true)
  99. addEventHandler("UCDadmin.slap", root, slapPlayer)
  100.  
  101. function renamePlayer(plr, newName)
  102.     if (plr and client and newName and isPlayerAdmin(client)) then
  103.         exports.UCDdx:new(client, "You have changed "..plr.name.."'s name to "..newName, 0, 255, 0)
  104.         plr:setName(tostring(newName)) -- Set max edit length on client GUI
  105.         exports.UCDdx:new(plr, "You name has been changed to "..newName.." by "..client.name, 0, 255, 0)
  106.     end
  107. end
  108. addEvent("UCDadmin.rename", true)
  109. addEventHandler("UCDadmin.rename", root, renamePlayer)
  110.  
  111. function takeScreenshotOfPlayer(plr)
  112.     -- This one will take a while
  113. end
  114. addEvent("UCDadmin.takeScreenshot", true)
  115. addEventHandler("UCDadmin.takeScreenshot", root, takeScreenshotOfPlayer)
  116.  
  117. function setPlayerMoney_(plr, newAmount)
  118.    
  119. end
  120. addEvent("UCDadmin.setMoney", true)
  121. addEventHandler("UCDadmin.setMoney", root, setPlayerMoney_)
  122.  
  123. function setPlayerModel(plr, model)
  124.     if (plr and client and model and isPlayerAdmin(client)) then
  125.         local model_ = tonumber(model)
  126.         if model_ >= 0 and model_ <= 311 then
  127.             plr:setModel(model_)
  128.             exports.UCDdx:new(client, "You have set the model of "..plr.name.." to "..model_, 0, 255, 0)
  129.             exports.UCDdx:new(plr, "Your model has been set to "..model_.." by "..client.name, 0, 255, 0)
  130.         end
  131.     end
  132. end
  133. addEvent("UCDadmin.setModel", true)
  134. addEventHandler("UCDadmin.setModel", root, setPlayerModel)
  135.  
  136. function setPlayerHealth(plr, health)
  137.     if (plr and client and isPlayerAdmin(client)) then
  138.         local health_ = tonumber(health)
  139.         if health_ then
  140.             if health_ >= 0 and health_ <= 200 then
  141.                 plr:setHealth(health_)
  142.                 exports.UCDdx:new(client, "You have set the health of "..plr.name.." to "..health_, 0, 255, 0)
  143.                 exports.UCDdx:new(plr, "Your health has been set to "..health_.." by "..client.name, 0, 255, 0)
  144.             end
  145.         end
  146.     end
  147. end
  148. addEvent("UCDadmin.setHealth", true)
  149. addEventHandler("UCDadmin.setHealth", root, setPlayerHealth)
  150.  
  151. function setPlayerArmour(plr, armour)
  152.     if (plr and client and isPlayerAdmin(client)) then
  153.         local armour_ = tonumber(armour)
  154.         if armour_ then
  155.             if armour_ >= 0 and armour_ <= 100 then
  156.                 plr.armor = armour_
  157.                 exports.UCDdx:new(client, "You have set the armour of "..plr.name.." to "..armour_, 0, 255, 0)
  158.                 exports.UCDdx:new(plr, "Your armour has been set to "..armour_.." by "..client.name, 0, 255, 0)
  159.             end
  160.         end
  161.     end
  162. end
  163. addEvent("UCDadmin.setArmour", true)
  164. addEventHandler("UCDadmin.setArmour", root, setPlayerArmour)
  165.  
  166. function setPlayerDimension(plr, dimension)
  167.     if (plr and client and isPlayerAdmin(client)) then
  168.         plr:setDimension(dimension)
  169.         exports.UCDdx:new(client, "You have set "..plr.name.."'s dimension to "..dimension, 0, 255, 0)
  170.         exports.UCDdx:new(client, "Your dimension has been set to "..dimension.." by "..plr.name, 0, 255, 0)
  171.     end
  172. end
  173. addEvent("UCDadmin.setDimension", true)
  174. addEventHandler("UCDadmin.setDimension", root, setPlayerDimension)
  175.  
  176. function setPlayerInterior(plr, interior)
  177.     if (plr and client and isPlayerAdmin(client)) then
  178.         plr:setInterior(interior)
  179.         exports.UCDdx:new(client, "You have set "..plr.name.."'s interior to "..interior, 0, 255, 0)
  180.         exports.UCDdx:new(plr, "Your interior has been set to "..interior.." by "..plr.name, 0, 255, 0)
  181.     end
  182. end
  183. addEvent("UCDadmin.setInterior", true)
  184. addEventHandler("UCDadmin.setInterior", root, setPlayerInterior)
  185.  
  186. function giveVehicle(plr, vehicle)
  187.     if (plr and client and vehicle and isPlayerAdmin(client)) then
  188.    
  189.         local spawnedVehicle
  190.        
  191.         -- We're dealing with a vehicle ID
  192.         if tostring(vehicle):match("%d") and tonumber(vehicle) ~= false and tonumber(vehicle) ~= nil then
  193.            
  194.             -- Possibly add this vehicle to a table so he can /djv it
  195.             spawnedVehicle = Vehicle(vehicle, plr.position, 0, 0, getPedRotation(plr), "PEN15")
  196.             warpPedIntoVehicle(plr, spawnedVehicle)
  197.            
  198.         else -- We're dealing with a vehicle name
  199.             spawnedVehicle = Vehicle(Vehicle.getModelFromName(vehicle), plr.position, 0, 0, getPedRotation(plr), "PEN15")
  200.             warpPedIntoVehicle(plr, spawnedVehicle)
  201.         end
  202.        
  203.         if vowels[spawnedVehicle.name:sub(1, 1):lower()] then
  204.             exports.UCDdx:new(plr, "You have been given an "..spawnedVehicle.name.." by "..client.name, 0, 255, 0)
  205.             exports.UCDdx:new(client, "You have given "..plr.name.." an "..spawnedVehicle.name, 0, 255, 0)
  206.         else
  207.             exports.UCDdx:new(plr, "You have been given a "..spawnedVehicle.name.." by "..client.name, 0, 255, 0)
  208.             exports.UCDdx:new(client, "You have given "..plr.name.." a "..spawnedVehicle.name, 0, 255, 0)
  209.         end
  210.     end
  211. end
  212. addEvent("UCDadmin.giveVehicle", true)
  213. addEventHandler("UCDadmin.giveVehicle", root, giveVehicle)
  214.  
  215. function fixVehicle_(plr, vehicle)
  216.    
  217. end
  218. addEvent("UCDadmin.fixVehicle", true)
  219. addEventHandler("UCDadmin.fixVehicle", root, fixVehicle_)
  220.  
  221. function ejectPlayerFromVehicle(plr)
  222.    
  223. end
  224. addEvent("UCDadmin.ejectPlayer", true)
  225. addEventHandler("UCDadmin.ejectPlayer", root, ejectPlayerFromVehicle)
  226.  
  227. function destroyVehicle(plr, vehicle)
  228.     if (plr and client and isPlayerAdmin(client)) then
  229.         -- The vehicle may have been a player vehicle and hence already destroyed client-side
  230.         if vehicle then
  231.             vehicle:destroy()
  232.         end
  233.         exports.UCDdx:new(plr, "Your vehicle has been destroyed by "..client.name, 0, 255, 0)
  234.         exports.UCDdx:new(client, "You have destroyed "..client.name.."'s vehicle", 0, 255, 0)
  235.     end
  236. end
  237. addEvent("UCDadmin.destroyVehicle", true)
  238. addEventHandler("UCDadmin.destroyVehicle", root, destroyVehicle)
  239.  
  240. function disableVehicle(plr, vehicle)
  241.    
  242. end
  243. addEvent("UCDadmin.disableVehicle", true)
  244. addEventHandler("UCDadmin.disableVehicle", root, disableVehicle)
  245.  
  246. function blowVehicle_(plr, vehicle)
  247.    
  248. end
  249. addEvent("UCDadmin.blowVehicle", true)
  250. addEventHandler("UCDadmin.blowVehicle", root, blowVehicle_)
Add Comment
Please, Sign In to add comment