Jump to content

what the hell I did wrong..


swag_k_dog

Recommended Posts

Posted

server:

local missionMarker = createMarker(2153, -1799, 12.5, "cylinder", 1, 255, 0, 0)



function triggerTheEvent()
 triggerClientEvent("onTheDamnWindow", resourceRoot)
end

addEventHandler("onMarkerHit", missionMarker, triggerTheEvent)

client:


addEvent("onTheDamnWindow", true)
addEventHandler("onTheDamnWindow", resourceRoot, 
function ()
        missionName = guiCreateLabel(0.64, 0.85, 0.38, 0.13, "sweet buisness", true)
        local font0_gtasanandreas = guiCreateFont(":freeroam_login/images/gtasanandreas.ttf", 50)
        guiSetFont(missionName, font0_gtasanandreas)
        guiLabelSetColor(missionName, 252, 226, 81)    
	end
	
)

when you hit the marker, the Label should be created. but it doesnt work

grrrrrrr, why??

Posted
local missionMarker = createMarker(2153, -1799, 12.5, "cylinder", 1, 255, 0, 0)







function triggerTheEvent(hit)
	if source == missionMarker and getElementType(hit) == "player" then
		triggerClientEvent("onTheDamnWindow", hit)
	end	
end
addEventHandler("onMarkerHit", resourceRoot, triggerTheEvent)

 

Welcom to my server Q.5

Current game type in my server Drift

350x20_FFFFFF_FFFFFF_000000_000000.png

my Email : [email protected]

Programming level: 90%

Posted
4 minutes ago, MR.S3D said:

local missionMarker = createMarker(2153, -1799, 12.5, "cylinder", 1, 255, 0, 0)







function triggerTheEvent(hit)
	if source == missionMarker and getElementType(hit) == "player" then
		triggerClientEvent("onTheDamnWindow", hit)
	end	
end
addEventHandler("onMarkerHit", resourceRoot, triggerTheEvent)

 

sorry mate did not work :[

Posted

Try that

local missionMarker = createMarker(2153, -1799, 12.5, "cylinder", 1, 255, 0, 0)

function triggerTheEvent(hit)
	if source == missionMarker and getElementType(hit) == "player" then
		triggerClientEvent(hit,"onTheDamnWindow", hit)
	end	
end
addEventHandler("onMarkerHit", root, triggerTheEvent)

 

 

 

Posted

Client

addEvent("onTheDamnWindow", true)
addEventHandler("onTheDamnWindow", root, 
function ()
		if isElement(missionName) then destroyElement(missionName) end
        missionName = guiCreateLabel(0.64, 0.85, 0.38, 0.13, "sweet buisness", true)
        local font0_gtasanandreas = guiCreateFont(":freeroam_login/images/gtasanandreas.ttf", 50)
		guiSetFont(missionName, font0_gtasanandreas or "default-bold-small")
        guiLabelSetColor(missionName, 252, 226, 81)    
	end
)

 

  • Like 1

Welcom to my server Q.5

Current game type in my server Drift

350x20_FFFFFF_FFFFFF_000000_000000.png

my Email : [email protected]

Programming level: 90%

Posted

Client-Side

addEvent("onTheDamnWindow", true)
addEventHandler("onTheDamnWindow", root, 
	function ()
        missionName = guiCreateLabel(0.64, 0.85, 0.38, 0.13, "sweet buisness", true)
        local font0_gtasanandreas = guiCreateFont(":freeroam_login/images/gtasanandreas.ttf", 50)
		guiSetFont(missionName, font0_gtasanandreas or "default-bold-small")
        guiLabelSetColor(missionName, 252, 226, 81)  
		guiSetVisible(missionName, true)
	end
)

 

 

 

Posted
4 minutes ago, N3xT said:

Client-Side


addEvent("onTheDamnWindow", true)
addEventHandler("onTheDamnWindow", root, 
	function ()
        missionName = guiCreateLabel(0.64, 0.85, 0.38, 0.13, "sweet buisness", true)
        local font0_gtasanandreas = guiCreateFont(":freeroam_login/images/gtasanandreas.ttf", 50)
		guiSetFont(missionName, font0_gtasanandreas or "default-bold-small")
        guiLabelSetColor(missionName, 252, 226, 81)  
		guiSetVisible(missionName, true)
	end
)

 

still no..

I tried in 123234 ways. :(

Posted (edited)

You can track, where the error is just by adding something like outputChatBox("asd") in function.

Example, add it on marker function and then hit the marker and if it outputs "asd" in chatbox, move the message to clientside function.

if it outputs message in clientside function, then there's something wrong with your label.

Edited by Miika822

Real motorbike backflip / frontflip script: https://forum.mtasa.com/viewtopic.php?f=108&t=98191

Posted (edited)

ex:

 

Server

 

local marker = createMarker(2153, -1799, 12.5, "cylinder", 1, 255, 0, 0)

addEventHandler("onMarkerHit", root, 
	function(hit)
		if source == marker and getElementType(hit) == "player" then
			triggerClientEvent(hit,"testS3D", hit)
		end	
	end	
)

 

Client

 


addEvent("testS3D", true)
addEventHandler("testS3D", root, 
function ()
	  Window = guiCreateWindow ( 0, 0, 0.5, 0.4, "Test", true )   
	end
)

 

Edited by MR.S3D

Welcom to my server Q.5

Current game type in my server Drift

350x20_FFFFFF_FFFFFF_000000_000000.png

my Email : [email protected]

Programming level: 90%

Posted

I'm pretty sure that's you can't see the marker or something wrong because you didn't set the alpha in the marker for the color.

You are missing that part in here : 

 

createMarker( float x, float y, float z [, string theType = "checkpoint", float size = 4.0, int r = 0, int g = 0, int b = 255, int a = 255, visibleTo = getRootElement( ) ] )

 

Maybe it's not causing the problem but you can try the following :

 

In the server side :

-- Server 

local missionMarker = createMarker ( 2153,-1799,12.5,'cylinder',1,255,255,0,255 );

addEventHandler ( 'onMarkerHit',missionMarker,
	function ( aPlayer )
		if aPlayer and getElementType ( aPlayer ) == 'player' then
			 triggerClientEvent ( aPlayer,'aRequestVisible',aPlayer );
		end
	end
);

 

 

Client :

 

missionName = guiCreateLabel ( 0.64,0.85,0.38,0.13,'sweet buisness',true );
guiSetFont ( missionName,guiCreateFont ( ':freeroam_login/images/gtasanandreas.ttf',50 ) );
guiLabelSetColor ( missionName,252,226,81 );
guiSetVisible ( missionName,false );
outputChatBox ( 'Data in the client has been created' );   

addEvent( 'aRequestVisible',true );
addEventHandler ( 'aRequestVisible',root,
function (			)
	if guiGetVisible ( missionName ) then return outputChatBox ( 'The missionName is already visible !' ) end;
		guiSetVisible ( missionName,true );
 		outputChatBox ( 'Data in the client has been request and triggred!' );   
	end
)

 

 

@swag_k_dog

  

Posted
Just now, iPrestege said:

I'm pretty sure that's you can't see the marker or something wrong because you didn't set the alpha in the marker for the color.

You are missing that part in here : 

 


createMarker( float x, float y, float z [, string theType = "checkpoint", float size = 4.0, int r = 0, int g = 0, int b = 255, int a = 255, visibleTo = getRootElement( ) ] )

 

Maybe it's not causing the problem but you can try the following :

 

In the server side :


-- Server 

local missionMarker = createMarker ( 2153,-1799,12.5,'cylinder',1,255,255,0,255 );

addEventHandler ( 'onMarkerHit',missionMarker,
	function ( aPlayer )
		if aPlayer and getElementType ( aPlayer ) == 'player' then
			 triggerClientEvent ( aPlayer,'aRequestVisible',aPlayer );
		end
	end
);

 

 

Client :

 


missionName = guiCreateLabel ( 0.64,0.85,0.38,0.13,'sweet buisness',true );
guiSetFont ( missionName,guiCreateFont ( ':freeroam_login/images/gtasanandreas.ttf',50 ) );
guiLabelSetColor ( missionName,252,226,81 );
guiSetVisible ( missionName,false );
outputChatBox ( 'Data in the client has been created' );   

addEvent( 'aRequestVisible',true );
addEventHandler ( 'aRequestVisible',root,
function (			)
	if guiGetVisible ( missionName ) then return outputChatBox ( 'The missionName is already visible !' ) end;
		guiSetVisible ( missionName,true );
 		outputChatBox ( 'Data in the client has been request and triggred!' );   
	end
)

 

 

@swag_k_dog

when I enter the marker nothing happens

Posted
Just now, iPrestege said:

Is there any messages appear in the chat box? Please post your meta.xml file.

yes there is a message:

Data in the client has been created.

meta:

<meta> 

  <info author="square" name="mission" version="1.0" type="script"/> 
  
  <script src="c_spawns.lua" type="client"/> 
  <script src="s_spawns.lua" type="server"/> 
  
 </meta> 

 

Posted

Try to change the marker position some times it's about that or make the size bigger there's no message for the event in the chat box that it has been triggered?

  • Like 1

  

Posted
1 minute ago, iPrestege said:

Try to change the marker position some times it's about that or make the size bigger there's no message for the event in the chat box that it has been triggered?

no sir

 

Posted
local missionMarker = createMarker(2153, -1799, 12.5, "cylinder", 1.1, 255, 0, 0, 100)



function triggerTheEvent(hitElemet)
  if hitElement and getElementType(hitElement) == "Player" then
	 triggerClientEvent(hitElement, "onTheDamnWindow", hitElement)
  end
end

addEventHandler("onMarkerHit", root, triggerTheEvent)
addEvent("onTheDamnWindow", true)
addEventHandler("onTheDamnWindow", resourceRoot, 
function ()
        missionName = guiCreateLabel(0.64, 0.85, 0.38, 0.13, "sweet buisness", true)
        local font0_gtasanandreas = guiCreateFont(":freeroam_login/images/gtasanandreas.ttf", 50)
        guiSetFont(missionName, font0_gtasanandreas)
        guiLabelSetColor(missionName, 252, 226, 81)    
	end
	
)

 

Real motorbike backflip / frontflip script: https://forum.mtasa.com/viewtopic.php?f=108&t=98191

Posted
3 hours ago, iPrestege said:

Try to change the marker position some times it's about that or make the size bigger there's no message for the event in the chat box that it has been triggered?

no sir

 

okay motherf*ckers :)

I finnaly did it: 

local missionMarker = createMarker(2153, -1799, 12.5, "cylinder", 1.1, 255, 0, 0, 100)
local player = getLocalPlayer()

function missionGui()
        missionName = guiCreateLabel(0.64, 0.85, 0.38, 0.13, "sweet buisness", true)
        local font0_gtasanandreas = guiCreateFont(":freeroam_login/images/gtasanandreas.ttf", 50)
        guiSetFont(missionName, font0_gtasanandreas)
        guiLabelSetColor(missionName, 252, 226, 81)    
	end
	
addEventHandler("onClientResourceStart", getRootElement(), missionGui)
addEventHandler("onClientResourceStart", getRootElement(), function() guiSetVisible(missionName, false) end)

function markerhit (player, missionMarker)
	guiSetVisible(missionName, true)
end
addEventHandler("onClientMarkerHit", missionMarker, markerhit)

thanks for your help anyways :D

@Miika822 @iPrestege @MR.S3D

 

  • Like 1

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