Castillo Posted September 9, 2011 Share Posted September 9, 2011 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
CapY Posted September 9, 2011 Author Share Posted September 9, 2011 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
JR10 Posted September 9, 2011 Share Posted September 9, 2011 use guiSetVisible onClientResourceStart? As for the GUI click, 4th argument in addEventHandler, specify it false. Link to comment
CapY Posted September 9, 2011 Author Share Posted September 9, 2011 Yes but i got 2 Windows started onClientResource start , i want it one after another. Does that function exists in the client side ? Like check is previous window closed if is then start teleport GUI . Link to comment
JR10 Posted September 9, 2011 Share Posted September 9, 2011 When you hide the first one, show the second one. That's easy. Link to comment
CapY Posted September 10, 2011 Author Share Posted September 10, 2011 Any wiki function ? Link to comment
qaisjp Posted September 10, 2011 Share Posted September 10, 2011 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
CapY Posted September 10, 2011 Author Share Posted September 10, 2011 I already fixed some errors , but i really didnt know the function . No problem. Link to comment
JR10 Posted September 10, 2011 Share Posted September 10, 2011 You didn't know it? And you had it in your script? Link to comment
qaisjp Posted September 10, 2011 Share Posted September 10, 2011 You didn't know it?And you had it in your script? Then I assume he just copied and pasted... Link to comment
CapY Posted September 10, 2011 Author Share Posted September 10, 2011 Lol i checked the whole code , but i was think there is other function than guiSetVisible. Edit: I fixed the code, thanks for help you two. EDIT2:One question , when someone reads rules GUI ,how to set camera automatically moves trought some city? Link to comment
CapY Posted September 10, 2011 Author Share Posted September 10, 2011 Okay, and how i can attach camera to the player again, after gui click . Link to comment
JR10 Posted September 10, 2011 Share Posted September 10, 2011 setCameraTarget Dude, use the wiki. Link to comment
CapY Posted September 10, 2011 Author Share Posted September 10, 2011 Yes i founded the function before your post, i'm using the wiki . Link to comment
CapY Posted September 10, 2011 Author Share Posted September 10, 2011 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
JR10 Posted September 10, 2011 Share Posted September 10, 2011 setCameraTarget(localPlayer) thePlayer is not defined. Link to comment
BinSlayer1 Posted September 10, 2011 Share Posted September 10, 2011 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
CapY Posted September 10, 2011 Author Share Posted September 10, 2011 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
BinSlayer1 Posted September 10, 2011 Share Posted September 10, 2011 probably because setCameraMatrix and setCameraTarget are called at the same time? (same event) setCameraTarget overrides setCameraMatrix you don't need this line "addEventHandler("onClientResourceStart",getRootElement(),camTarget)" do you? ps: setCameraTarget has 1 argument, not 2 Link to comment
qaisjp Posted September 10, 2011 Share Posted September 10, 2011 For touring through the city, search the community for toursa made by me. Then use exports.toursa:startSATour() to start touring Link to comment
CapY Posted September 10, 2011 Author Share Posted September 10, 2011 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
shenglu Posted September 28, 2011 Share Posted September 28, 2011 Script GUI presentation. We are not your servant to help you every tiny little thing. Try things out yourself? Link to comment
CapY Posted September 28, 2011 Author Share Posted September 28, 2011 This topic is old , don't tell me what to do, kid. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now