Guest User

Untitled

a guest
May 24th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.02 KB | None | 0 0
  1. --------------->>
  2. -- Client Side
  3. --------------->>
  4.  
  5. marker = createMarker (2495.3051, -1690.7011, 13.7656, "cylinder", 1.5, 255, 0, 0 )
  6. window = guiCreateWindow(234,160,301,249,"CJ's house",false)
  7. guiSetAlpha(window,0.8)
  8. btnNo = guiCreateButton(176,189,101,44,"No",false,window)
  9. btnYes = guiCreateButton(25,190,101,42,"Yes",false,window)
  10. memo = guiCreateMemo(27,28,246,150,"Click Yes to receive a free Colt .45 and 500 dollars.",false,window)
  11. guiSetVisible( window, false ) -- Make sure the GUI doesn' show when the resource starts
  12.  
  13. function markerHit( player, dimension )
  14.     if player == localPlayer then -- If the element that hit the marker is you
  15.         guiSetVisible( window, true ) -- Show you the GUI
  16.         showCursor( true ) -- And show your cursor
  17.     end
  18. end
  19. addEventHandler("onClientMarkerHit", marker, markerHit)
  20.     -- Run the function whenever something hits 'marker'
  21.  
  22. function onGUIClick( button, state )
  23.     if button == "left" and state == "up" then -- If the player left clicked the button and has released it
  24.         if source == btnNo then -- If the clicked button was btnNo
  25.             guiSetVisible( window, false ) -- Hide the GUI
  26.             showCursor( false ) -- Hide Your Cursor
  27.         elseif source == btnYes then -- elseif the clicked button was btnYes
  28.             triggerServerEvent( "marker.givePlayerStuff", localPlayer )
  29.                 -- Trigger the server side event: "marker.givePlayerStuff", and make the source the localPlayer (you)
  30.         end
  31.     end
  32. end
  33. addEventHandler( "onClientGUIClick", resourceRoot, onGUIClick )
  34.     -- Run the function whenever a GUI element is clicked that was created by this resource
  35.  
  36. --------------->>
  37. -- Server Side
  38. --------------->>
  39.  
  40. function givePlayerStuff()
  41.     givePlayerMoney( source, 500 ) -- gives the event's source ( the localPlayer (you) ) $500
  42.     giveWeapon( source, 22, 50 ) -- and a pistol
  43. end
  44. addEvent( "marker.givePlayerStuff", true ) -- add the new event
  45. addEventHandler( "marker.givePlayerStuff", root, givePlayerStuff )
  46.     -- run the function 'givePlayerStuff' everytime the event "marker.givePlayerStuff" is triggered
Add Comment
Please, Sign In to add comment