Jump to content

kikos500

Members
  • Posts

    125
  • Joined

  • Last visited

Posts posted by kikos500

  1. This is a script to help add logs in a more organized way.

     

    how it works?

    when someone says something in chat its saved in Date_chat.txt file 

    when someone executes a command its saved in Date_commands.txt

    the third file is a debug log so if any error happen in your server in any day you can check it

    all these features are already in mta default logs but this is different because it makes a different file everyday so logs become more organized 

     

    Download

               https://community.multitheftauto.com/index.php?p=resources&s=details&id=14794

  2. Did u try fixing it urself what did debugscript 3 say? just saying

    19 minutes ago, gabrielslayer said:

    I know there are many errors but I can not solve them...

    Help me please.

    doesn't help and this section is for people willing to learn scripting if u want some one to fix ur script u gotta find someone to help u or pay for a scripter

  3. local vip = {}
    local minute = 60000
    local hour = minute*60
    local db = dbConnect("sqlite", "vip.db")
    
    function resourceStart()
    	dbExec(db, "CREATE TABLE IF NOT EXISTS player_vip (account TEXT, vip INT)")
    	for i,v in pairs(getElementsByType("player")) do
    		loadVIP(v)
    	end
    end
    addEventHandler("onResourceStart", resourceRoot, resourceStart)
    
    function resourceStop()
    	for i,v in pairs(getElementsByType("player")) do
    		saveVIP(v)
    	end
    end
    addEventHandler("onResourceStop", resourceRoot, resourceStop)
    
    function login()
    	loadVIP(source)
    end
    addEventHandler("onPlayerLogin", getRootElement(), login)
    
    function quit()
    	saveVIP(source)
    end
    addEventHandler("onPlayerQuit", getRootElement(), quit)
    
    function loadVIP(p)
    	local account = getAccountName(getPlayerAccount(p))
    	local result = dbPoll(dbQuery(db, "SELECT vip FROM player_vip WHERE account = ?", account), -1)
    	vip[account] = {}
    	if not result or (type(result) == "table" and #result == 0) then
    		dbExec(db, "INSERT INTO player_vip (account, vip) VALUES(?, ?)", account, 0)
    		vip[account].vip = 0
    		return
    	end
    	vip[account].vip = result[1].vip
    	vip[account].tick = getTickCount()
    end
    
    function saveVIP(p)
    	local account = getAccountName(getPlayerAccount(p))
    	dbExec(db, "UPDATE player_vip SET vip = ? WHERE account = ?", vip[account].vip, account)	
    end
    
    function vips(p)
    	local account = getAccountName(getPlayerAccount(p))
    	if vip[account].tick then
    		local now = getTickCount() - vip[account].tick
    		local final = round(now/hour, 1)
    		outputChatBox(final)
    		if now >= hour and vip[account].vip > 0 then
    			vip[account].vip = vip[account].vip - final
    		end
    	end
    	outputChatBox(vip[account].vip)
    end
    addCommandHandler("vip", vips)
    
    function round(num, numDecimalPlaces)
      local mult = 10^(numDecimalPlaces or 0)
      return math.floor(num * mult + 0.5) / mult
    end

    did u try something like this? u don't have to use my database part i just made it to make the script work 

  4. local accounts = {}
    local DerbyDB = dbConnect("sqlite", "DD.db")
    
    function resourceStart()
    	dbExec(DerbyDB, "CREATE TABLE IF NOT EXISTS DerbyMission (DDname, DDserial, DDscore INT , DDban )")
    	for i,v in pairs(getElementsByType("player")) do
    		loadAccount(v)
    	end
    end
    addEventHandler("onResourceStart", resourceRoot, resourceStart)
    
    function resourceStop()
    	for i,v in pairs(getElementsByType("player")) do
    		saveAccount(v)
    	end	
    end
    addEventHandler("onResourceStop", resourceRoot, resourceStop)
    
    function join()
    	loadAccount(source)
    end
    addEventHandler("onPlayerJoin", getRootElement(), join)
    
    function leave()
    	saveAccount(source)
    end
    addEventHandler("onPlayerQuit", getRootElement(), leave)
    
    function saveAccount(player)
    	if not accounts[getPlayerSerial(player)] then return end
    	dbExec(DerbyDB, "UPDATE `DerbyMission` SET DDscore = ?, DDban = ? WHERE DDname = ? AND DDserial = ? ", accounts[getPlayerSerial(player)].DDscore, accounts[getPlayerSerial(player)].DDban, getPlayerName(player), getPlayerSerial(player))
    end
    
    function loadAccount(player)
    	local check = dbQuery( DerbyDB, ' SELECT * FROM `DerbyMission` WHERE DDname = ? AND DDserial = ? ', getPlayerName( player ) , getPlayerSerial( player ) )
    	local results = dbPoll( check, -1 )
    	accounts[getPlayerSerial(player)] = {}
    	accounts[getPlayerSerial(player)].serial = getPlayerSerial(player)
    	accounts[getPlayerSerial(player)].name = getPlayerName(player)
    	if ( type( results ) == 'table' and #results == 0 or not results ) then
    		exports ["guimessages"] : outputServer (element, "* [ Derby ]: This is the first join" , 204, 51, 255) 
    		dbExec( DerbyDB, "INSERT INTO DerbyMission VALUES (?,?,?,?)", getPlayerName(player) , getPlayerSerial(player), 0 , 0 )
    		accounts[getPlayerSerial(player)].DDscore = 0
    		accounts[getPlayerSerial(player)].DDban = 0
    		return
    	end
    	accounts[getPlayerSerial(player)].DDscore = results[1].DDscore
    	accounts[getPlayerSerial(player)].DDban = results[1].DDban
    end
    
    function getScore(p)
    	return accounts[getPlayerSerial(p)].DDscore
    end
    
    function setScore(p, amount)
    	accounts[getPlayerSerial(p)].DDscore = tonumber(amount)
    end
    
    
    function getBan(p)
    	return accounts[getPlayerSerial(p)].DDban
    end
    
    function setBan(p, amount)
    	accounts[getPlayerSerial(p)].DDban = tonumber(amount)
    end

    tested and works

    Functions:

    setScore(player, amount) to edit the score to a certain amount

    getScore(player) to get the score

    setBan(player, amount) to edit the ban to a certain amount

    getBan(player) to get the ban

  5. local DerbyDB = dbConnect("sqlite", "DD.db")
    local accounts = {}
    
    function resourceStart()
    	dbExec(DerbyDB, "CREATE TABLE IF NOT EXISTS DerbyMission (DDname, DDserial, DDscore INT , DDban )")
    	for i,v in pairs(getElementsByType("player"))
    		loadAccount(v)
    	end
    end
    addEventHandler("onResourceStart", resourceRoot, resourceStart)
    
    function resourceStop()
    	for i,v in pairs(getElementsByType("player"))
    		saveAccount(v)
    	end	
    end
    addEventHandler("onResourceStop", resourceRoot, resourceStop)
    
    function join()
    	loadAccount(source)
    end
    addEventHandler("onPlayerJoin", getRootElement(), resourceStop)
    
    function leave()
    	saveAccount(source)
    end
    addEventHandler("onPlayerQuit", getRootElement(), resourceStop)
    
    function saveAccount(player)
    	if not accounts[player] then return end
    	dbExec("UPDATE `DerbyMission` SET DDscore = ?, DDban = ? WHERE DDname = ? AND DDserial = ? ", accounts[player].DDscore, accounts[player].DDban, getPlayerName(player), getPlayerSerial(player))
    end
    
    function loadAccount(player)
    	local check = dbQuery( DerbyDB, ' SELECT * FROM `DerbyMission` WHERE DDname = ? AND DDserial = ? ', getPlayerName( player ) , getPlayerSerial( player ) )
    	local results = dbPoll( check, -1 )
    	accounts[getPlayerSerial(player)] = {}
    	accounts[getPlayerSerial(player)].serial = getPlayerSerial(player)
    	accounts[getPlayerSerial(player)].name = getPlayerName(player)
    	if ( type( results ) == 'table' and #results == 0 or not results ) then
    		exports ["guimessages"] : outputServer (element, "* [ Derby ]: This is the first join" , 204, 51, 255) 
    		dbExec( DerbyDB, "INSERT INTO DerbyMission VALUES (?,?,?,?)", getPlayerName(player) , getPlayerSerial(player), 0 , 0 )
    		accounts[getPlayerSerial(player)].DDscore = 0
    		accounts[getPlayerSerial(player)].DDban = 0
    	else
    		accounts[getPlayerSerial(player)].DDscore = results[1].DDscore
    		accounts[getPlayerSerial(player)].DDban = results[1].DDban
    	end
    end
    
    function setScore(p, DDscore, DDban)
    	if accounts[getPlayerSerial(p)] and type(accounts[getPlayerSerial(p)]) == "table" then
    		if DDscore then
    			accounts[getPlayerSerial(p)].DDscore = DDscore
    		end
    		if DDban then
    			accounts[getPlayerSerial(p)].DDban = DDban
    		end
    	end
    end

    should work not tested

  6. @Ridden

    DGS = exports.dgs
    matable = {}
    matable.window = DGS:dgsDxCreateWindow (0.10, 0.28, 0.78, 0.29, "VIP panel", true)
    matable.button = DGS:dgsDxCreateButton(0.34, 0.77, 0.31, 0.18, "set", true, window)
    matable.label = DGS:dgsCreateLabel(0.42, 0.31, 0.36, 0.43, "TrollSkin", true, window)
    
    function outputEditBox ()
    	if source == matable.button then
    		setElementModel(getLocalPlayer(), 10)
    		print("skin of"..getPlayerName(getLocalPlayer()).."has been changed to VIP Troll Skin", 10, 186, 31)
    	else 
    		print("don't work")
        end
    end
    
    function guiToggleVisible()        
    	if (DGS:dgsDxGUIGetVisible(matable.window) == true) then               
    		DGS:dgsDxGUISetVisible (matable.window, false) 
    		showCursor(false)
    		print("works2")
        else              
    		DGS:dgsDxGUISetVisible(matable.window, true) 
    		showCursor(true)
    	end		
    end
    		
    bindKey ("F2", "down", guiToggleVisible)
    addEvent("onClientDgsDxMouseClick", true)
    addEventHandler("onClientDgsDxMouseClick", matable.button, outputEditBox )

    didn't really test but it should work

    • Like 1
    • Thanks 1
  7. local markers = {
    	{1187,-1313,-13.5,"cylinder", 2, 0, 255, 255, 0}, --Hospital
    	{2035,-1429,16.9,"cylinder", 2, 0, 255, 255, 0}, -- Hospital
    	{-2192,-2291,30.6,"cylinder", 2, 0, 255, 255, 0}, --Hospital
    	{-2654,632,14.4,"cylinder", 2, 0, 255, 255, 0}, --Hospital
    	{-1505,2533,55.68,"cylinder", 2, 0, 255, 255, 0}, --Hospital
    	{-326,1063,19.7,"cylinder", 2, 0, 255, 255, 0}, --Hospital
    	{1608,1838,10.8,"cylinder", 2, 0, 255, 255, 0} --Hospital
    }
    
    function create() -- create a function to createMarkers on resource start
    	for _, marker in pairs(markers) do -- looping through the table of markers
    		createMarker(unpack(marker))
    		--[[
    			if this doesn't work then try this
    			createMarker(marker[1], marker[2], marker[3], marker[4], marker[5], marker[6], marker[7], marker[8], marker[9])
    		]]
    	end
    end
    addEventHandler("onClientResourceStart", resourceRoot, create) -- attaching the event

    your code will never work i advise you to use debugscript 3 to debug your scripts anyway i don't fully understand what you want to do but i fixed the creating markers part

     

  8. --Serverside
    function selectMembersList ( playerSource )
      local connection = dbConnect( "sqlite", "data.db" )
     	local qh = dbQuery( connection, "SELECT member_login FROM gang_members WHERE gang_id = ?",selectGangIDBySerial(getPlayerSerial(playerSource)))
      	local result = dbPoll ( qh, -1 )
    
      	local group_members = {}
    
    	  for _, row in ipairs ( result ) do
    	  	local player = getPlayerFromSerial(row["member_login"])
            	table.insert(group_members,getPlayerSerial(player))
          end
          triggerClientEvent("resendValues", source, group_members)
    	 return group_members	--table is ok at this point
    end
    addEvent( "selectMembersListEvent", true )
    addEventHandler( "selectMembersListEvent", resourceRoot, selectMembersList )
    
    
    --Clientside
    
    function addGroupMembers()
    	group_members = triggerServerEvent("selectMembersListEvent",resourceRoot,getLocalPlayer())
    end
    addEventHandler( "onClientResourceStart",resourceRoot,addGroupMembers)
    
    function recieveValue(group_members)
    	for _,value in ipairs(group_members) do -- table expected,got boolean
    		outputChatBox(value)
    	end
    end
    addEvent("resendValues", true)
    addEventHandler("resendValues", resourceRoot, recieveValue)
    

    this should work the way u want it but why don't u do something like this

    -----

    --Serverside
    function selectMembersList()
    	local connection = dbConnect("sqlite", "data.db" )
    	local qh = dbQuery(connection, "SELECT member_login FROM gang_members WHERE gang_id = ?", selectGangIDBySerial(getPlayerSerial(source)))
    	local result = dbPoll(qh, -1 )
    	local group_members = {}
    	
    	for _, row in ipairs (result) do
    		local player = getPlayerFromSerial(row["member_login"])
    		table.insert(group_members, getPlayerSerial(player))
        end
        triggerClientEvent("resendValues", source, group_members)
    end
    addEvent("selectMembersListEvent", true)
    addEventHandler("selectMembersListEvent", resourceRoot, selectMembersList)
    
    
    --Clientside
    
    function addGroupMembers()
    	triggerServerEvent("selectMembersListEvent", getLocalPlayer())
    end
    addEventHandler("onClientResourceStart", resourceRoot, addGroupMembers)
    
    function recieveValue(group_members)
    	for _,value in ipairs(group_members) do -- table expected,got boolean
    		outputChatBox(value)
    	end
    end
    addEvent("resendValues", true)
    addEventHandler("resendValues", resourceRoot, recieveValue)
    

     

  9. local num = 0
    local tick = getTickCount()
    
    addEventHandler("onClientRender", getRootElement(), function ()
    	if tick+5000 <= getTickCount() then
    		if num >= 10 then 
    			num = 0
    		end
    		tick = getTickCount()
    		num = num + 1
    		outputDebugString(num)
    	end
    end)
    local num = 0
    local negative = false
    local tick = getTickCount()
    
    addEventHandler("onClientRender", getRootElement(), function ()
    	if tick+5000 <= getTickCount() then
    		if num >= 10 then 
    			negative = true
    		elseif num <= 1 then 
    			negative = false
    		end
    		tick = getTickCount()
    		if not negative then
    			num = num + 1
    		else
    			num = num - 1 
    		end
    		outputDebugString(num)
    	end
    end)
    

     

  10. showCursor(true)
    local screenW, screenH = guiGetScreenSize()
    local start = getTickCount()
    local positions = {
    {0, (screenH - 268) / 2, animation = "Linear", duration = 800, tick = getTickCount()}, -- Main Menu 1
    {-200, 240, animation = "Linear", duration = 800, tick = getTickCount()}, -- Dev Label 2
    {50, 284, animation = "Linear", duration = 800, tick = getTickCount()}, -- Username Label 3
    {135, 356, animation = "Linear", duration = 800, tick = getTickCount()}, -- Password Label 4
    {78, 306, animation = "Linear", duration = 800, tick = getTickCount()}, -- Username Editbox 5
    {160, 378, animation = "Linear", duration = 800, tick = getTickCount()}, -- Password Editbox 6
    {86, 312, animation = "Linear", duration = 800, tick = getTickCount()}, -- Username Text 7
    {170, 384, animation = "Linear", duration = 800, tick = getTickCount()}, -- Password Text 8
    {8, 423, animation = "Linear", duration = 800, tick = getTickCount()}, -- Remember Details Label 9
    {215, 423, animation = "Linear", duration = 800, tick = getTickCount()}, -- Remember Details Checkbox 10
    {240, 470, animation = "Linear", duration = 800, tick = getTickCount()}, -- Automated Login Label 11
    {35, 448, animation = "Linear", duration = 800, tick = getTickCount()}, -- Automated Login Checkbox 12
    {220, 436, animation = "Linear", duration = 800, tick = getTickCount()}, -- Login Text 13
    {10, 435, animation = "Linear", duration = 800, tick = getTickCount()}, -- Login Button 14
    {225, 478, animation = "Linear", duration = 800, tick = getTickCount()}, -- Register an account label 15
    }
    
    local dummyTicks = {}
    
    function draw()
    	for i,pos in pairs(positions) do
    		positions[i].moving = animate(pos[1], pos[2], pos.animation, pos.duration, function () end, pos.tick)
    	end
    	
    	dxDrawRectangle((screenW - 386) / 2, positions[1].moving, 386, 268, tocolor(13, 23, 26, 178), false)
    	dxDrawText("Welcome to the server!", 447, positions[2].moving, 833, 253, tocolor(255, 255, 255, 255), 0.90, "default-bold", "center", "center", false, false, false, false, false)
    	dxDrawText("Username :", 468, positions[3].moving, 531, 302, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false)
    	dxDrawText("Password :", 468, positions[4].moving, 527, 372, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false)
    	dxDrawRectangle(468, positions[5].moving, 345, 28, tocolor(93, 93, 93, 174), false) -- Username Editbox
    	dxDrawRectangle(467, positions[6].moving, 345, 28, tocolor(93, 93, 93, 174), false) -- Password Editbox
    	dxDrawText("Username", 474, positions[7].moving, 807, 325, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
    	dxDrawText("*************", 474, positions[8].moving, 807, 397, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
    	dxDrawText("Automated Login", 492, positions[11].moving, 600, 438, tocolor(255, 255, 255, 255), 1.00, "arial", "left", "center", false, false, false, false, false)
    	dxDrawRectangle(467, positions[12].moving, 15, 15, tocolor(94, 94, 94, 225), false)
    	dxDrawText("Remember Details", 492, positions[9].moving, 600, 438, tocolor(255, 255, 255, 255), 1.00, "arial", "left", "center", false, false, false, false, false)
    	dxDrawRectangle(467, positions[10].moving, 15, 15, tocolor(94, 94, 94, 225), false)	
    	dxDrawRectangle(715, positions[13].moving, 97, 28, tocolor(94, 94, 94, 225), false)
    	dxDrawText("LOGIN", 714, positions[14].moving, 812, 464, tocolor(255, 255, 255, 255), 1.20, "arial", "center", "center", false, false, false, false, false)   
    	dxDrawText("Don't have an account? Register at - www.vigour-gaming.com", 446, positions[15].moving, 833, 494, tocolor(255, 255, 255, 255), 0.80, "arial", "center", "top", false, false, false, false, false)
    	if isMouseInPosition(440, positions[5].moving, 390, 37) then
    		if not dummyTicks[1] then
    			dummyTicks[1] = getTickCount()
    			resetOtherTicks(1)
    		end
    	    local movingX = animate(0, 345, "Linear", 300, function() end, dummyTicks[1])
    		dxDrawRectangle(468, 334, movingX, 1, tocolor(208, 166, 38, 174), false) -- Username Editbox Active
    	elseif isMouseInPosition(467, positions[6].moving, 345, 28) then
    		if not dummyTicks[2] then
    			dummyTicks[2] = getTickCount()
    			resetOtherTicks(2)
    		end
    	    local movingX = animate(0, 345, "Linear", 300, function() end, dummyTicks[2])
            dxDrawRectangle(467, 406, movingX, 1, tocolor(208, 166, 38, 174), false) -- Password Editbox Active
    	elseif isMouseInPosition(467, positions[10].moving, 15, 15) then
    		if not dummyTicks[3] then
    			dummyTicks[3] = getTickCount()
    			resetOtherTicks(3)
    		end
    	    local movingX = animate(0, 15, "OutQuad", 300, function() end, dummyTicks[3])
            dxDrawRectangle(467, 423, movingX, movingX, tocolor(208, 166, 38, 174), false) -- Checkbox 1 is active?
    	elseif isMouseInPosition(467, positions[12].moving, 15, 15) then
    		if not dummyTicks[4] then
    			dummyTicks[4] = getTickCount()
    			resetOtherTicks(4)
    		end
    	    local movingX = animate(0, 15, "OutQuad", 300, function() end, dummyTicks[4])
           	dxDrawRectangle(467, 448, movingX, movingX, tocolor(208, 166, 38, 174), false) -- Checkbox 2 is active?
    	elseif isMouseInPosition(714, positions[13].moving, 97, 28) then
    		if not dummyTicks[5] then
    			dummyTicks[5] = getTickCount()
    			resetOtherTicks(5)
    		end
    	    local movingX = animate(0, 97, "OutQuad", 300, function() end, dummyTicks[5])
    	    local movingY = animate(0, 28, "OutQuad", 300, function() end, dummyTicks[5])
           	dxDrawRectangle(714, 436, movingX, movingY, tocolor(208, 166, 38, 174), false) -- login button is active?
        else
        	resetAllTicks()
    	end 
    end
    addEventHandler( "onClientRender", getRootElement(), draw)
    
    function resetOtherTicks(currentTick)
    	for i,v in pairs(dummyTicks) do
    		if (currentTick and i ~= currentTick) then
    			dummyTicks[i] = nil
    		end
    	end
    end
    
    function resetAllTicks()
    	for i,v in pairs(dummyTicks) do
    		dummyTicks[i] = nil
    	end
    end
    
    function animate(from, to, easing, duration, endfunction, tick)
    	local now = getTickCount()
    	local change = interpolateBetween(from, 0, 0, to, 0, 0, (now - tick) / duration, easing)
    	if endfunction and now >= tick+duration then
    		endfunction()
    	end
    	return change
    end
    function isMouseInPosition ( x, y, width, height )
    	if ( not isCursorShowing( ) ) then
    		return false
    	end
        local sx, sy = guiGetScreenSize ( )
        local cx, cy = getCursorPosition ( )
        local cx, cy = ( cx * sx ), ( cy * sy )
        if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then
            return true
        else
            return false
        end
    end

    im not sure if its the best way but it works

  11. showCursor(true)
    local screenW, screenH = guiGetScreenSize()
    outputChatBox(((screenH - 268) / 2))
    local positions = {
    {50, (screenH - 268) / 2, animation = "Linear", duration = 800}, -- Main Menu 1
    {-200, 240, animation = "Linear", duration = 800}, -- Dev Label 2
    }
    local start = getTickCount()
    function draw()
    	for i,pos in pairs(positions) do
    		positions[i].moving = animate(pos[1], pos[2], pos.animation, pos.duration, function () end)
    	end
    	dxDrawRectangle((screenW - 386) / 2, positions[1].moving, 386, 268, tocolor(13, 23, 26, 178), false)
    	dxDrawText("Welcome to the server!", 447, (positions[2].moving), 833, 253, tocolor(0,0,0, 255), 0.90, "default-bold", "center", "center", false, false, false, false, false)
    	dxDrawText("Username :", 468, (positions[1].moving+18), 531, 302, tocolor(0,0,0, 255), 1.00, "default", "left", "top", false, false, false, false, false)
    end
    addEventHandler( "onClientRender", getRootElement(), draw)
    function animate(from, to, easing, duration, endfunction)
    	local now = getTickCount()
    	local change = interpolateBetween(from, 0, 0, to, 0, 0, (now - start) / duration, easing)
    	if endfunction and now >= start+duration then
    		endfunction()
    	end
    	return change
    end
    function isMouseInPosition ( x, y, width, height )
    	if ( not isCursorShowing( ) ) then
    		return false
    	end
        local sx, sy = guiGetScreenSize ( )
        local cx, cy = getCursorPosition ( )
        local cx, cy = ( cx * sx ), ( cy * sy )
        if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then
            return true
        else
            return false
        end
    end

    this is just an example but u could do this to prevent things from out-of sync

    the point in this code is instead of animating every item (button, label, edit) you animate the window then adding to the Y of the animated Window the position of y i gave an example in code

  12. 
    showCursor(true)
    
    local screenW, screenH = guiGetScreenSize()
    
    local positions = {
    {0, (screenH - 268) / 2, animation = "Linear", duration = 800}, -- Main Menu 1
    {-200, 240, animation = "Linear", duration = 800}, -- Dev Label 2
    {50, 284, animation = "Linear", duration = 800}, -- Username Label 3
    {135, 356, animation = "Linear", duration = 800}, -- Password Label 4
    {78, 306, animation = "Linear", duration = 800}, -- Username Editbox 5
    {160, 378, animation = "Linear", duration = 800}, -- Password Editbox 6
    {86, 312, animation = "Linear", duration = 800}, -- Username Text 7
    {170, 384, animation = "Linear", duration = 800}, -- Password Text 8
    {8, 423, animation = "Linear", duration = 800}, -- Remember Details Label 9
    {215, 423, animation = "Linear", duration = 800}, -- Remember Details Checkbox 10
    {240, 448, animation = "Linear", duration = 800}, -- Automated Login Label 11
    {35, 448, animation = "Linear", duration = 800}, -- Automated Login Checkbox 12
    {220, 436, animation = "Linear", duration = 800}, -- Login Text 13
    {10, 435, animation = "Linear", duration = 800}, -- Login Button 14
    {225, 478, animation = "Linear", duration = 800} -- Register an account label 15
    }
    
    local start = getTickCount()
    function draw()
    	for i,pos in pairs(positions) do
    		positions[i].moving = animate(pos[1], pos[2], pos.animation, pos.duration, function () end)
    	end
    	dxDrawRectangle((screenW - 386) / 2, positions[1].moving, 386, 268, tocolor(13, 23, 26, 178), false)
    	dxDrawText("Welcome to the server!", 447, positions[2].moving, 833, 253, tocolor(255, 255, 255, 255), 0.90, "default-bold", "center", "center", false, false, false, false, false)
    	dxDrawText("Username :", 468, positions[3].moving, 531, 302, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false)
    	dxDrawText("Password :", 468, positions[4].moving, 527, 372, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false)
    	dxDrawRectangle(468, positions[5].moving, 345, 28, tocolor(93, 93, 93, 174), false) -- Username Editbox
    	dxDrawRectangle(467, positions[6].moving, 345, 28, tocolor(93, 93, 93, 174), false) -- Password Editbox
    	dxDrawText("Username", 474, positions[7].moving, 807, 325, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
    	dxDrawText("*************", 474, positions[8].moving, 807, 397, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
    	dxDrawText("Automated Login", 492, positions[9].moving, 600, 438, tocolor(255, 255, 255, 255), 1.00, "arial", "left", "center", false, false, false, false, false)
    	dxDrawRectangle(467, positions[10].moving, 15, 15, tocolor(94, 94, 94, 225), false)
    	dxDrawText("Remember Details", 492, positions[11].moving, 600, 438, tocolor(255, 255, 255, 255), 1.00, "arial", "left", "center", false, false, false, false, false)
    	dxDrawRectangle(467, positions[12].moving, 15, 15, tocolor(94, 94, 94, 225), false)	
    	dxDrawRectangle(715, positions[13].moving, 97, 28, tocolor(94, 94, 94, 225), false)
    	dxDrawText("LOGIN", 714, positions[14].moving, 812, 464, tocolor(255, 255, 255, 255), 1.20, "arial", "center", "center", false, false, false, false, false)   
    	dxDrawText("Don't have an account? Register at - www.vigour-gaming.com", 446, positions[15].moving, 833, 494, tocolor(255, 255, 255, 255), 0.80, "arial", "center", "top", false, false, false, false, false)
    	if isMouseInPosition(440, 295, 390, 37) then
    	    local movingX = animate(0, 345, "Linear", 300, function() end)
    		dxDrawRectangle(468, 334, movingX, 1, tocolor(208, 166, 38, 174), false) -- Username Editbox Active
    	end
    	if isMouseInPosition(467, 378, 345, 28) then
    	    local movingX = animate(0, 345, "Linear", 300, function() end)
            dxDrawRectangle(467, 406, movingX, 1, tocolor(208, 166, 38, 174), false) -- Password Editbox Active
    	end
    	if isMouseInPosition(467, 423, 15, 15) then
    	    local movingX = animate(0, 15, "OutQuad", 300, function() end)
            dxDrawRectangle(467, 423, movingX, movingX, tocolor(208, 166, 38, 174), false) -- Checkbox 1 is active?
    	end
    	if isMouseInPosition(467, 448, 15, 15) then
    	    local movingX = animate(0, 15, "OutQuad", 300, function() end)
           	dxDrawRectangle(467, 448, movingX, movingX, tocolor(208, 166, 38, 174), false) -- Checkbox 2 is active?
    	end 
    	if isMouseInPosition(714, 436, 97, 28) then
    	    local movingX = animate(0, 97, "OutQuad", 300, function() end)
    	    local movingY = animate(0, 28, "OutQuad", 300, function() end)
           	dxDrawRectangle(714, 436, movingX, movingY, tocolor(208, 166, 38, 174), false) -- login button is active?
    	end 
    end
    addEventHandler( "onClientRender", getRootElement(), draw)
    
    function animate(from, to, easing, duration, endfunction)
    	local now = getTickCount()
    	local change = interpolateBetween(from, 0, 0, to, 0, 0, (now - start) / duration, easing)
    	if endfunction and now >= start+duration then
    		endfunction()
    	end
    	return change
    end
    
    
    function isMouseInPosition ( x, y, width, height )
    	if ( not isCursorShowing( ) ) then
    		return false
    	end
        local sx, sy = guiGetScreenSize ( )
        local cx, cy = getCursorPosition ( )
        local cx, cy = ( cx * sx ), ( cy * sy )
        if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then
            return true
        else
            return false
        end
    end

    full tested and working

  13. local anims, builtins = {}, {"Linear", "InQuad", "OutQuad", "InOutQuad", "OutInQuad", "InElastic", "OutElastic", "InOutElastic", "OutInElastic", "InBack", "OutBack", "InOutBack", "OutInBack", "InBounce", "OutBounce", "InOutBounce", "OutInBounce", "SineCurve", "CosineCurve"}
    
    function table.find(t, v)
        for k, a in ipairs(t) do
            if a == v then
                return k
            end
        end
        return false
    end
    
    function animate(f, t, easing, duration, onChange, onEnd)
        assert(type(f) == "number", "Bad argument @ 'animate' [expected number at argument 1, got "..type(f).."]")
        assert(type(t) == "number", "Bad argument @ 'animate' [expected number at argument 2, got "..type(t).."]")
        assert(type(easing) == "string" or (type(easing) == "number" and (easing >= 1 or easing <= #builtins)), "Bad argument @ 'animate' [Invalid easing at argument 3]")
        assert(type(duration) == "number", "Bad argument @ 'animate' [expected function at argument 4, got "..type(duration).."]")
        assert(type(onChange) == "function", "Bad argument @ 'animate' [expected function at argument 5, got "..type(onChange).."]")
        table.insert(anims, {from = f, to = t, easing = table.find(builtins, easing) and easing or builtins[easing], duration = duration, start = getTickCount( ), onChange = onChange, onEnd = onEnd})
        return #anims
    end
    
    function destroyAnimation(a)
        if anims[a] then
            table.remove(anims, a)
        end
    end
    
    addEventHandler("onClientRender", root, function( )
        local now = getTickCount( )
        for k,v in ipairs(anims) do
            v.onChange(interpolateBetween(v.from, 0, 0, v.to, 0, 0, (now - v.start) / v.duration, v.easing))
            if now >= v.start+v.duration then
                if type(v.onEnd) == "function" then
                    v.onEnd( )
                end
                table.remove(anims, k)
            end
        end
    end)
    local x = 0
    animate(0, 364, "Linear", 4000, function(movedX) x = movedX end)
    
    function draw()
        dxDrawRectangle(x, 183, 550, 380, tocolor(0, 0, 0, 156), false)
        dxDrawRectangle(364, 563, 550, 4, tocolor(237, 171, 123, 156), false)
        dxDrawRectangle(440, 295, 390, 37, tocolor(216, 213, 213, 254), false)
        dxDrawRectangle(440, 373, 390, 37, tocolor(216, 213, 213, 254), false)
    end
    addEventHandler("onClientRender", root, draw)

    tested and working don't put the animate function with onClientRender and animate returns a table not an int

  14. <meta>
        <script src="s_chat.lua" type="server"/>
    	<export function="meChat" type="server"/>
    </meta>
    -- instead of this
     exports["chat-system"]:meChat(localPlayer, "rolls up the windows of the "..getVehicleName(car)..".")
    -- use this in client
     triggerServerEvent("updateChat", localPlayer, "rolls up the windows of the "..getVehicleName(car)..".")
    -- this in server
    addEvent("updateChat", true)
    addEventHandler("updateChat", root, function(msg)
            exports["chat-system"]:meChat(source, msg)
        end
    )

    try this im not sure tho

  15. what doesn't work and i just cleaned up your code a bit ;( and btw 

       helpTabs = {}
        helphelpTabsPan = {}
        helpLabel = {}
        helpButton = {}
        helpWindow = {}
        helpMemo = {}
    why were u adding tables while u r not using them? from what i saw u were replacing them with variables in ur script if u need i can give u a detailed explanation about how tables work 

    helpGUI = {}
    local screenW, screenH = guiGetScreenSize()
    
    function ShowHelp()
    	-- window
    	helpGUI.window = guiCreateWindow((screenW - 591) / 2, (screenH - 534) / 2, 591, 534, "Information", false)
    	guiWindowSetSizable(helpGUI.window, false)
    	guiSetAlpha(helpGUI.window, 0.92)
    	guiSetProperty(helpGUI.window, "CaptionColour", "FFD7E21C")
    	-- close button and tab panel
    	helpGUI.close = guiCreateButton(485, 489, 96, 35, "Close", false, helpGUI.window)
    	guiSetProperty(helpGUI.close, "NormalTextColour", "FFFE0000")
    	helpGUI.tabpanel = guiCreateTabPanel(9, 28, 572, 461, false, helpGUI.window)
    	-- Rules tab
    	helpGUI.rules = guiCreateTab("Rules", helpGUI.tabpanel)
    	helpGUI.memo1 = guiCreateMemo(6, 32, 561, 399, "Text goes here.", false, helpGUI.rules)
    	helpGUI.label1 = guiCreateLabel(13, 10, 544, 26, "Label text goes here.", false, helpGUI.rules)
    	guiLabelSetColor(helpGUI.label1, 255, 100, 25)
    	-- Commands tab
    	helpGUI.rules = guiCreateTab("Commands", helpGUI.tabpanel)
    	helpGUI.memo2 = guiCreateMemo(5, 32, 561, 399, "Text goes here.", false, helpGUI.rules)
    	helpGUI.label2 = guiCreateLabel(15, 10, 544, 26, "Label text goes here.", false, helpGUI.rules)
    	guiLabelSetColor(helpGUI.label2, 255, 100, 25)
    	-- Buttons tab? wtf weird name ;-;
    	helpGUI.buttons = guiCreateTab("Buttons", helpGUI.tabpanel)
    	helpGUI.memo3 = guiCreateMemo(5, 32, 561, 399, "Text goes here.", false, helpGUI.buttons)  
    end
    addEventHandler( "onClientResourceStart", resourceRoot, ShowHelp)
    
    function guiClose()
    	guiSetVisible(helpWindow, false)
    	showCursor(false)
    end
    addEventHandler("onClientGUIClick", helpGUI.close, guiClose)
    
    -- bind if u want it 
    function bind()
    	guiSetVisible(helpGUI.window, not guiGetVisible(helpGUI.window))
    	showCursor(guiGetVisible(helpGUI.window))
    end
    bindKey("f1", "down", bind)

     

  16. helpGUI = {}
    local screenW, screenH = guiGetScreenSize()
    
    function ShowHelp()
    	-- window
    	helpGUI.window = guiCreateWindow((screenW - 591) / 2, (screenH - 534) / 2, 591, 534, "Information", false)
    	guiWindowSetSizable(helpGUI.window, false)
    	guiSetAlpha(helpGUI.window, 0.92)
    	guiSetProperty(helpGUI.window, "CaptionColour", "FFD7E21C")
    	-- close button and tab panel
    	helpGUI.close = guiCreateButton(485, 489, 96, 35, "Close", false, helpGUI.window)
    	guiSetProperty(helpGUI.close, "NormalTextColour", "FFFE0000")
    	helpGUI.tabpanel = guiCreateTabPanel(9, 28, 572, 461, false, helpGUI.window)
    	-- Rules tab
    	helpGUI.rules = guiCreateTab("Rules", helpGUI.tabpanel)
    	helpGUI.memo1 = guiCreateMemo(6, 32, 561, 399, "Text goes here.", false, helpGUI.rules)
    	helpGUI.label1 = guiCreateLabel(13, 10, 544, 26, "Label text goes here.", false, helpGUI.rules)
    	guiLabelSetColor(helpGUI.label1, 255, 100, 25)
    	-- Commands tab
    	helpGUI.rules = guiCreateTab("Commands", helpGUI.tabpanel)
    	helpGUI.memo2 = guiCreateMemo(5, 32, 561, 399, "Text goes here.", false, helpGUI.rules)
    	helpGUI.label2 = guiCreateLabel(15, 10, 544, 26, "Label text goes here.", false, helpGUI.rules)
    	guiLabelSetColor(helpGUI.label2, 255, 100, 25)
    	-- Buttons tab? wtf weird name ;-;
    	helpGUI.buttons = guiCreateTab("Buttons", helpGUI.tabpanel)
    	helpGUI.memo3 = guiCreateMemo(5, 32, 561, 399, "Text goes here.", false, helpGUI.buttons)  
    end
    addEventHandler( "onClientResourceStart", resourceRoot, ShowHelp)
    
    function guiClose()
    	if source == helpGUI.close then
    		guiSetVisible(helpWindow, false)
    		showCursor(false)
    	end
    end
    addEventHandler( "onClientGUIClick", root, guiClose)
    
    -- bind if u want it 
    function bind()
    	guiSetVisible(helpGUI.window, not guiGetVisible(helpGUI.window))
    	showCursor(guiGetVisible(helpGUI.window))
    end
    bindKey("f1", "down", bind)

    try this i think it will work @kieran

    • Like 1
  17. 56 minutes ago, Psychotic_OZ said:

    Also how do i set timers for commands? say I want it do you can only /nos ever 2 mins and if you /nos within that timefram it says you must wait another <time> seconds

    local status = {}
    
    
    function nos(p, c)
    	if status[p] and status[p].allowed then outputChatBox("You can't do this now",source) return end
    	
    	-- what nos does here
    
    	status[p] = {}
    	status[p].blocked = true
    	status[p].timer = setTimer(function () timer[p].blocked = false end, 2000, 1)
    end

    try this this blocks the command for 2 secs u can increase the time if u want and if u want time to be mentioned u can use https://wiki.multitheftauto.com/wiki/GetTimerDetails

    2 hours ago, Psychotic_OZ said:

    Also is there a way to add a logo/picture to the screen for the server? if yes how?

    https://wiki.multitheftauto.com/wiki/DxDrawImage

  18. local names = {
    	["Admin"] = "Tulajdonos",
    	["Moderator"] = "Moderátor"
    }
    local players = {}
    
    
    function adminuzi(thePlayer, commandName, ...)
    	for i,v in pairs(aclGroupList()) do
    		if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer), v) then
    			if aclGroupGetName(v) == "Everyone" then return end
    			players[thePlayer] = aclGroupGetName(v)
    		end
    	end
    	local message = table.concat({...}, " ")
    	outputChatBox("#0088FF["..players[thePlayer].."]#d8001f  "..getPlayerName(thePlayer)..": "..message,getRootElement(),0,0,0,true)
    end
    addCommandHandler("asay", adminuzi)

     

    • Like 1
  19.  

    3 hours ago, Jusonex said:

    Which version are you on? (press F8 and enter ver)


    Multi Theft Auto v1.5.4-release-11528
    Copyright (C) 2003 - 2016 Multi Theft Auto

  20. is there any chance of getting this bug fixed on the stable version of mta? i mean right now some servers have 0 chances of getting new players because they don't know that they have to update their mta to nightly 

×
×
  • Create New...