..:D&G:.. Posted March 8, 2013 Posted March 8, 2013 (edited) Hello, I am trying to make a trian driver job, I have made the window, but I will need some help, I don't want no body to do it I just need some help. Window: GUIEditor = { memo = {}, button = {}, window = {}, radiobutton = {}, tab = {}, label = {}, tabpanel = {}, } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(684, 215, 491, 334, "CFR - Sofer De Tren", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetAlpha(GUIEditor.window[1], 0.75) GUIEditor.button[1] = guiCreateButton(52, 169, 136, 65, "Angajeaza-te", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[1], "default-bold-small") GUIEditor.button[2] = guiCreateButton(299, 169, 136, 65, "Demisioneaza", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[2], "default-bold-small") GUIEditor.button[3] = guiCreateButton(299, 259, 136, 65, "Închide", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[3], "default-bold-small") GUIEditor.memo[1] = guiCreateMemo(206, 180, 76, 85, "", false, GUIEditor.window[1]) GUIEditor.label[1] = guiCreateLabel(252, 119, 70, 54, "", false, GUIEditor.window[1]) GUIEditor.memo[2] = guiCreateMemo(46, 35, 393, 124, " Bun venit la gara CFR!\nCautamt conductori de locomotiva, tot ce trebuie sa faci este sa conduci trenul si sa iei pasageri. Ia o colomotiva, o poti gasii pe sine, si incepeti slujba.\n\n Mult Succes!", false, GUIEditor.window[1]) guiMemoSetReadOnly(GUIEditor.memo[2], true) GUIEditor.tabpanel[1] = guiCreateTabPanel(178, 196, 60, 57, false, GUIEditor.memo[2]) GUIEditor.tab[1] = guiCreateTab("Tab", GUIEditor.tabpanel[1]) GUIEditor.radiobutton[1] = guiCreateRadioButton(191, 271, 75, 44, "", false, GUIEditor.window[1]) guiRadioButtonSetSelected(GUIEditor.radiobutton[1], true) end ) Now, first of all, I want to make it so when a player hits a marker the window pops up, I will try some functions from the wiki, but if you want to help me, thats fine. --------------------------EDITED!-------------------------- I have used this code for the server side. jobMarker = createMarker (1942.57, 2184.79, 9.82, "cylinder", 1, 255, 0, 0, 127) addEvent ("viewGUI", true) function markerHit (hitPlayer, matchingDimension) if (source == jobMarker) then triggerClientEvent ("viewGUI", hitPlayer) outputChatBox ("Bun venit la gara Romana CFR.", hitPlayer, 255, 0, 0) end end addEventHandler ("onMarkerHit", getRootElement(), markerHit) addEventHandler ("onClientResourceStart", getRootElement(), resourceStart) function menuShow () visableornot = guiGetVisible (theWindow) if (visableornot == true) then guiSetVisible (theWindow, false) showCursor (false) end if (visableornot == false) then guiSetVisible (theWindow, true) showCursor (true) end end I want to know if I need to add some more to it. Edited March 8, 2013 by Guest MTA:Rust Pre-Alpha Build v.0.3: https://forum.mtasa.com/viewtopic.php?f=114&t=97848 2Pac: ''Only God can judge me!''
PaiN^ Posted March 8, 2013 Posted March 8, 2013 Event ( client ) : onClientMarkerHit functions : client : guiSetVisible showCursor guiSetInputEnabled " Keep Thinking Different . " - Steve Jops -------------------- Don't send me PMs asking for help, I Won't reply !
..:D&G:.. Posted March 8, 2013 Author Posted March 8, 2013 Server: jobMarker = createMarker (-1973.02600, 117.74309, 27.68750, "cylinder", 1, 255, 0, 0, 127) addEvent ("viewGUI", true) function markerHit (hitPlayer, matchingDimension) if (source == jobMarker) then triggerClientEvent ("viewGUI", hitPlayer) outputChatBox ("Bun venit la gara Romana CFR.", hitPlayer, 255, 255, 0) end end addEventHandler ("onMarkerHit", getRootElement(), markerHit) Client: GUIEditor = { memo = {}, button = {}, window = {}, tab = {}, label = {}, tabpanel = {}, } function() theWindow = guiCreateWindow(684, 215, 491, 334, "CFR - Sofer De Tren", false) guiWindowSetSizable(theWindow, false) guiSetAlpha(theWindow, 0.75) GUIEditor.button[1] = guiCreateButton(52, 169, 136, 65, "Angajeaza-te", false, theWindow) guiSetFont(GUIEditor.button[1], "default-bold-small") GUIEditor.button[2] = guiCreateButton(299, 169, 136, 65, "Demisioneaza", false, theWindow) guiSetFont(GUIEditor.button[2], "default-bold-small") GUIEditor.button[3] = guiCreateButton(299, 259, 136, 65, "Închide", false, theWindow) guiSetFont(GUIEditor.button[3], "default-bold-small") GUIEditor.label[1] = guiCreateLabel(252, 119, 70, 54, "", false, theWindow) GUIEditor.memo[2] = guiCreateMemo(46, 35, 393, 124, " Bun venit la gara CFR!\nCautam conductori de locomotiva, tot ce trebuie sa faci este sa conduci trenul si sa iei pasageri. Ia o colomotiva, o poti gasii pe sine, si incepeti slujba.\n\n Mult Succes!", false, GUIEditor.window[1]) GUIEditor.tabpanel[1] = guiCreateTabPanel(178, 196, 60, 57, false, GUIEditor.memo[2]) GUIEditor.tab[1] = guiCreateTab("Tab", GUIEditor.tabpanel[1]) end addEventHandler ("onClientResourceStart", getRootElement(), resourceStart) function menuShow () visableornot = guiGetVisible (theWindow) if (visableornot == true) then guiSetVisible (theWindow, false) showCursor (false) end if (visableornot == false) then guiSetVisible (theWindow, true) showCursor (true) end end When I hit the marker, just the outputChatBox message shows, but the window doesn't... Whats wrong? MTA:Rust Pre-Alpha Build v.0.3: https://forum.mtasa.com/viewtopic.php?f=114&t=97848 2Pac: ''Only God can judge me!''
iPrestege Posted March 8, 2013 Posted March 8, 2013 Maybe like this will be easy? client side : local marker = createMarker ( x,y,z, "cylinder", size,r,g,b, 170 ) addEventHandler ( "onClientMarkerHit", marker, function ( player ) if ( player == localPlayer ) then guiSetVisible ( window, true ) showCursor ( true ) end end ) Replace : x,y,z = You're Position To Create The Marker Window = You're Window Just That Have Fun Any Thing Just Ask Mr.Pres[T]ege .......
K4stic Posted March 8, 2013 Posted March 8, 2013 Try this code --Server Side jobMarker = createMarker (1942.57, 2184.79, 9.82, "cylinder", 1, 255, 0, 0, 127) function markerHit (hitPlayer, matchingDimension) if (source == jobMarker) then triggerClientEvent ("viewGUI", hitPlayer) outputChatBox ("Bun venit la gara Romana CFR.", hitPlayer, 255, 0, 0) end end addEventHandler ("onMarkerHit", getRootElement(), markerHit)) --Client Side GUIEditor = { memo = {}, button = {}, window = {}, radiobutton = {}, tab = {}, label = {}, tabpanel = {}, } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(684, 215, 491, 334, "CFR - Sofer De Tren", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetAlpha(GUIEditor.window[1], 0.75) GUIEditor.button[1] = guiCreateButton(52, 169, 136, 65, "Angajeaza-te", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[1], "default-bold-small") GUIEditor.button[2] = guiCreateButton(299, 169, 136, 65, "Demisioneaza", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[2], "default-bold-small") GUIEditor.button[3] = guiCreateButton(299, 259, 136, 65, "Închide", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[3], "default-bold-small") GUIEditor.memo[1] = guiCreateMemo(206, 180, 76, 85, "", false, GUIEditor.window[1]) GUIEditor.label[1] = guiCreateLabel(252, 119, 70, 54, "", false, GUIEditor.window[1]) GUIEditor.memo[2] = guiCreateMemo(46, 35, 393, 124, " Bun venit la gara CFR!\nCautamt conductori de locomotiva, tot ce trebuie sa faci este sa conduci trenul si sa iei pasageri. Ia o colomotiva, o poti gasii pe sine, si incepeti slujba.\n\n Mult Succes!", false, GUIEditor.window[1]) guiMemoSetReadOnly(GUIEditor.memo[2], true) GUIEditor.tabpanel[1] = guiCreateTabPanel(178, 196, 60, 57, false, GUIEditor.memo[2]) GUIEditor.tab[1] = guiCreateTab("Tab", GUIEditor.tabpanel[1]) GUIEditor.radiobutton[1] = guiCreateRadioButton(191, 271, 75, 44, "", false, GUIEditor.window[1]) guiRadioButtonSetSelected(GUIEditor.radiobutton[1], true) end ) function menuShow () visableornot = guiGetVisible (GUIEditor.window[1]) if (visableornot == true) then guiSetVisible (GUIEditor.window[1], false) showCursor (false) end if (visableornot == false) then guiSetVisible (GUIEditor.window[1], true) showCursor (true) end end addEvent ("viewGUI", true) addEventHandler( "viewGUI" , root, menuShow) Giving a Fuck? Nope, That isn't in My Skill Set
..:D&G:.. Posted March 8, 2013 Author Posted March 8, 2013 Non of this worked, I will try to fix it... I hope I will succed.. MTA:Rust Pre-Alpha Build v.0.3: https://forum.mtasa.com/viewtopic.php?f=114&t=97848 2Pac: ''Only God can judge me!''
..:D&G:.. Posted March 8, 2013 Author Posted March 8, 2013 If I add the code to the client side, the marker will not appear at all... MTA:Rust Pre-Alpha Build v.0.3: https://forum.mtasa.com/viewtopic.php?f=114&t=97848 2Pac: ''Only God can judge me!''
iPrestege Posted March 8, 2013 Posted March 8, 2013 Client : GUIEditor = { memo = {}, button = {}, window = {}, radiobutton = {}, tab = {}, label = {}, tabpanel = {}, } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(684, 215, 491, 334, "CFR - Sofer De Tren", false) guiSetVisible ( GUIEditor.window[1], false ) guiWindowSetSizable(GUIEditor.window[1], false) guiSetAlpha(GUIEditor.window[1], 0.75) GUIEditor.button[1] = guiCreateButton(52, 169, 136, 65, "Angajeaza-te", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[1], "default-bold-small") GUIEditor.button[2] = guiCreateButton(299, 169, 136, 65, "Demisioneaza", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[2], "default-bold-small") GUIEditor.button[3] = guiCreateButton(299, 259, 136, 65, "Închide", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[3], "default-bold-small") GUIEditor.memo[1] = guiCreateMemo(206, 180, 76, 85, "", false, GUIEditor.window[1]) GUIEditor.label[1] = guiCreateLabel(252, 119, 70, 54, "", false, GUIEditor.window[1]) GUIEditor.memo[2] = guiCreateMemo(46, 35, 393, 124, " Bun venit la gara CFR!\nCautamt conductori de locomotiva, tot ce trebuie sa faci este sa conduci trenul si sa iei pasageri. Ia o colomotiva, o poti gasii pe sine, si incepeti slujba.\n\n Mult Succes!", false, GUIEditor.window[1]) guiMemoSetReadOnly(GUIEditor.memo[2], true) GUIEditor.tabpanel[1] = guiCreateTabPanel(178, 196, 60, 57, false, GUIEditor.memo[2]) GUIEditor.tab[1] = guiCreateTab("Tab", GUIEditor.tabpanel[1]) GUIEditor.radiobutton[1] = guiCreateRadioButton(191, 271, 75, 44, "", false, GUIEditor.window[1]) guiRadioButtonSetSelected(GUIEditor.radiobutton[1], true) end ) addEvent ("viewGUI", true) addEventHandler( "viewGUI" , root, function () guiSetVisible ( GUIEditor.window[1], true ) showCursor ( true ) end ) Server : local jobMarker = createMarker (1942.57, 2184.79, 9.82, "cylinder", 1, 255, 0, 0, 127) addEventHandler ("onMarkerHit", jobMarker, function (hitPlayer) if (getElementType(hitPlayer) == "player") then triggerClientEvent ("viewGUI",source) outputChatBox ("Bun venit la gara Romana CFR.", hitPlayer, 255, 0, 0) end end ) Try it.
..:D&G:.. Posted March 9, 2013 Author Posted March 9, 2013 It worked, thanks, now, how do I do this button GUIEditor.button[3] = guiCreateButton(299, 259, 136, 65, "Închide", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[3], "default-bold-small") A closing window button? PS: Just tell me what to do, I want to do the code by myself. MTA:Rust Pre-Alpha Build v.0.3: https://forum.mtasa.com/viewtopic.php?f=114&t=97848 2Pac: ''Only God can judge me!''
Jaysds1 Posted March 9, 2013 Posted March 9, 2013 (edited) you would need to use these:onClientGUIClick guiSetVisible showCursor Edited March 9, 2013 by Guest My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
Baseplate Posted March 9, 2013 Posted March 9, 2013 addEventHandler("onClientGUIClick", GUIEditor.button[3], function() guiSetVisible(GUIEditor.window[1], false) showCursor(false) end )
..:D&G:.. Posted March 9, 2013 Author Posted March 9, 2013 Hm.. it doesn't work.. GUIEditor = { memo = {}, button = {}, window = {}, tab = {}, label = {}, tabpanel = {}, } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(684, 215, 491, 334, "CFR - Sofer De Tren", false) guiSetVisible ( GUIEditor.window[1], false ) guiWindowSetSizable(GUIEditor.window[1], false) guiSetAlpha(GUIEditor.window[1], 0.75) GUIEditor.button[1] = guiCreateButton(52, 169, 136, 65, "Angajeaza-te", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[1], "default-bold-small") GUIEditor.button[2] = guiCreateButton(299, 169, 136, 65, "Demisioneaza", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[2], "default-bold-small") GUIEditor.button[3] = guiCreateButton(299, 259, 136, 65, "Închide", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[3], "default-bold-small") GUIEditor.label[1] = guiCreateLabel(252, 119, 70, 54, "", false, GUIEditor.window[1]) GUIEditor.memo[2] = guiCreateMemo(46, 35, 393, 124, " Bun venit la gara CFR!\nCautamt conductori de locomotiva, tot ce trebuie sa faci este sa conduci trenul si sa iei pasageri. Ia o colomotiva, o poti gasii pe sine, si incepeti slujba.\n\n Mult Succes!", false, GUIEditor.window[1]) guiMemoSetReadOnly(GUIEditor.memo[2], true) GUIEditor.tabpanel[1] = guiCreateTabPanel(178, 196, 60, 57, false, GUIEditor.memo[2]) GUIEditor.tab[1] = guiCreateTab("Tab", GUIEditor.tabpanel[1]) end ) addEvent ("viewGUI", true) addEventHandler( "viewGUI" , root, function () guiSetVisible ( GUIEditor.window[1], true ) showCursor ( true ) end ) addEventHandler("onClientGUIClick", GUIEditor.button[3], function() guiSetVisible(GUIEditor.window[1], false) showCursor(false) end ) Is the code right? MTA:Rust Pre-Alpha Build v.0.3: https://forum.mtasa.com/viewtopic.php?f=114&t=97848 2Pac: ''Only God can judge me!''
Jaysds1 Posted March 9, 2013 Posted March 9, 2013 try this instead: addEventHandler("onClientGUIClick", GUIEditor.button[3],function() guiSetVisible(GUIEditor.window[1], false) showCursor(false) end,false) My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
..:D&G:.. Posted March 9, 2013 Author Posted March 9, 2013 Still nothing Thanks for helping me by the way... MTA:Rust Pre-Alpha Build v.0.3: https://forum.mtasa.com/viewtopic.php?f=114&t=97848 2Pac: ''Only God can judge me!''
Vision Posted March 9, 2013 Posted March 9, 2013 Try this addEventHandler("onClientGUIClick", root, function() if ( source == GUIEditor.button[3] ) then guiSetVisible(GUIEditor.window[1], false) showCursor(false) end end )
..:D&G:.. Posted March 10, 2013 Author Posted March 10, 2013 Try this addEventHandler("onClientGUIClick", root, function() if ( source == GUIEditor.button[3] ) then guiSetVisible(GUIEditor.window[1], false) showCursor(false) end end ) And this code works, thanks. ------- Now, I want to create a team, when a player clicks it, it shoud say, ''You are now an employed at the train station'' and the player should get a skin (I will decide what skin) and he also needs to be put in the specified team. Maybe a train should spawn on the rail. GUIEditor.button[1] = guiCreateButton(52, 169, 136, 65, "Angajeaza-te", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[1], "default-bold-small") And this is the button. Just give me an idea of how to make it, don't give me the whole function, I want to try on my own. MTA:Rust Pre-Alpha Build v.0.3: https://forum.mtasa.com/viewtopic.php?f=114&t=97848 2Pac: ''Only God can judge me!''
iPrestege Posted March 10, 2013 Posted March 10, 2013 Use this function's : triggerServerEvent createTeam setPlayerTeam setElementModel
PaiN^ Posted March 10, 2013 Posted March 10, 2013 Use this function's : triggerServerEvent createTeam setPlayerTeam setElementModel ... it shoud say, ''You are now an employed at the train station'' ... outputChatBox Maybe a train should spawn on the rail... spawnPlayer NOTE : If you used spawn player, You wont need to use setPlayerTeam " Keep Thinking Different . " - Steve Jops -------------------- Don't send me PMs asking for help, I Won't reply !
iPrestege Posted March 10, 2013 Posted March 10, 2013 -- Client -- addEventHandler("onClientGUIClick",GUIEditor.button[1], function () triggerServerEvent("onAskToSetTeamAndSkin",localPlayer); end ); -- Server -- local team = createTeam ( "TEAM NAME",r,g,b ); addEvent("onAskToSetTeamAndSkin",true); addEventHandler("onAskToSetTeamAndSkin",root, function () spawnPlayer(source,x,y,z,0,SKIN,0,0,team); end ); Replace : r,g,b = teamColor x,y,z = you're position to spawn player on it SKIN = Skin Id and the spawnPlayer Funtion will setPlayerTeam On The Team Try it .
PaiN^ Posted March 10, 2013 Posted March 10, 2013 -- Client -- addEventHandler("onClientGUIClick",GUIEditor.button[1], function () triggerServerEvent("onAskToSetTeamAndSkin",localPlayer); end ); -- Server -- local team = createTeam ( "TEAM NAME",r,g,b ); addEvent("onAskToSetTeamAndSkin",true); addEventHandler("onAskToSetTeamAndSkin",root, function () spawnPlayer(source,x,y,z,0,SKIN,0,0,team); end ); Replace : r,g,b = teamColor x,y,z = you're position to spawn player on it SKIN = Skin Id and the spawnPlayer Funtion will setPlayerTeam On The Team Try it . Just give me an idea of how to make it, don't give me the whole function, I want to try on my own. " Keep Thinking Different . " - Steve Jops -------------------- Don't send me PMs asking for help, I Won't reply !
..:D&G:.. Posted March 10, 2013 Author Posted March 10, 2013 No problem, I won't use the code. I want to learn and maybe make scripts by my own MTA:Rust Pre-Alpha Build v.0.3: https://forum.mtasa.com/viewtopic.php?f=114&t=97848 2Pac: ''Only God can judge me!''
PaiN^ Posted March 10, 2013 Posted March 10, 2013 Just don't give up, And you well ^^ " Keep Thinking Different . " - Steve Jops -------------------- Don't send me PMs asking for help, I Won't reply !
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