Jump to content

markers


CapY

Recommended Posts

addEventHandler("onClientResourceStart",resourceRoot, 
    function() 
        Window = {} 
        Button1 = {} 
  
        Window[1] = guiCreateWindow(0.7602,0.2939,0.2219,0.2373,"",true) 
        Button1[1] = guiCreateButton(0.088,0.6379,0.5106,0.2263,"LS",true,Window[1]) 
        showCursor(true) 
        addEventHandler("onClientGUIClick", Button1[1],MarkerHit, false ) 
    end 
) 
  
  
  
function MarkerHit() -- define MarkerHit function for the handler 
    setElementPosition ( getLocalPlayer(), 1688.6726074219, 1428.3284912109, 30.770175933838 ) 
    guiSetVisible ( Window [ 1 ] , false ) 
    showCursor ( false ) 
end 

Link to comment
  • Replies 73
  • Created
  • Last Reply

Top Posters In This Topic

Can i know how you did it , i must use it on few more GUI's .

By the way , when i ( this is an example ) click Accept! on the rules window , can that teleport GUI show up after clicking Accept! button ?

If yes , give me the function (from wiki).

Link to comment

guiSetVisible and stop being lasy, INTRODUCTION TO SCRIPTING. INTRODUCTION TO SCRIPTING GUI. We aren't your servants to assist you every small little thing. Try working out things yourself? I tried doing something, I asked for help and ended up fixing part of it myself, can't you try harder?

thanks for teh server tip.

Link to comment

Well after GUI clicking the camera is not returned to a player.

Client:

addEventHandler("onClientResourceStart",resourceRoot, 
    function() 
  
        GUIEditor_Button = {} 
        GUIEditor_Window = {} 
        GUIEditor_Memo = {} 
  
        GUIEditor_Window[ 1 ] = guiCreateWindow(0.2805,0.2139,0.4172,0.5713,"Rules ",true) 
        guiSetAlpha(GUIEditor_Window[1],0.80000001192093) 
        GUIEditor_Memo[1] = guiCreateMemo(16,38,501,490,"                                 Here is a list of our rules, respect them.\n\n\n1. Do NOT use any kinds of hacks and cheats. \n\n2. Do NOT argue with staff, our is last word.\n\n3. Respect other players , especially members.\n\n4. Dont fight with others.\n\n5. Dont use any outgame modified handlings ( use  handling editor for that, more info on F9 ) \n\n6. Never ask for membership, we will ask you .\n\n7. Dont bother staff .\n\n8. Have a bit of experience .\n\n9. If something is not understand to you , just read help on F9 .\n\n10. Dont spam vehicles , dont RAM others.\n\n\nAbove all , have fun !\n\n\n\n\nNote: Every rule break can result as kick / ban or permaban.",false,GUIEditor_Window[1]) 
        GUIEditor_Button[1] = guiCreateButton(211,547,128,29,"Accept !",false,GUIEditor_Window[1]) 
        showCursor(true) 
        guiSetVisible(GUIEditor_Window[1],true) 
        addEventHandler("onClientGUIClick",GUIEditor_Button[1], function() 
        guiSetVisible(GUIEditor_Window[1],false) 
        guiSetVisible(Window[ 1 ],true) 
        end,false) 
    end 
) 
  
addEventHandler("onClientResourceStart",resourceRoot, 
    function() 
        Window = {} 
        Button1 = {} 
  
        Window[1] = guiCreateWindow(0.7602,0.2939,0.2219,0.2373,"Teleport",true) 
        Button1[1] = guiCreateButton(0.088,0.6379,0.5106,0.2263,"LS",true,Window[1]) 
        guiSetVisible(Window[1],false) 
        showCursor(true) 
        addEventHandler("onClientGUIClick", Button1[1],MarkerHit, false ) 
        triggerServerEvent("setCamera",getRootElement(),setCameraOnPlayerJoin) 
        setCameraTarget(thePlayer) 
    end 
) 
addEvent("clientFalseCam",true) 
addEventHandler("clientFalseCam",resourceRoot,function() 
end) 
  
function MarkerHit() -- define MarkerHit function for the handler 
    setElementPosition ( getLocalPlayer(), 1688.6726074219, 1428.3284912109, 30.770175933838 ) 
    guiSetVisible ( Window [ 1 ] , false ) 
    showCursor ( false ) 
end 

Server:

function setCameraOnPlayerJoin(thePlayer) 
     -- slowly fade the camera in to make the screen visible 
     fadeCamera(source, true, 5) 
     -- set the player's camera to a fixed position, looking at a fixed point 
     setCameraMatrix(source, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316) 
     triggerClientEvent("clientFalseCam",resourceRoot,function() 
    end) 
end 
addEventHandler("onPlayerJoin",getRootElement(),setCameraOnPlayerJoin) 
addEvent("setCamera",true) 
addEventHandler("setCamera",resourceRoot,setCameraOnPlayerJoin) 

and something is wrong with triggerClient and triggerServerEvent.

Link to comment

so you're triggering a server event only to fade the camera and then to set the camera matrix then you're setting the camera target (obviously with thePlayer which is probably not defined) and you're also triggering back to the client an event attached to an empty function?

Alright, this is really a mess. I'd like to help, but I don't know where to start

You should scrap the serverside and do everything clientside. It's just bandwidth waste to trigger serverside events only to set the camera matrix :/

Link to comment

Okay i moved it to client side only , but now setCameraMatrix doesnt work.

Script:

addEventHandler("onClientResourceStart",resourceRoot, 
    function() 
  
        GUIEditor_Button = {} 
        GUIEditor_Window = {} 
        GUIEditor_Memo = {} 
  
        GUIEditor_Window[ 1 ] = guiCreateWindow(0.2805,0.2139,0.4172,0.5713,"Rules ",true) 
        guiSetAlpha(GUIEditor_Window[1],0.80000001192093) 
        GUIEditor_Memo[1] = guiCreateMemo(16,38,501,490,"                                 Here is a list of our rules, respect them.\n\n\n1. Do NOT use any kinds of hacks and cheats. \n\n2. Do NOT argue with staff, our is last word.\n\n3. Respect other players , especially members.\n\n4. Dont fight with others.\n\n5. Dont use any outgame modified handlings ( use  handling editor for that, more info on F9 ) \n\n6. Never ask for membership, we will ask you .\n\n7. Dont bother staff .\n\n8. Have a bit of experience .\n\n9. If something is not understand to you , just read help on F9 .\n\n10. Dont spam vehicles , dont RAM others.\n\n\nAbove all , have fun !\n\n\n\n\nNote: Every rule break can result as kick / ban or permaban.",false,GUIEditor_Window[1]) 
        GUIEditor_Button[1] = guiCreateButton(211,547,128,29,"Accept !",false,GUIEditor_Window[1]) 
        showCursor(true) 
        guiSetVisible(GUIEditor_Window[1],true) 
        addEventHandler("onClientGUIClick",GUIEditor_Button[1], function() 
        guiSetVisible(GUIEditor_Window[1],false) 
        guiSetVisible(Window[ 1 ],true) 
        end,false) 
    end 
) 
  
addEventHandler("onClientResourceStart",resourceRoot, 
    function() 
        Window = {} 
        Button1 = {} 
  
        Window[1] = guiCreateWindow(0.7602,0.2939,0.2219,0.2373,"Teleport",true) 
        Button1[1] = guiCreateButton(0.088,0.6379,0.5106,0.2263,"LS",true,Window[1]) 
        guiSetVisible(Window[1],false) 
        showCursor(true) 
        addEventHandler("onClientGUIClick", Button1[1],MarkerHit, false )  
    end 
) 
addEvent("clientFalseCam",true) 
addEventHandler("clientFalseCam",resourceRoot,function() 
end) 
  
function MarkerHit() -- define MarkerHit function for the handler 
    setElementPosition ( getLocalPlayer(), 1688.6726074219, 1428.3284912109, 30.770175933838 ) 
    guiSetVisible ( Window [ 1 ] , false ) 
    showCursor ( false ) 
end 
  
function setCameraOnPlayerJoin() 
     -- set the player's camera to a fixed position, looking at a fixed point 
     setCameraMatrix( 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316) 
     addEventHandler("onClientGUIClick", Button1[1],camTarget, false ) 
end 
addEventHandler("onClientResourceStart",getRootElement(),setCameraOnPlayerJoin) 
  
function camTarget() 
    setCameraTarget(localPlayer,false) 
end 
addEventHandler("onClientResourceStart",getRootElement(),camTarget) 
  

Link to comment

Thanks Qais , but i dont want that.

EDIT: When somebody type /reconnect and get back into the game then setCameraMatrix doesnt work and then i must to restart the resource, how to make setCameraMatrix work everytime ?

EDIT2:This part needs to be fixed, because it doesnt work when someone joins more times , it just work when someone joins first time .

function setCameraOnPlayerJoin() 
     -- set the player's camera to a fixed position, looking at a fixed point 
     setCameraMatrix( 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316) 
     addEventHandler("onClientGUIClick", Button1[1],camTarget, false ) 
end 
addEventHandler("onClientResourceStart",getRootElement(),setCameraOnPlayerJoin) 

Whole script:

addEventHandler("onClientResourceStart",resourceRoot, 
    function() 
  
        GUIEditor_Button = {} 
        GUIEditor_Window = {} 
        GUIEditor_Memo = {} 
  
        GUIEditor_Window[ 1 ] = guiCreateWindow(0.2805,0.2139,0.4172,0.5713,"Rules ",true) 
        guiSetAlpha(GUIEditor_Window[1],0.80000001192093) 
        GUIEditor_Memo[1] = guiCreateMemo(16,38,501,490,"                                 Here is a list of our rules, respect them.\n\n\n1. Do NOT use any kinds of hacks and cheats. \n\n2. Do NOT argue with staff, our is last word.\n\n3. Respect other players , especially members.\n\n4. Dont fight with others.\n\n5. Dont use any outgame modified handlings ( use  handling editor for that, more info on F9 ) \n\n6. Never ask for membership, we will ask you .\n\n7. Dont bother staff .\n\n8. Have a bit of experience .\n\n9. If something is not understand to you , just read help on F9 .\n\n10. Dont spam vehicles , dont RAM others.\n\n\nAbove all , have fun !\n\n\n\n\nNote: Every rule break can result as kick / ban or permaban.",false,GUIEditor_Window[1]) 
        GUIEditor_Button[1] = guiCreateButton(211,547,128,29,"Accept !",false,GUIEditor_Window[1]) 
        showCursor(true) 
        guiSetVisible(GUIEditor_Window[1],true) 
        addEventHandler("onClientGUIClick",GUIEditor_Button[1], function() 
        guiSetVisible(GUIEditor_Window[1],false) 
        guiSetVisible(Window[ 1 ],true) 
        end,false) 
    end 
) 
  
addEventHandler("onClientResourceStart",resourceRoot, 
    function() 
        Window = {} 
        Button1 = {} 
  
        Window[1] = guiCreateWindow(0.7602,0.2939,0.2219,0.2373,"Teleport",true) 
        Button1[1] = guiCreateButton(0.088,0.6379,0.5106,0.2263,"LS",true,Window[1]) 
        guiSetVisible(Window[1],false) 
        showCursor(true) 
        addEventHandler("onClientGUIClick", Button1[1],MarkerHit, false )  
    end 
) 
  
function MarkerHit() -- define MarkerHit function for the handler 
    setElementPosition ( getLocalPlayer(), 1688.6726074219, 1428.3284912109, 30.770175933838 ) 
    guiSetVisible ( Window [ 1 ] , false ) 
    showCursor ( false ) 
end 
  
function setCameraOnPlayerJoin() 
     -- set the player's camera to a fixed position, looking at a fixed point 
     setCameraMatrix( 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316) 
     addEventHandler("onClientGUIClick", Button1[1],camTarget, false ) 
end 
addEventHandler("onClientResourceStart",getRootElement(),setCameraOnPlayerJoin) 
  
function camTarget() 
    setCameraTarget(localPlayer) 
end 
  

Link to comment
  • 3 weeks later...

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