battlefield Posted December 27, 2010 Share Posted December 27, 2010 Hi I made teleport window from 3rd GUI tut but I want it to show only when player types /teleport in chat box not at startup and when I click one button on it cursor hides and rules window is still showing. Temporary solution was to open chatbox and click accept whith cursor. And I have allso problem whith a 69 button. When i click it nothing happens. Here are the scripts teleport function createTeleportWindow() local sWidth, sHeight = guiGetScreenSize() local Width,Height = 231,308 local X = (sWidth/2) - (Width/2) local Y = (sHeight/2) - (Height/2) teleportWindow = guiCreateWindow(X,Y,Width,Height,"City Teleporter",false) guiWindowSetSizable(teleportWindow,false) teleportLabel = guiCreateLabel(18,23,191,33,"Click a button to teleport to that location",false,teleportWindow) guiLabelSetHorizontalAlign(teleportLabel,"center",true) teleportButtonLS = guiCreateButton(18,63,195,35,"Los Santos Airport",false,teleportWindow) addEventHandler("onClientGUIClick", teleportButtonLS, teleportPlayer, false) teleportButtonSF = guiCreateButton(18,103,195,35,"San Fierro Airport",false,teleportWindow) addEventHandler("onClientGUIClick", teleportButtonSF, teleportPlayer, false) teleportButtonLV = guiCreateButton(18,143,195,35,"Las Venturas Airport",false,teleportWindow) addEventHandler("onClientGUIClick", teleportButtonLV, teleportPlayer, false) teleportButtonA96 = guiCreateButton(18,183,195,35, "A69",false,teleportWindow) addEventHandler("onClientGUIClick", teleportButtonA69, teleportPlayer, false) teleportButtonVMA = guiCreateButton(18,223,195,35, "Abandoned Airfield",false,teleportWindow) addEventHandler("onClientGUIClick", teleportButtonVMA, teleportPlayer, false) teleportButtonLVT = guiCreateButton(18,263,195,35, "LVAP Tower",false,teleportWindow) addEventHandler("onClientGUIClick", teleportButtonLVT, teleportPlayer, false) guiSetVisible(teleportWindow,true) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () createTeleportWindow() end ) function openTeleportWindow() guiSetVisible(teleportWindow,true) showCursor(true,true) end addCommandHandler("teleport",openTeleportWindow) function teleportPlayer(button,state) if button == "left" and state == "up" then if source == teleportButtonLS then triggerServerEvent("movePlayerToPosition",getLocalPlayer(),1514.0584716797,-2450.4548339844,13.16042137146,180) outputChatBox("Welcome to Los Santos Airport!") elseif source == teleportButtonSF then triggerServerEvent("movePlayerToPosition",getLocalPlayer(),-1262.642578125,16.495651245117,13.754295349121,315) outputChatBox("Welcome to San Fierro Airport!") elseif source == teleportButtonLV then triggerServerEvent("movePlayerToPosition",getLocalPlayer(),1318.1278076172,1264.7803955078,10.427061080933,0) outputChatBox("Welcome to Las Venturas Airport!") elseif source == telportButtonA69 then triggerServerEvent("movePlayerToPosition",getLocalPlayer(),353.88186645508,2016.3455810547,22.246082305908,270) outputChatBox("Welcome to Area 69!") elseif source == teleportButtonVMA then triggerServerEvent("movePlayerToPosition",getLocalPlayer(),414.01834106445,2532.2358398438,16.187467575073,180) outputChatBox("Welcome to Abandoned Airfield!") elseif source == teleportButtonLVT then triggerServerEvent("movePlayerToPosition",getLocalPlayer(),1291.3555908203,1579.6163330078,50.296875,90) outputChatBox("Welcome to LVAP Tower!") end guiSetVisible(teleportWindow, false) showCursor(false) end end rules function createRulesWindow() local sWidth, sHeight = guiGetScreenSize() local Width,Height = 445,445 local X = (sWidth/2) - (Width/2) local Y = (sHeight/2) - (Height/2) rulesWindow = guiCreateWindow(X,Y,Width,Height,"Rules",false) guiWindowSetMovable(rulesWindow,false) guiWindowSetSizable(rulesWindow,false) rulesButton = guiCreateButton(137,394,158,37,"Accept",false,rulesWindow) rulesLabel = guiCreateLabel(10,25,425,359,[[ Welcome to Fun Flight Server! Please carefully read the rules before accepting. By accepting the rules, you are agreeing to play by them. Anyone caught breaking these rules will be kicked and/or banned from this server. If you do not accept the rules within 90 seconds, you will be kicked. 1: No cheating. 2: No bug abuse. 3: No mods to your game. 4: No flaming. 5: Respect other players. 6: Be nice! 7: No jacking!]],false,rulesWindow) guiLabelSetHorizontalAlign(rulesLabel,"center",true) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () createRulesWindow() addEventHandler("onClientGUIClick",rulesButton,acceptRules,false) showCursor(true,true) end ) function acceptRules(button,state) if button == "left" and state == "up" then guiSetVisible(rulesWindow, false) showCursor(false,false) outputChatBox("Thank you for accepting our rules. Have fun!") if rulesWarningTimer then killTimer(rulesWarningTimer) rulesWarningTimer = nil end end end function inactivePlayer(status) if status == 1 then outputChatBox("Please accept our rules or be kicked.") rulesWarningTimer = setTimer(inactivePlayer,30000,1,2) elseif status == 2 then outputChatBox("FINAL WARNING: Please accept our rules or be kicked.") rulesWarningTimer = setTimer(inactivePlayer,30000,1,3) elseif status == 3 then triggerServerEvent("clientKickInactivePlayer",getLocalPlayer()) end end addEvent("clientKickInactivePlayer",true) function kickInactivePlayer() kickPlayer(client,"Please accept our rules.") end addEventHandler("clientKickInactivePlayer",root,kickInactivePlayer) lua function moveThePlayer(x,y,z,rotation) if x and y and z and rotation then local skin = getElementModel(client) spawnPlayer(client,x,y,z,rotation,skin) setCameraTarget(client,client) end end addEvent("movePlayerToPosition",true) addEventHandler("movePlayerToPosition",root,moveThePlayer) And could you please help me with timer at rules window it doesn't kicks or show warnings Link to comment
J.S. Posted December 27, 2010 Share Posted December 27, 2010 I can almost be completely positive that the rules window is stollen from Mini-Missions... Link to comment
Castillo Posted December 28, 2010 Share Posted December 28, 2010 J.S, if you haven't got anything to post then don't post! https://wiki.multitheftauto.com/wiki/Introduction_to_Scripting_the_GUI_-_Part_2 Mini-mission's RULES window is much different since it uses animations. Link to comment
battlefield Posted December 28, 2010 Author Share Posted December 28, 2010 Anyways where is it coming from post reply's only if you have some kind of solution in your mind because I'm stuck in it. Link to comment
Remp Posted December 28, 2010 Share Posted December 28, 2010 the teleport window shows at startup because you arent hiding it when you create it: function createTeleportWindow() ... guiSetVisible(teleportWindow,true) end change that to false and it will be hidden when the resource starts your A69 teleport button variable is called 'teleportButtonA96', but you reference it later (line 71) as 'telportButtonA69', missing an 'e' and swapping 96 for 69 the rules window timer doesnt work because you missed out the part where you actually create the timer: https://wiki.multitheftauto.com/wiki/Int ... ng_a_timer Link to comment
battlefield Posted December 29, 2010 Author Share Posted December 29, 2010 welll a69 button ans that popup works fine now but timer still isnt't working i tried to put thet in but it isnt working function createRulesWindow() local sWidth, sHeight = guiGetScreenSize() local Width,Height = 445,445 local X = (sWidth/2) - (Width/2) local Y = (sHeight/2) - (Height/2) rulesWindow = guiCreateWindow(X,Y,Width,Height,"Rules",false) guiWindowSetMovable(rulesWindow,false) guiWindowSetSizable(rulesWindow,false) rulesButton = guiCreateButton(137,394,158,37,"Accept",false,rulesWindow) rulesLabel = guiCreateLabel(10,25,425,359,[[ Welcome to Fun Flight Server! Please carefully read the rules before accepting. By accepting the rules, you are agreeing to play by them. Anyone caught breaking these rules will be kicked and/or banned from this server. If you do not accept the rules within 90 seconds, you will be kicked. 1: No cheating. 2: No bug abuse. 3: No mods to your game. 4: No flaming. 5: Respect other players. 6: Be nice! 7: No shooting! 8: No jacking!]],false,rulesWindow) guiLabelSetHorizontalAlign(rulesLabel,"center",true) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () createRulesWindow() addEventHandler("onClientGUIClick",rulesButton,acceptRules,false) showCursor(true,true) end ) function acceptRules(button,state) if button == "left" and state == "up" then guiSetVisible(rulesWindow, false) showCursor(false,false) outputChatBox("Thank you for accepting our rules. Have fun!") if rulesWarningTimer then killTimer(rulesWarningTimer) rulesWarningTimer = nil end end end rulesWarningTimer = setTimer(inactivePlayer,30000,1,1) function inactivePlayer(status) if status == 1 then outputChatBox("Please accept our rules or be kicked.") rulesWarningTimer = setTimer(inactivePlayer,30000,1,2) elseif status == 2 then outputChatBox("FINAL WARNING: Please accept our rules or be kicked.") rulesWarningTimer = setTimer(inactivePlayer,30000,1,3) elseif status == 3 then triggerServerEvent("clientKickInactivePlayer",getLocalPlayer()) end end addEvent("clientKickInactivePlayer",true) function kickInactivePlayer() kickPlayer(client,"Please accept our rules.") end addEventHandler("clientKickInactivePlayer",root,kickInactivePlayer) Link to comment
Castillo Posted December 30, 2010 Share Posted December 30, 2010 function createRulesWindow() local sWidth, sHeight = guiGetScreenSize() local Width,Height = 445,445 local X = (sWidth/2) - (Width/2) local Y = (sHeight/2) - (Height/2) rulesWindow = guiCreateWindow(X,Y,Width,Height,"Rules",false) guiWindowSetMovable(rulesWindow,false) guiWindowSetSizable(rulesWindow,false) rulesButton = guiCreateButton(137,394,158,37,"Accept",false,rulesWindow) rulesLabel = guiCreateLabel(10,25,425,359,[[ Welcome to Fun Flight Server! Please carefully read the rules before accepting. By accepting the rules, you are agreeing to play by them. Anyone caught breaking these rules will be kicked and/or banned from this server. If you do not accept the rules within 90 seconds, you will be kicked. 1: No cheating. 2: No bug abuse. 3: No mods to your game. 4: No flaming. 5: Respect other players. 6: Be nice! 7: No shooting! 8: No jacking!]],false,rulesWindow) guiLabelSetHorizontalAlign(rulesLabel,"center",true) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () createRulesWindow() addEventHandler("onClientGUIClick",rulesButton,acceptRules,false) showCursor(true,true) end ) function acceptRules(button,state) if button == "left" and state == "up" then guiSetVisible(rulesWindow, false) showCursor(false,false) outputChatBox("Thank you for accepting our rules. Have fun!") if rulesWarningTimer then killTimer(rulesWarningTimer) rulesWarningTimer = nil end end end function inactivePlayer(status) if status == 1 then outputChatBox("Please accept our rules or be kicked.") rulesWarningTimer = setTimer(inactivePlayer,30000,1,2) elseif status == 2 then outputChatBox("FINAL WARNING: Please accept our rules or be kicked.") rulesWarningTimer = setTimer(inactivePlayer,30000,1,3) elseif status == 3 then triggerServerEvent("clientKickInactivePlayer",getLocalPlayer()) end end rulesWarningTimer = setTimer(inactivePlayer,30000,1,1) addEvent("clientKickInactivePlayer",true) function kickInactivePlayer() kickPlayer(client,"Please accept our rules.") end addEventHandler("clientKickInactivePlayer",root,kickInactivePlayer) 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