Jump to content

Timic

Members
  • Posts

    169
  • Joined

  • Last visited

Everything posted by Timic

  1. Hello i need help its easy to fix it here line: addEventHandler ("onClientResourceStart", getResourceRootElement(getThisResource()), guishow) addCommandHandler ("rules", guishow) function hideWindow (player,key,kyestate) guiSetVisible (DTAwnd,false) showCursor (false,false) end function resourceStart () bindKey ("p","down",hideWindow) showCursor (true,true) end addEventHandler ("onClientResourceStart", getResourceRootElement(getThisResource()), resourceStart) addCommandHandler ("rules", resourceStart) when i write /rules not show me window why?
  2. Timic

    Scripting Help!

    this not help to me ...
  3. Error: Couldn't Connect To MySQL server Fix?
  4. g_Root = getRootElement() addEventHandler('onClientPlayerJoin', g_Root, function() outputChatBox('#449ecbJOIN: #FFFFFF' .. getPlayerName(source) .. ' #449ecbhas joined from: #FFFFFF' .. [u]getPlayerCountry(source)[/u] .. ', 255, 100, 100,true) end ) addEventHandler('onClientPlayerChangeNick', g_Root, function(oldNick, newNick) outputChatBox('#449ecbNICK: #FFFFFF' .. oldNick .. ' #449ecbis now known as #FFFFFF' .. newNick, 255, 100, 100,true) end ) addEventHandler('onClientPlayerQuit', g_Root, function(reason) outputChatBox('#449ecbQUIT: #FFFFFF' .. getPlayerName(source) .. ' #449ecbhas left the game [' .. reason .. ']', 255, 100, 100,true) end ) Can somebody Help This
  5. no what key i have to press...
  6. have one question 'how to use it?'
  7. im not stoling man -.-
  8. what? im not stoling man
  9. i do all but he not show me window
  10. He Not show me clock.png...
  11. 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 ;(
  12. i have a little problem i had in troubles because something wrong! ---------------------------------- DO NOT CHANGE THESE ---------------------------------- local SCREEN_WIDTH, SCREEN_HEIGHT = guiGetScreenSize() local CLOCK_IMG,CLOCK_DEFAULT_X,CLOCK_DEFAULT_Y,CLOCK_DIAMETER,CLOCK_COLOR,CLOCK_POST_GUI local CLOCK_RADIUS,CLOCK_CENTER_X,CLOCK_CENTER_Y local CLOCK_HOUR_IMG,CLOCK_HOUR_W,CLOCK_HOUR_H,CLOCK_HOUR_X,CLOCK_HOUR_Y,CLOCK_HOUR_ROT_POS_X,CLOCK_HOUR_ROT_POS_Y,CLOCK_HOUR_COLOR local CLOCK_MINUTE_IMG,CLOCK_MINUTE_W,CLOCK_MINUTE_H,CLOCK_MINUTE_X,CLOCK_MINUTE_Y,CLOCK_MINUTE_ROT_POS_X,CLOCK_MINUTE_ROT_POS_Y,CLOCK_MINUTE_COLOR local CLOCK_SECOND_IMG,CLOCK_SECOND_W,CLOCK_SECOND_H,CLOCK_SECOND_X,CLOCK_SECOND_Y,CLOCK_SECOND_ROT_POS_X,CLOCK_SECOND_ROT_POS_Y,CLOCK_SECOND_COLOR local CLOCK_SETTING_FILE,CLOCK_SETTING_DEFAULT_TOGGLE local CLOCK_X,CLOCK_Y = 0,0 ---------------------------------- SETTINGS (do change these) ---------------------------------- CLOCK_SETTING_FILE = "clock.xml" CLOCK_SETTING_DEFAULT_TOGGLE = true CLOCK_DEFAULT_X = SCREEN_WIDTH - SCREEN_WIDTH*0.2 + ( 70/1280 ) * SCREEN_WIDTH CLOCK_DEFAULT_Y = ( 140/1024 ) * SCREEN_HEIGHT -- These settings are inside this function so they can be reloaded later on -- Changing the values shouldn't do any harm function setSettings() CLOCK_IMG = "clock.png" CLOCK_DIAMETER = SCREEN_HEIGHT * 0.13 CLOCK_COLOR = tocolor(255,255,255,255) CLOCK_POST_GUI = false CLOCK_RADIUS = CLOCK_DIAMETER / 2 CLOCK_CENTER_X = CLOCK_X + CLOCK_RADIUS CLOCK_CENTER_Y = CLOCK_Y + CLOCK_RADIUS CLOCK_HOUR_IMG = "whyzerbig.png" CLOCK_HOUR_W = CLOCK_DIAMETER / 2.3 / 300 * 22 CLOCK_HOUR_H = CLOCK_DIAMETER / 2.3 CLOCK_HOUR_X = CLOCK_CENTER_X - CLOCK_HOUR_W / 2 CLOCK_HOUR_Y = CLOCK_Y + CLOCK_HOUR_H / 300 * 50 * 3 CLOCK_HOUR_ROT_POS_X = 0 CLOCK_HOUR_ROT_POS_Y = CLOCK_HOUR_H / 300 * 50 CLOCK_HOUR_COLOR = tocolor(255,255,255,255) CLOCK_MINUTE_IMG = "whyzerbig.png" CLOCK_MINUTE_W = CLOCK_DIAMETER / 2 / 300 * 22 CLOCK_MINUTE_H = CLOCK_DIAMETER / 2 CLOCK_MINUTE_X = CLOCK_CENTER_X-- - CLOCK_MINUTE_W / 2 CLOCK_MINUTE_Y = CLOCK_Y + CLOCK_MINUTE_H / 300 * 50 * 2 CLOCK_MINUTE_ROT_POS_X = 0 CLOCK_MINUTE_ROT_POS_Y = CLOCK_MINUTE_H / 300 * 50 CLOCK_MINUTE_COLOR = tocolor(255,255,255,255) CLOCK_SECOND_IMG = "whyzerseconds.png" CLOCK_SECOND_W = CLOCK_DIAMETER / 1.7 / 280 * 13 CLOCK_SECOND_H = CLOCK_DIAMETER / 1.7 CLOCK_SECOND_X = CLOCK_CENTER_X - CLOCK_SECOND_W / 2 CLOCK_SECOND_Y = CLOCK_Y + CLOCK_SECOND_H / 280 * 40 * 1.5 CLOCK_SECOND_ROT_POS_X = 0 CLOCK_SECOND_ROT_POS_Y = CLOCK_SECOND_H / 280 * 40 CLOCK_SECOND_COLOR = tocolor(255,255,255,255) end ---------------------------------- END OF SETTINGS ---------------------------------- local toggle = CLOCK_SETTING_DEFAULT_TOGGLE local repos = false function handleClockStart() -- Load the settings file local xmlFile = xmlLoadFile(CLOCK_SETTING_FILE) if xmlFile then -- Load the settings, and apply them toggle = xmlNodeGetAttribute(xmlFile,"enabled") ~= "false" CLOCK_X = tonumber(xmlNodeGetAttribute(xmlFile,"posX")) or CLOCK_DEFAULT_X CLOCK_Y = tonumber(xmlNodeGetAttribute(xmlFile,"posY")) or CLOCK_DEFAULT_Y -- Close the XML file (pretty important) xmlUnloadFile(xmlFile) else -- Set the default position as the clock position CLOCK_X = CLOCK_DEFAULT_X CLOCK_Y = CLOCK_DEFAULT_Y -- Save the default settings, because the file doesn't exist yet handleXMLSave() end -- Apply all settings setSettings() -- Clock enabled? If so, render it if toggle then addEventHandler("onClientRender",getRootElement(),renderClock) end end addEventHandler("onClientResourceStart",getResourceRootElement(),handleClockStart) function handleXMLSave() -- Load the settings file local xmlFile = xmlLoadFile(CLOCK_SETTING_FILE) if not xmlFile then -- If it doesn't exist, create it xmlFile = xmlCreateFile("clock.xml","settings") if not xmlFile then -- If it manages to fuck up, then wtf? outputDebugString("Clock settings could not be saved",1) return end end -- Store the data xmlNodeSetAttribute(xmlFile,"enabled",tostring(toggle)) xmlNodeSetAttribute(xmlFile,"posX",tostring(CLOCK_X)) xmlNodeSetAttribute(xmlFile,"posY",tostring(CLOCK_Y)) -- Make sure the data is actually saved, and close the file xmlSaveFile(xmlFile) xmlUnloadFile(xmlFile) end function toggleClock() -- Invert the toggle ( true -> false, false -> true ) toggle = not toggle -- See if the rendering should be enabled, or disabled if toggle then addEventHandler("onClientRender",getRootElement(),renderClock) else removeEventHandler("onClientRender",getRootElement(),renderClock) end -- Store it in the settings file handleXMLSave() end addCommandHandler("clock",toggleClock) local REPOS_CLOCK_X_BACKUP,REPOS_CLOCK_Y_BACKUP function toggleReposClock() -- Invert the repositioning toggle ( true -> false, false -> true ) repos = not repos -- Show the cursor, so players can indicate where they want the clock showCursor(repos) if repos then -- Store the current position, in case they cancel REPOS_CLOCK_X_BACKUP = CLOCK_X REPOS_CLOCK_Y_BACKUP = CLOCK_Y -- Notify them they're changing the position outputChatBox("Move the mouse to reposition the clock. Left-click to confirm the new position, right-click to cancel",255,128,0) -- Handle the repositioning every frame addEventHandler("onClientRender",getRootElement(),reposClockDoPulse) else -- Restore the position from backup CLOCK_X = REPOS_CLOCK_X_BACKUP CLOCK_Y = REPOS_CLOCK_Y_BACKUP -- Put all settings back to normal setSettings() -- Notify the player he just cancelled repositioning outputChatBox("Repositioning cancelled",255,128,0) -- Stop handling repositioning removeEventHandler("onClientRender",getRootElement(),reposClockDoPulse) end end addCommandHandler("reposclock",toggleReposClock) function reposClockDoPulse() -- Get the cursor position every frame local cursorX, cursorY = getCursorPosition() -- Set the clock to the new position CLOCK_X = cursorX * SCREEN_WIDTH CLOCK_Y = cursorY * SCREEN_HEIGHT -- Apply new position settings setSettings() -- Did the player just press the left mouse button? if getKeyState("mouse1") then -- Save the new position handleXMLSave() -- Stop the repositioning process repos = false removeEventHandler("onClientRender",getRootElement(),reposClockDoPulse) -- Hide the cursor showCursor(false) -- Notify them the repositioning is successful outputChatBox("Repositioning successful",255,128,0) elseif getKeyState("mouse2") then -- Right mouse button? Cancel movement toggleReposClock() end end function renderClock() -- Getting time and processing to rotation local time = getRealTime() local hour = time.hour % 12 -- There are only 12 possible hours on an analog clock local minute = time.minute local second = time.second minute = minute + second / 60 -- To make the minute pointer a lot smoother hour = hour + minute / 60 -- Same as the above local hourRot = 360 * ( hour / 12 ) local minuteRot = 360 * ( minute / 60 ) local secondRot = 360 * ( second / 60 ) -- Render background dxDrawImage(CLOCK_X,CLOCK_Y,CLOCK_DIAMETER,CLOCK_DIAMETER,CLOCK_IMG,0,0,0,CLOCK_COLOR,CLOCK_POST_GUI) -- Render hour pointer dxDrawImage(CLOCK_HOUR_X,CLOCK_HOUR_Y,CLOCK_HOUR_W,CLOCK_HOUR_H,CLOCK_HOUR_IMG,hourRot,CLOCK_HOUR_ROT_POS_X,CLOCK_HOUR_ROT_POS_Y,CLOCK_HOUR_COLOR,CLOCK_POST_GUI) -- Render minute pointer dxDrawImage(CLOCK_MINUTE_X,CLOCK_MINUTE_Y,CLOCK_MINUTE_W,CLOCK_MINUTE_H,CLOCK_MINUTE_IMG,minuteRot,CLOCK_MINUTE_ROT_POS_X,CLOCK_MINUTE_ROT_POS_Y,CLOCK_MINUTE_COLOR,CLOCK_POST_GUI) -- Render second pointer dxDrawImage(CLOCK_SECOND_X,CLOCK_SECOND_Y,CLOCK_SECOND_W,CLOCK_SECOND_H,CLOCK_SECOND_IMG,secondRot,CLOCK_SECOND_ROT_POS_X,CLOCK_SECOND_ROT_POS_Y,CLOCK_SECOND_COLOR,CLOCK_POST_GUI) end Help?
  13. Thank You! Now Works Perfectly !
  14. Hi, I'm here because I want little help. I had troubles! function PlayMyMusic ( ) local sound = playSound("sound.mp3",false) setSoundVolume(sound, 3.0) end) addEvent("playMyMusic",true) addEventHandler("playMyMusic", getRootElement( ), function( ) addCommandHandler("disco", playMyMusic) I hope you'll help me !
×
×
  • Create New...