Guest User

Untitled

a guest
Sep 22nd, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.75 KB | None | 0 0
  1.          
  2.            
  3. --CLIENT SIDE--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  4.  
  5.  
  6. addEvent("showTimer", true)
  7. function displayTimer1()
  8.     setTimer(displayTimer, 10000, 1)
  9. end
  10. addEventHandler("showTimer", getRootElement(), displayTimer1)
  11.  
  12.  
  13.  
  14. function displayTimer()
  15.     local zTrigger = setTimer(function() triggerServerEvent("isPlayerThere", getLocalPlayer()) end, 10000, 1)
  16.     if ( isTimer ( timer ) ) then
  17.     local timeLeft = ( getTimerDetails ( timer ) / 1000 )
  18.     dxDrawText("To leave this area!",557.0,318.0,872.0,368.0,tocolor(255,0,0,255),2.0,"default","left","top",false,false,false)
  19.     dxDrawText("10",630.0,277.0,690.0,324.0,tocolor(255,0,0,255),3.0,"default","left","top",false,false,false)
  20.     dxDrawText("You have: ".. tostring ( timeLeft ),546.0,224.0,725.0,271.0,tocolor(255,0,0,255),4.0,"default","left","top",false,false,false)
  21.     end
  22. end
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29. --SERVER SIDE--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  30.  
  31.  
  32.  
  33. --setElementData (createRadarArea(2418.4255371094, -1735,121.6306152344,100,0,150,0,153),"zombieProof",true)
  34. --addEventHandler("onColShapeHit", createColRectangle (2418.4255371094, -1735,121.6306152344,100), function(h)if not isElement(h) then return end if getElementData(h,"zombie") then killPed(h) end end)
  35.  
  36. --Here are your codes ^^^^^
  37.  
  38. --Here are mine--
  39.  
  40. --The Zone
  41.  
  42. staffZone = createColCuboid(2418.4255371094, -1735,121.6306152344, 82, 178.25, 30)
  43. staffRadar = createRadarArea(2418.4255371094, -1735,121.6306152344,100,0,150,0,153)
  44.  
  45.  
  46. function enterStaffZone(hitElement)  
  47.     if getElementType ( hitElement ) == "player" then
  48.         if ( hasObjectPermissionTo ( playerSource, "function.slap", true ) ) then
  49.             outputChatBox ( "You entered a Staff Zone.", hitElement, 0, 255, 0, true )
  50.         else
  51.             outputChatBox ( "You are not allowed here.", hitElement, 255, 0, 0, true )
  52.             triggerClientEvent(hitElement, "showTimer", hitElement)
  53.         end
  54.     end
  55. end
  56. addEventHandler ( "onColShapeHit", staffZone, enterStaffZone)
  57.  
  58.  
  59. function warpThePlayer(hitElement)
  60.     local x,y = getElementPosition(theplayer)
  61.     local isInRadarArea( staffRadar, x, y)
  62.         if getElementType ( hitElement ) == "player" and (inArea) then
  63.             setElementPosition ( hitElement, 2341.2072753906, -1658.8668212891, 13.379216194153 )
  64.         else
  65.             outputChatBox ( "You Left The Area Successfully.", thePlayer, 0, 255, 0, true )
  66.         end
  67. end
  68. addEvent("isPlayerThere", true)
  69. addEventHandler("isPlayerThere", getRootElement(), warpThePlayer)
Add Comment
Please, Sign In to add comment