iAyoub Posted July 28, 2013 Share Posted July 28, 2013 Hello Everybody, I Need to use the redirectPlayer function in other way ,let me explain , i build a gui window with 4 buttons and if player click on the button 1 the player redirect to new server with Ip ex:192.168.1.1 and Port : 20003, And If He Click Button 2 He redirect To Another Server With Ip ex : 127.0.0.1 and port: 20003 , It Look Easy So Please Help Me How To Do This Function , And Thanks Link to comment
xXMADEXx Posted July 28, 2013 Share Posted July 28, 2013 redirectPlayer ( playerElement, "127.0.0.1", 20003 ) Link to comment
iAyoub Posted July 28, 2013 Author Share Posted July 28, 2013 Yeah I Know But Dont Like This I Want It Related By A Gui Button When Player Click A Gui Button He Will Be Redirected See Ya Link to comment
gokalpfirat Posted July 28, 2013 Share Posted July 28, 2013 First you should look at this wiki topics to create Gui then you should assign redirect function to gui button. guiCreateButton guiCreateWindow onClientGUIClick Link to comment
iAyoub Posted July 28, 2013 Author Share Posted July 28, 2013 I Build The Window And The Gui Button With Gui Editor But Know I Need A Function Who Make The Redirect With A Gui Button Link to comment
boro Posted July 28, 2013 Share Posted July 28, 2013 on comunity are scripts check it https://community.multitheftauto.com/ind ... ls&id=5363 and https://community.multitheftauto.com/ind ... ls&id=4502 Link to comment
iPrestege Posted July 28, 2013 Share Posted July 28, 2013 I Build The Window And The Gui Button With Gui Editor But Know I Need A Function Who Make The Redirect With A Gui Button OK Create your gui then : click button : onClientGUIClick' Event triggerServerEvent -- Connect To The Server addEvent addEventHandler -- To Accept The Call : ) redirectPlayer -- There's no need for a comment about this right lol! Link to comment
boro Posted July 28, 2013 Share Posted July 28, 2013 (edited) Or this is example of my old script f2 for opening panel Client redirect = guiCreateWindow(216, 114, 381, 408, "Redirect Panel", false) guiWindowSetSizable(redirect, false) guiSetAlpha(redirect, 1.00) button1 = guiCreateButton(20, 183, 162, 45, "Server1", false, redirect) button2 = guiCreateButton(20, 346, 162, 45, "Server2", false, redirect) button3 = guiCreateButton(195, 183, 162, 45, "Server3", false, redirect) button4 = guiCreateButton(195, 346, 162, 45, "Server4", false, redirect) function Showindow () if guiGetVisible (redirect) == true then showCursor (false) guiSetVisible (redirect,false) else showCursor (true) guiSetVisible (redirect,true) end end bindKey ("f2", "down", Showindow) function Server1() triggerServerEvent("Server1", localPlayer) hide() end addEventHandler("onClientGUIClick", button1, Server1, false) function Server2() triggerServerEvent("Server2", localPlayer) hide() end addEventHandler("onClientGUIClick", button2, Server2, false) function Server3() triggerServerEvent("AK47", localPlayer) hide() end addEventHandler("onClientGUIClick", button3, Server3, false) function Server4() triggerServerEvent("Server4", localPlayer) hide() end addEventHandler("onClientGUIClick", button4, Server4, false) server function ser1(playerSource) redirectPlayer ( playerSource, "127.0.0.1", 20003 ) end addEvent("Server1", true) addEventHandler("Server1", root, ser1) function ser2(playerSource) redirectPlayer ( playerSource, "127.0.0.1", 20003 ) end addEvent("Server2", true) addEventHandler("Server2", root, ser2) function ser3(playerSource) redirectPlayer ( playerSource, "127.0.0.1", 20003 ) end addEvent("Server3", true) addEventHandler("Server3", root, ser3) function ser4(playerSource) redirectPlayer ( playerSource, "127.0.0.1", 20003 ) end addEvent("Server4", true) addEventHandler("Server4", root, ser4) Edited July 28, 2013 by Guest Link to comment
iPrestege Posted July 28, 2013 Share Posted July 28, 2013 Or this is example of my old scriptf2 for opening panel Clienthttps://forum.multitheftauto.com/posting.ph ... &p=598114# redirect = guiCreateWindow(216, 114, 381, 408, "Redirect Panel", false) guiWindowSetSizable(redirect, false) guiSetAlpha(redirect, 1.00) button1 = guiCreateButton(20, 183, 162, 45, "Server1", false, redirect) button2 = guiCreateButton(20, 346, 162, 45, "Server2", false, redirect) button3 = guiCreateButton(195, 183, 162, 45, "Server3", false, redirect) button4 = guiCreateButton(195, 346, 162, 45, "Server4", false, redirect) function Showindow () if guiGetVisible (redirect) == true then showCursor (false) guiSetVisible (redirect,false) else showCursor (true) guiSetVisible (redirect,true) end end bindKey ("f2", "down", Showindow) function Server1() triggerServerEvent("Server1", localPlayer) hide() end addEventHandler("onClientGUIClick", button1, Server1, false) function Server2() triggerServerEvent("Server2", localPlayer) hide() end addEventHandler("onClientGUIClick", button2, Server2, false) function Server3() triggerServerEvent("AK47", localPlayer) hide() end addEventHandler("onClientGUIClick", button3, Server3, false) function Server4() triggerServerEvent("Server4", localPlayer) hide() end addEventHandler("onClientGUIClick", button4, Server4, false) server function ser1(playerSource) redirectPlayer ( playerElement, "127.0.0.1", 20003 ) end addEvent("Server1", true) addEventHandler("Server1", root, ser1) function ser2(playerSource) redirectPlayer ( playerElement, "127.0.0.1", 20003 ) end addEvent("Server2", true) addEventHandler("Server2", root, ser2) function ser3(playerSource) redirectPlayer ( playerElement, "127.0.0.1", 20003 ) end addEvent("Server3", true) addEventHandler("Server3", root, ser3) function ser4(playerSource) redirectPlayer ( playerElement, "127.0.0.1", 20003 ) end addEvent("Server4", true) addEventHandler("Server4", root, ser4) Player source - Player element : Not defined -_-"! Link to comment
iPrestege Posted July 28, 2013 Share Posted July 28, 2013 oh ty i fix it Also add more than a 'localPlayer' When you call server . Ex : triggerServerEvent( "Server4", localPlayer,localPlayer ) Link to comment
Moderators IIYAMA Posted July 28, 2013 Moderators Share Posted July 28, 2013 why would you add more localPlayer? the source will be the player. 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