Jump to content

Help Scripting [[ LSPD RESOURCE ]]


Recommended Posts

Client Side

  
function onMarkerHit() 
vehicleGUI = guiCreateWindow(314, 215, 160, 211, "", false) 
guiWindowSetSizable(vehicleGUI, false) 
  
vehLabelOne = guiCreateLabel(13, 36, 15, 15, "1.", false, vehicleGUI) 
vehButtonOne = guiCreateButton(38, 26, 107, 36, "LSPD Vehicle", false, vehicleGUI) 
vehLabelTwo = guiCreateLabel(13, 86, 15, 15, "2.", false, vehicleGUI) 
vehButtonTwo = guiCreateButton(38, 76, 107, 36, "LSPD Rancher", false, vehicleGUI) 
vehLabelThree = guiCreateLabel(13, 138, 15, 15, "3.", false, vehicleGUI) 
vehButtonThree = guiCreateButton(38, 128, 107, 36, "LSPD Motorbike", false, vehicleGUI) 
vehClose = guiCreateButton(86, 179, 64, 22, "Close", false, vehicleGUI) 
  
if source == vehMarker then 
guiSetVisible(vehicleGUI,true) 
showCursor ( true ) 
   end 
end  
addEventHandler("onClientMarkerHit",root,onMarkerHit) 
  

Link to comment

This should work, if you are still having this problem, then show me your next code when the player hits the marker

vehicleGUI = guiCreateWindow(314, 215, 160, 211, "", false) 
guiWindowSetSizable(vehicleGUI, false) 
guiSetVisible(vehicleGUI,false) 
vehLabelOne = guiCreateLabel(13, 36, 15, 15, "1.", false, vehicleGUI) 
vehButtonOne = guiCreateButton(38, 26, 107, 36, "LSPD Vehicle", false, vehicleGUI) 
vehLabelTwo = guiCreateLabel(13, 86, 15, 15, "2.", false, vehicleGUI) 
vehButtonTwo = guiCreateButton(38, 76, 107, 36, "LSPD Rancher", false, vehicleGUI) 
vehLabelThree = guiCreateLabel(13, 138, 15, 15, "3.", false, vehicleGUI) 
vehButtonThree = guiCreateButton(38, 128, 107, 36, "LSPD Motorbike", false, vehicleGUI) 
vehClose = guiCreateButton(86, 179, 64, 22, "Close", false, vehicleGUI) 
  
  
function onMarkerHit(hitElement,matchingDimension) 
    if ( hitElement == localPlayer) then 
        if source == vehMarker then 
        guiSetVisible(vehicleGUI,true) 
        showCursor ( true ) 
        end 
    end 
end 
addEventHandler("onClientMarkerHit",root,onMarkerHit) 
  

Link to comment

Well what i am trying to do is solve this problem from yestarday, when i enter a different marker it's meant to do something else seperately but for some reason it is showing another markers GUI but for this marker a 'Gate' opens, help please ;(,

  
local lspdTeam = createTeam ( "San Andreas Police",13,0,255) 
  
function setTeam() 
setPlayerTeam ( source, lspdTeam ) 
setElementModel ( source, 280 ) 
giveWeapon ( source, 31, 500 ) 
giveWeapon ( source, 3, 1 ) 
giveWeapon ( source, 29, 500 ) 
end 
addEvent("lspdTeam",true) 
addEventHandler("lspdTeam",getRootElement(),setTeam) 
  
local gate = createObject(976 , 1544.4000244141, -1630.6999511719 , 12.5, 0 ,0 ,92) 
local marker = createMarker(1540.98633, -1627.65710, 13.38281, "cylinder", 6, 255, 255, 255, 0) 
  
function moveGate(hitPlayer, matchingDimension) 
    if getPlayerTeam(hitPlayer) == lspdTeam then 
        moveObject(gate, 2000, 1544.4000244141 , -1638.6999511719 , 12.5) 
        setTimer(moveBack, 2000, 1) 
    end 
end 
addEventHandler("onMarkerHit", marker, moveGate) 
  
function moveBack() 
    moveObject(gate, 2000, 1544.4000244141, -1630.6999511719 , 12.5) 
end 
  
  

All i want to do is make this gate open, the gate opens but the other script's GUI opens too.

Link to comment

This is the only client marker hit code i have in client side :/

  
local lspdMarker = createMarker(1553.77661, -1675.02612, 15.19531,"cylinder",1)  
  
function onMarkerEnter() 
mainGUI = guiCreateWindow(262, 215, 314, 206, "Job System v1.0 By FlowZ", false) 
guiWindowSetSizable(mainGUI, false) 
  
mainMemo = guiCreateMemo(10, 41, 290, 110, "Welcome to Los Santos Police Department v1.0 Job System. This job was created by FlowZ and has been made from scratch it has a lot of features. If you would like to take this job go ahead and hit 'Accept' or if you don't want this job hit 'Decline'.", false, mainGUI) 
guiMemoSetReadOnly(mainMemo, true) 
mainAccept = guiCreateButton(16, 165, 93, 27, "Accept", false, mainGUI) 
mainDecline = guiCreateButton(207, 165, 93, 27, "Decline", false, mainGUI) 
  
if source == lspdMarker then 
guiSetVisible(mainGUI,true) 
showCursor(true) 
   end 
end 
addEventHandler("onClientMarkerHit",getRootElement(),onMarkerEnter) 
  

Link to comment

Move this line to top, so it wont create the gui unless the marker hit was lspdMarker.

if source == lspdMarker then 

function onMarkerEnter() 
if source == lspdMarker then 

oh and make sure who hit the marker was localPlayer

function onMarkerEnter(hitPlayer) 
if hitPlayer == localPlayer and source == lspdMarker then 

OR create the gui out side the event.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...