Timic Posted September 13, 2010 Share Posted September 13, 2010 Please Help Me With This addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () -- call the createRulesWindow function to create our gui createRulesWindow() end ) function createRulesWindow() -- get the screen width and height local sWidth, sHeight = guiGetScreenSize() -- create the window, using some maths to find the centre of the screen local Width,Height = 445,445 local X = (sWidth/2) - (Width/2) local Y = (sHeight/2) - (Height/2) -- create the window and save the window gui element in a variable called 'rulesWindow' rulesWindow = guiCreateWindow(X,Y,Width,Height,"Rules",false) -- stop players from being able to simply move the window out of the way -- note that we use our 'rulesWindow' variable to make changes to the window guiWindowSetMovable(rulesWindow,false) -- stop players from being able to resize the window guiWindowSetSizable(rulesWindow,false) -- create the button and save the button gui element in a variable called 'rulesButton' rulesButton = guiCreateButton(137,394,158,37,"Accept",false,rulesWindow) -- create the label and save the label gui element in a variable called 'rulesLabel' -- we set the text of the label to our rules rulesLabel = guiCreateLabel(10,25,425,359,[[ Welcome to DTA 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!]],false,rulesWindow) -- set the horizontal alignment of the label to center (ie: in the middle of the window) -- also note the final argument "true" -- this turns on wordwrap so if your text goes over the edge of the label, it will wrap around and start a new line automatically guiLabelSetHorizontalAlign(rulesLabel,"center",true) addEventHandler("onClientGUIClick", rulesButton, acceptRules, false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () -- call the createRulesWindow function to create our gui createRulesWindow() -- show the cursor to the player showCursor(true,true) end ) -- create the function and define the 'button' and 'state' parameters -- (these are passed automatically by onClientGUIClick) function acceptRules(button,state) -- if our accept button was clicked with the left mouse button, and the state of the mouse button is up if button == "left" and state == "up" then -- hide the window and all the components guiSetVisible(rulesWindow, false) -- hide the mouse cursor showCursor(false,false) -- output a message to the player outputChatBox("Thank you for accepting our rules. Have fun!") -- if the warning timer exists if rulesWarningTimer then -- stop the timer and set the variable to nil -- this is the timer used to kick players who do not accept the rules. We will cover this in more detail in the next section. killTimer(rulesWarningTimer) rulesWarningTimer = nil end end end function createRulesWindow() -- create all of our gui ... -- set a timer for 30 seconds and set it to call our 'inactivePlayer' function with "1" as an argument rulesWarningTimer = setTimer(inactivePlayer,30000,1,1) end -- create our function and define the 'status' parameter -- the value of status will be passed from our setTimer function call function inactivePlayer(status) -- if status is 1 (this means it is the first warning) if status == 1 then -- output a warning outputChatBox("Please accept our rules or be kicked.") -- set another timer to call inactivePlayer in another 30 seconds, with "2" as an argument rulesWarningTimer = setTimer(inactivePlayer,30000,1,2) -- if status is 2 (the second warning) elseif status == 2 then -- output a final warning outputChatBox("FINAL WARNING: Please accept our rules or be kicked.") -- set a final timer to call inactivePlayer in another 30 seconds, with "3" as an argument rulesWarningTimer = setTimer(inactivePlayer,30000,1,3) elseif status == 3 then -- trigger the server so we can kick the player triggerServerEvent("clientKickInactivePlayer",getLocalPlayer()) end end -- add the event, note the final argument "true" indicates it can be triggered from the client addEvent("clientKickInactivePlayer",true) -- add an event handler for this event to trigger the kickInactivePlayer function addEventHandler("clientKickInactivePlayer",root,kickInactivePlayer) -- create our function function kickInactivePlayer() -- kick the player kickPlayer(client,"Please accept our rules.") end I Make it Then I Had In Troubles ;( Plz Help Me ;( Link to comment
Castillo Posted September 13, 2010 Share Posted September 13, 2010 dude, do /debugscript 3 in game and you will find it out, this time i tell you but next i won't tell you, at line 100 you got this "..." and thats making the error stop working. Link to comment
Timic Posted September 15, 2010 Author Share Posted September 15, 2010 i do all but he not show me window Link to comment
[DMC] Posted September 15, 2010 Share Posted September 15, 2010 wondering why u are posting a stolen script from party and co for the second time... Link to comment
Timic Posted September 15, 2010 Author Share Posted September 15, 2010 what? im not stoling man Link to comment
dzek (varez) Posted September 15, 2010 Share Posted September 15, 2010 stolen. locked. Link to comment
Recommended Posts