Jump to content

Help pls (markers)


RandomRambo

Recommended Posts

Google translator
Hi, I'm Brazilian. Maybe this will help you.

Marker = createMarker(0, 0, 0 -1, "cylinder", 1.2, 0, 255, 0, 90) 

function Entrar (hitPlayer)	
  	addEventHandler("onClientRender", root, Imagem)
	setTimer(setElementPosition, 1500, 1, hitPlayer, 2575.6145,-1289.7745,1044.1250)
	setTimer (RemoverImg, 1400, 1, hitPlayer) -- Remove a Imagem
end
addEventHandler ( "onClientMarkerHit", Marker, Entrar )

function Imagem ()
	dxDrawImage(0, 0, 0, 0, "Imagem.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
end

function RemoverImg ()
  	removeEventHandler("onClientRender", root, Imagem)
end

Please leave the thanks  :D

Link to comment

@Master_11 and @#DaNiLiN

Look,i have this server side script for markers (teleports) and this client side script for image which i need to open after player hit marker.
So how i can connect server side to client side on these scripts?

 

Server:

Quote

marker1 = createMarker(1819.341796875,-1390.5510253906,53.400001525879, "arrow", 1.5, 230, 251, 3, 153) 
marker2 = createMarker(2111.0856933594,708.96136474609,340.765625, "arrow", 1.5, 230, 251, 3, 153)  
 
function teleport(player) 
    if (source == marker1 and getElementType(player) == "player") then 
   
        setElementPosition(player, 2140.5766601563,266.89031982422,340.765625) 
        setElementFrozen(player, false) 
        setTimer(setElementFrozen, 1000, 1, player, false) 
    elseif (source == marker2 and getElementType(player) == "player") then 
        setElementPosition(player, 1836.9830322266,-1396.9620361328,53.400001525879) 
        setElementFrozen(player, false) 
        setTimer(setElementFrozen, 1000, 1, player, false)   
    end 
end 
addEventHandler("onMarkerHit", root, teleport) 
 

Client:

Quote

window_start = {}

addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ),  
    function ( VhodWindow )
        if source == getResourceRootElement( VhodWindow ) then
            windowscreate( "News", "logotip.png")
        end
    end
)

function windowoff()
    guiSetVisible( window_start.window, false )
    showCursor( false )
end

addEvent( "windowinfo", true )
function windowscreate( wind, logotip)
    if not window_start.window then
        window_start.window = guiCreateWindow( 0.1, 0.20, 0.8, 0.7, wind, true )
        guiWindowSetSizable( window_start.window, false )
        guiWindowSetMovable( window_start.window, false )

        window_start.logotip = guiCreateStaticImage( 0.01, 0.035, 0.98, 0.87, logotip, true, window_start.window )

        window_start.buttonoff = guiCreateButton( 0, 0.91, 1, 1, "Close", true, window_start.window )
        showCursor( true )
        addEventHandler( "onClientGUIClick", window_start.buttonoff, windowoff )    

    end
end
addEventHandler( "windowinfo", getRootElement(), windowscreate )
 

 

Link to comment

Hello, @RandomRambo

Server:

marker1 = createMarker(1800.4868164063, -2141.1555175781, 14.146875, "arrow", 1.5,  0, 250,  0, 153) 
marker2 = createMarker(1801.6746826172, -2137.8212890625, 14.146875, "arrow", 1.5, 250, 0, 0, 153)  
 
function teleport(client)
    if (source == marker1 and getElementType(client) == "player") then
		setElementPosition(client, 1793.2797851563, -2151.337890625, 13.681822776794)
		setElementFrozen(client, false)
		setTimer(setElementFrozen, 1000, 1, client, false)
		triggerClientEvent(client, "onPlayerTP", client)
	elseif (source == marker2 and getElementType(client) == "player") then
		setElementPosition(client, 1793.4161376953, -2124.8742675781, 13.546875)
		setElementFrozen(client, false)
		setTimer(setElementFrozen, 1000, 1, client, false)
		triggerClientEvent(client, "onPlayerTP", client)
    end
end
addEventHandler("onMarkerHit", resourceRoot, teleport)

Client:

local screenW, screenH = guiGetScreenSize()
	mainWindow = guiCreateWindow((screenW - 1546) / 2, (screenH - 834) / 2, 1546, 834, "News", false)
	guiWindowSetSizable(mainWindow, false)
	--GUI Objects--
	closeButton = guiCreateButton(9, 770, 1527, 54, "Close", false, mainWindow)
	newsLogo = guiCreateStaticImage(9, 32, 1527, 733, ":news/logotip.png", false, mainWindow)

function resStarts()
	guiSetVisible(mainWindow, false)
	showCursor(false)
end
addEventHandler("onClientResourceStart", resourceRoot, resStarts)
	
function openNewsPanel()
	guiSetVisible(mainWindow, true)
	showCursor(true)
end
addEvent("onPlayerTP", true)
addEventHandler("onPlayerTP", localPlayer, openNewsPanel)

function closeNewsPanel(button)
	if (button ~= "left") then
		return false
	end
	guiSetVisible(mainWindow, false)
	showCursor(false)
end
addEventHandler("onClientGUIClick", closeButton, closeNewsPanel, false)

Meta:

<meta>
	<script src="client.lua" type="client" />
	<script src="server.lua" type="server" />
	<file src="logotip.png" />
</meta>

Remember, check the full code and see what I have changed and think why I did that. Also, change the image location at client.lua: line 6 {":news/logotip.png"} in this case, my script folder name was "news".

I had to create a new client program as your one was pretty much buggy and unorganized.

If you still find any problem, let us know.

Edited by Master_11
  • Thanks 1
Link to comment
21 minutes ago, Master_11 said:

Hello, @RandomRambo

Server:


marker1 = createMarker(1800.4868164063, -2141.1555175781, 14.146875, "arrow", 1.5,  0, 250,  0, 153) 
marker2 = createMarker(1801.6746826172, -2137.8212890625, 14.146875, "arrow", 1.5, 250, 0, 0, 153)  
 
function teleport(client)
    if (source == marker1 and getElementType(client) == "player") then
		setElementPosition(client, 1793.2797851563, -2151.337890625, 13.681822776794)
		setElementFrozen(client, false)
		setTimer(setElementFrozen, 1000, 1, client, false)
		triggerClientEvent(client, "onPlayerTP", client)
	elseif (source == marker2 and getElementType(client) == "player") then
		setElementPosition(client, 1793.4161376953, -2124.8742675781, 13.546875)
		setElementFrozen(client, false)
		setTimer(setElementFrozen, 1000, 1, client, false)
		triggerClientEvent(client, "onPlayerTP", client)
    end
end
addEventHandler("onMarkerHit", resourceRoot, teleport)

Client:


local screenW, screenH = guiGetScreenSize()
	mainWindow = guiCreateWindow((screenW - 1546) / 2, (screenH - 834) / 2, 1546, 834, "News", false)
	guiWindowSetSizable(mainWindow, false)
	--GUI Objects--
	closeButton = guiCreateButton(9, 770, 1527, 54, "Close", false, mainWindow)
	newsLogo = guiCreateStaticImage(9, 32, 1527, 733, ":news/logotip.png", false, mainWindow)

function resStarts()
	guiSetVisible(mainWindow, false)
	showCursor(false)
end
addEventHandler("onClientResourceStart", resourceRoot, resStarts)
	
function openNewsPanel()
	guiSetVisible(mainWindow, true)
	showCursor(true)
end
addEvent("onPlayerTP", true)
addEventHandler("onPlayerTP", localPlayer, openNewsPanel)

function closeNewsPanel(button)
	if (button ~= "left") then
		return false
	end
	guiSetVisible(mainWindow, false)
	showCursor(false)
end
addEventHandler("onClientGUIClick", closeButton, closeNewsPanel, false)

Meta:


<meta>
	<script src="client.lua" type="client" />
	<script src="server.lua" type="server" />
	<file src="logotip.png" />
</meta>

Remember, check the full code and see what I have changed and think why I did that. Also, change the image location at client.lua: line 6 {":news/logotip.png"} in this case, my script folder name was "news".

I had to create a new client program as your one was pretty much buggy and unorganized.

If you still find any problem, let us know.


Thanks man,i will check it now )

UPD:

I used your code ,but:

9cd771e9b250.png

 

Edited by RandomRambo
Link to comment
2 minutes ago, RandomRambo said:

Now image is showing when i hit marker but i teleport not to place where coordinates,i teleport under ground in water and im drowning

Just change the x, y, z in the code. if you have already changed, show me the edited code.

Edited by Master_11
Link to comment
3 minutes ago, Master_11 said:

Just change the x, y, z in the code. if you have already changed, show me the edited code.

ofc i changed it:
marker1 = createMarker(648.93481445313,-2883.2438964844,52.553970336914, "arrow", 1.5, 230, 251, 3, 153) 
marker2 = createMarker(636.20654296875,-2847.8757324219,1637.8680419922, "arrow", 1.5, 230, 251, 3, 153)  

Link to comment

marker1 = createMarker(648.93481445313, -2883.2438964844, 52.553970336914, "arrow", 1.5, 230, 251, 3, 153) 
marker2 = createMarker(636.20654296875, -2847.8757324219, 1637.8680419922, "arrow", 1.5, 230, 251, 3, 153)  

Use the space after coma ", "

Also, try changing the coords. And provide SetElementPosition line too

Link to comment
1 minute ago, Master_11 said:

marker1 = createMarker(648.93481445313, -2883.2438964844, 52.553970336914, "arrow", 1.5, 230, 251, 3, 153) 
marker2 = createMarker(636.20654296875, -2847.8757324219, 1637.8680419922, "arrow", 1.5, 230, 251, 3, 153)  

Use the space after coma ", "

Also, try changing the coords. And provide SetElementPosition line too

Okay,i will try,but i think it doesnt matter,smth wrong with script ?

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