Jump to content

Need Help with this


Deep thinker

Recommended Posts

Hello I have made a script but it's not done yet so i need help with the markers they aren't getting viewed in game i think i have made the part of the markers correctly please check it,

marker = createMarker(1615.48865, -1506.98303, 12.20866,"cylinder", 2, 255, 0, 0, 255) () getRootElement

GUIEditor_Window = {}
GUIEditor_Button = {}
GUIEditor_Memo = {}

GUIEditor_Window[1] = guiCreateWindow(0.5399,0.6794,0.4063,0.456,"Drug Delivery System ",true)
GUIEditor_Button[1] = guiCreateButton(317,345,68,40,"Accept",false,GUIEditor_Window[1])
GUIEditor_Button[2] = guiCreateButton(245,346,68,39,"Cancel",false,GUIEditor_Window[1])
GUIEditor_Memo[1] = guiCreateMemo(18,33,438,102,"Deliver the Car to the blip on the radar in LV .\nIf there is any bugs report it to the owners.",false,GUIEditor_Window[1])
guiMemoSetReadOnly(GUIEditor_Memo[1],true)
--to Show the GUI
function ToggleDDMenu()
    if guiGetVisible(GUIEditor_Window[1]) then
        guiSetVisible(GUIEditor_Window[1], false)
        showCursor(false)
    else
        guiSetVisible(GUIEditor_Window[1], true)
        showCursor(true)
        end
addEventHandler("onMarkerHit",marker,ToggleDDMenu)

wish to get replayed as soon as possible .

thank you.

Link to comment

actually i have a tiny scripting experience so i didn't know about this onClientMarkerHit

12 minutes ago, FaHaD said:

As what @quindo said also 

Why are you using 'onMarkerHit' , In client side for sure it will not work and you should use 'onClientMarkerHit' + check the hit is a local player and if he was in vehicle or not.

also i have done what you all said ,but i don't even know wtf is this debug script :3

also sometimes i don't know which functions/events to use in the client and server side

Link to comment

try this :

 

local marker = createMarker ( 1615.48865,-1506.98303,12.20866,"cylinder",2,255,0,0,255 ) 
GUIEditor_Window = {}
GUIEditor_Button = {}
GUIEditor_Memo = {}

GUIEditor_Window[1] = guiCreateWindow(0.5399,0.6794,0.4063,0.456,"Drug Delivery System ",true)
GUIEditor_Button[1] = guiCreateButton(317,345,68,40,"Accept",false,GUIEditor_Window[1])
GUIEditor_Button[2] = guiCreateButton(245,346,68,39,"Cancel",false,GUIEditor_Window[1])
GUIEditor_Memo[1] = guiCreateMemo(18,33,438,102,"Deliver the Car to the blip on the radar in LV .\nIf there is any bugs report it to the owners.",false,GUIEditor_Window[1])
guiMemoSetReadOnly(GUIEditor_Memo[1],true)


function ToggleDDMenu ( hit )
  if ( hit and hit == localPlayer ) then 
  		if eventName == 'onClientMarkerHit' then
	  				guiSetVisible ( GUIEditor_Window[1],true )
	  				showCursor ( true )
	elseif eventName == 'onClientMarkerLeave' then 
					guiSetVisible ( GUIEditor_Window[1],false )
	  				showCursor ( false )
	  		end
  		end
  	end
addEventHandler("onClientMarkerHit",marker,ToggleDDMenu)
addEventHandler("onClientMarkerLeave",marker,ToggleDDMenu)

 

PS. Use the wiki to know the events in client and server side and functions also.

Link to comment
Just now, ProMax said:

i tried it still can't see the marker ,what about making it in the server side but how come to add the GUI into the Server side?

 

It's not a solution to make it server side client is easier does the debugscript 3 output anything? are you sure about the position? 

Link to comment
canwarp = 1
local antiwarping = {
	{x = 200, y = 200, z = 20, width = 100, depth = 100, height = 15}, -- antiwarp
}
function antiwarping
	if antiwarping and #antiwarping ~= 0 then
		for _,v in ipairs (greenzones) do
			if v then
				if v.x and v.y and v.z and v.width and v.depth and v.height then
					local c = createColCuboid (v.x, v.y, v.z, v.width, v.depth, v.height)
					local rarea = createRadarArea (v.x, v.y, v.width, v.depth, 0, 0, 255, 255)
					setElementParent (rarea, c)
					end
				end

function warp(thePlayer, ...)
  for i,colshape in ipairs(colshapes) do
    check = isElementWithinColShape(thePlayer, colshape)
    if check then
      canwarp = 0
      break
     end
  end
  if canwarp == 1 then
    warpwarpwarpwarpfunction...
  else
    outputChatBox("can't warp here")
 end
 canwarp = 1
end
  

i wanted to disable warping in colshape or even warping someone inside this colshape

and anther thing out of this how can i create a vehicle on the first script and warp the ped in to this vehicle and draw a blip on warping and after hitting the anther marker destroy the blip and the marker.

Link to comment
canwarp = 1
local antiwarping = {
	createColCuboid (200, 200, 20, 100, 100, 15) --The colshape
	}

function warp(commandName, posX, posY, posZ)
	for i,colnumber in ipairs(antiwarping) do
		check = isElementWithinColShape(thePlayer, colnumber[i])
		if check then
			canwarp = 0
			break
		end
	end
	if canwarp == 1 then
		setElementPosition(localPlayer, posX, posY, posZ)
  else
    outputChatBox("can't warp here")
 end
 canwarp = 1
end
addCommandHandler("setpos", warp)
  

Try this, i didn't test it  so it may not work, it's completely basic without any vehicle, etc checks.

The command should be /setpos x y z

Edited by quindo
Link to comment

it doesn't work but it's okay i need help with the other script i tried to set the cancel Button to set the GUI vis but it doesn't work ,anyone check it please and i need help with the anther part if he pressed "accept" he get warped into a vehicle and create a blip (1022.49725, 2372.31763, 10.82031) also marker over here and when he reaches the anther marker he gets 10000$ and destroy his vehicle and please make the vehicle pony,and if he tried to leave the vehicle before reaching the anther marker then the vehicle get destroied and i will work on it ,after 10 i will tell you what have  i  done and here is the script

local marker = createMarker ( 1615.48865,-1506.98303,12.20866,"cylinder",2,255,0,0,255 ) 
GUIEditor_Window = {}
GUIEditor_Button = {}
GUIEditor_Memo = {}

GUIEditor_Window[1] = guiCreateWindow(0.5399,0.6794,0.4063,0.456,"Drug Delivery System ",true)
-- Add this under create window function :
guiSetVisible ( GUIEditor_Window[1],false )
GUIEditor_Button[1] = guiCreateButton(317,345,68,40,"Accept",false,GUIEditor_Window[1])
GUIEditor_Button[2] = guiCreateButton(245,346,68,39,"Cancel",false,GUIEditor_Window[1])
GUIEditor_Memo[1] = guiCreateMemo(18,33,438,102,"Deliver the Car to the blip on the radar in LV .\nIf there is any bugs report it to the owners.",false,GUIEditor_Window[1])
guiMemoSetReadOnly(GUIEditor_Memo[1],true)


function ToggleDDMenu ( hit )
  if ( hit and hit == localPlayer ) then 
        if eventName == 'onClientMarkerHit' then
                    guiSetVisible ( GUIEditor_Window[1],true )
                    showCursor ( true )
    elseif eventName == 'onClientMarkerLeave' then 
                    guiSetVisible ( GUIEditor_Window[1],false )
                    showCursor ( false )
	elseif source == GUIEditor_Button[2] then
					guiSetVisible( GUIEditor_Window[1], false)
					showCursor(false)
            end
        end
    end
addEventHandler("onClientMarkerHit",marker,ToggleDDMenu)
addEventHandler("onClientMarkerLeave",marker,ToggleDDMenu)

 

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...