Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --------------->>
- -- Client Side
- --------------->>
- marker = createMarker (2495.3051, -1690.7011, 13.7656, "cylinder", 1.5, 255, 0, 0 )
- window = guiCreateWindow(234,160,301,249,"CJ's house",false)
- guiSetAlpha(window,0.8)
- btnNo = guiCreateButton(176,189,101,44,"No",false,window)
- btnYes = guiCreateButton(25,190,101,42,"Yes",false,window)
- memo = guiCreateMemo(27,28,246,150,"Click Yes to receive a free Colt .45 and 500 dollars.",false,window)
- guiSetVisible( window, false ) -- Make sure the GUI doesn' show when the resource starts
- function markerHit( player, dimension )
- if player == localPlayer then -- If the element that hit the marker is you
- guiSetVisible( window, true ) -- Show you the GUI
- showCursor( true ) -- And show your cursor
- end
- end
- addEventHandler("onClientMarkerHit", marker, markerHit)
- -- Run the function whenever something hits 'marker'
- function onGUIClick( button, state )
- if button == "left" and state == "up" then -- If the player left clicked the button and has released it
- if source == btnNo then -- If the clicked button was btnNo
- guiSetVisible( window, false ) -- Hide the GUI
- showCursor( false ) -- Hide Your Cursor
- elseif source == btnYes then -- elseif the clicked button was btnYes
- triggerServerEvent( "marker.givePlayerStuff", localPlayer )
- -- Trigger the server side event: "marker.givePlayerStuff", and make the source the localPlayer (you)
- end
- end
- end
- addEventHandler( "onClientGUIClick", resourceRoot, onGUIClick )
- -- Run the function whenever a GUI element is clicked that was created by this resource
- --------------->>
- -- Server Side
- --------------->>
- function givePlayerStuff()
- givePlayerMoney( source, 500 ) -- gives the event's source ( the localPlayer (you) ) $500
- giveWeapon( source, 22, 50 ) -- and a pistol
- end
- addEvent( "marker.givePlayerStuff", true ) -- add the new event
- addEventHandler( "marker.givePlayerStuff", root, givePlayerStuff )
- -- run the function 'givePlayerStuff' everytime the event "marker.givePlayerStuff" is triggered
Add Comment
Please, Sign In to add comment