--Below is the actual shop script that creates the markers, the blips, and the gui. this can be easily adapted to other script if you read the comments i have left. simply replace all instances of the word "surf" with whatever you want your shop to be named. cost = 2000 --The price of whatever the player is getting --below is the initial setup addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), function() local theMarker = createMarker ( 1183.72, -1258.08, 14.1, "cylinder", 1, 255, 255, 255, 170 ) setElementData ( theMarker, "purpose", "surf_shop" ) setElementData ( theblip, "purpose", "surf_shop_blip" ) --the gui that allows players to say yes or no after entering a marker surf_shop_Window = {} surf_shop_Button = {} surf_shop_Label = {} surf_shop_Window1 = guiCreateWindow(0.35,0.45,0.3162,0.1717,"Skate",true) --the title of the window i sset here guiWindowSetSizable(surf_shop_Window1,false) surf_shop_YesButton = guiCreateButton(0.087,0.5631,0.3676,0.3107,"Sim",true,surf_shop_Window1) surf_shop_NoButton = guiCreateButton(0.5375,0.5534,0.3676,0.3107,"Nao",true,surf_shop_Window1) surf_shop_Label1 = guiCreateLabel(0.17,0.2524,0.668,0.2233,"Quer Comprar Um Skate Por R$ : " .. cost .." ?",true,surf_shop_Window1) --the question you ask the player, this one include the price in the question. guiLabelSetVerticalAlign(surf_shop_Label1,"top") guiLabelSetHorizontalAlign(surf_shop_Label1,"left",false) guiSetVisible ( surf_shop_Window1, false ) addEventHandler ( "onClientGUIClick", surf_shop_YesButton, surf_shop_Start) addEventHandler ( "onClientGUIClick", surf_shop_NoButton, surf_shop_Cancel) --this sets the blips to be streamed out using the blipstreamer resource. (as long as blipstreamer is on, so you might want to include it in the meta) local blips = getElementsByType ( "blip" ) for theKey,theBlip in ipairs(blips) do if (getElementData ( theBlip, "purpose" ) == "surf_shop_blip" ) then call(getResourceFromName"blipstreamer","setBlipStreamable",theBlip, true, 90 ) end end end ) --this function triggers the gui to open when a player walks into the marker function surf_shopMarkerHit ( hitPlayer, matchingDimension ) if (hitPlayer == getLocalPlayer()) and (isPedOnGround ( getLocalPlayer())) then if (getElementData ( source, "purpose" ) == "surf_shop" ) then if getPlayerMoney(getLocalPlayer()) >= cost then guiSetVisible ( surf_shop_Window1, true ) guiBringToFront ( surf_shop_Window1 ) showCursor ( true ) end end end end addEventHandler ( "onClientMarkerHit", getRootElement(), surf_shopMarkerHit ) --this function removes the gui if a player leaevs the marker function surf_shopMarkerLeave ( hitPlayer, matchingDimension ) if (hitPlayer == getLocalPlayer()) then if (getElementData ( source, "purpose" ) == "surf_shop" ) then guiSetVisible ( surf_shop_Window1, false ) showCursor ( false ) end end end addEventHandler ( "onClientMarkerLeave", getRootElement(), surf_shopMarkerLeave ) --this function gets triggered if a player clicks "no" function surf_shop_Cancel () guiSetVisible ( surf_shop_Window1, false ) showCursor ( false ) end --this is the function that gets triggered if the player clicks "yes" function surf_shop_Start () guiSetVisible ( surf_shop_Window1, false ) showCursor ( false ) takePlayerMoney ( cost ) --alter anything below this line to do whatever you want to happen when yes is clicked, for this scripts purpose, i trigger a server event to spawn a surfboard triggerServerEvent ( "onSurf_shopStart", getLocalPlayer(), getLocalPlayer() ) end --EVERYTHING BELOW HERE IS STRICTLY RELATED TO THE SURFBOARD, AND DOES NOT NEED TO BE USED IN YOUR OWN SCRIPT AT ALL addEvent("surfboardcreated", true ) function fixboard(surfboard) setElementCollisionsEnabled(surfboard, false) end addEventHandler("surfboardcreated", getRootElement(), fixboard) function surfenter(thePlayer, seat) if thePlayer == getLocalPlayer() then if (getElementData( source, "purpose" ) == "surfboard") then setVehicleOverrideLights ( source, 1 ) showPlayerHudComponent ( "vehicle_name", false ) setWorldSpecialPropertyEnabled ( "hovercars", false )-- LETS SURFBOARDS GO ON WATER setWorldSpecialPropertyEnabled ( "aircars", false ) -- LETS SURFBOARDS FLY else setVehicleOverrideLights ( source, 1 ) showPlayerHudComponent ( "vehicle_name", true ) setWorldSpecialPropertyEnabled ( "hovercars", false ) setWorldSpecialPropertyEnabled ( "aircars", false ) end end end addEventHandler("onClientVehicleEnter", getRootElement(), surfenter) function surfexit(thePlayer, seat) if thePlayer == getLocalPlayer() and (getElementData( source, "purpose" ) == "surfboard") then setWorldSpecialPropertyEnabled ( "hovercars", false ) setWorldSpecialPropertyEnabled ( "aircars", false ) setVehicleOverrideLights ( source, 0 ) showPlayerHudComponent ( "vehicle_name", true ) end end addEventHandler("onClientVehicleExit", getRootElement(), surfexit) addEvent("surfboardwipeout", true ) function fixboard(theplayer) if thePlayer == getLocalPlayer() then setWorldSpecialPropertyEnabled ( "hovercars", false ) setWorldSpecialPropertyEnabled ( "aircars", false ) showPlayerHudComponent ( "vehicle_name", true ) end end addEventHandler("surfboardwipeout", getRootElement(), fixboard)