Jump to content

slotman

Members
  • Posts

    64
  • Joined

  • Last visited

Posts posted by slotman

  1. --[[ 
      
    original script 
      
    viewtopic.php?f=91&t=40132 
      
    I just fix it 
      
    ]] 
    exports.scoreboard:addScoreboardColumn('Online Time') 
      
    local t = { } 
      
    function checkValues( source,arg1,arg2) 
        if (arg2 >= 60) then 
            t[ source ][ 'min' ] = tonumber( t[ source ][ 'min' ] or 0 ) + 1 
            t[ source ][ 'sec' ] = 0 
        end 
        if (arg1 >= 60) then 
            t[ source ][ 'min' ] = 0 
            t[ source ][ 'hour' ] = tonumber( t[ source ][ 'hour' ] or 0 ) + 1 
        end 
        return arg1, arg2 
    end 
          
    setTimer( 
        function( ) 
            for _, v in pairs( getElementsByType( "player" ) ) do 
                if (not t[ v ]) then 
                    t[ v ] = { 
                                ["hour"] = 0, 
                                 ["min"] = 0, 
                                 ["sec"] = 0 
                                } 
                end 
      
                t[ v ][ 'sec' ] = tonumber( t[ v ][ 'sec' ] or 0 ) + 1 
                local min,sec = checkValues ( 
                        v, 
                        t[ v ][ 'min' ] or 0, 
                        t[ v ][ 'sec' ] or 0 
                            )   
        local hour = tonumber( t[ v ][ 'hour' ] or 0 ) 
      
                setElementData( 
                    v, 
                    "Online Time", 
                    tostring( hour )..':'..tostring( min )..':'..tostring( sec ) 
                ) 
            end 
        end, 
        1000, 0 
    ) 
        
    function onPlayerQuit ( ) 
        local playeraccount = getPlayerAccount ( source ) 
        if ( playeraccount ) and not isGuestAccount ( playeraccount ) then 
            local sValue = getElementData( source,'Online Time' ) 
            setAccountData ( playeraccount, "Online Time", tostring(sValue) ) 
        end 
        t[ source ] = nil 
    end 
      
    function onPlayerLogin (_, playeraccount ) 
        if ( playeraccount ) then 
            local time = getAccountData ( playeraccount, "Online Time" ) 
            if ( time ) then 
                setElementData ( source, "Online Time", time ) 
                    else 
                setElementData ( source, "Online Time",0 ) 
            setAccountData ( playeraccount, "Online Time",0 ) 
            end 
        end 
    end 
    addEventHandler ( "onPlayerQuit", root, onPlayerQuit ) 
    addEventHandler ( "onPlayerLogin", root, onPlayerLogin ) 
    

  2. c

    function triggerRespawn() 
    triggerServerEvent ( "respawn", getLocalPlayer() )  
    end 
    addCommandHandler("vhrespawn",triggerRespawn) 
    

    s

    -------------------------------------------------------------------- 
    --* Command vh respawn system *------------------------------------- 
    --* main_s.lua *---------------------------------------------------- 
    --* Made by kimmis *------------------------------------------------ 
    --* Do not fuckin remove this box *--------------------------------- 
    -------------------------------------------------------------------- 
      
    function respawn() 
    local accountname = getAccountName (getPlayerAccount(source)) 
    if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then 
    outputChatBox("15 min") 
    setTimer(function () 
    local vehicles = getElementsByType ( "vehicle" )  
    for k, vehicle in ipairs ( vehicles ) do 
    if checkEmpty( vehicle ) then 
    local seats = getVehicleMaxPassengers(vehicle) 
    resetVehicleIdleTime ( vehicle )  
    respawnVehicle ( vehicle ) 
    end 
    end 
    end, 15000, 1) 
    end  
    end 
    addEvent( "respawn", true ) 
    addEventHandler( "respawn", getRootElement(), respawn ) 
      
    function checkEmpty( vehicle ) 
    local passengers = getVehicleMaxPassengers( vehicle ) 
    if type( passengers ) == 'number' then 
    for seat = 0, passengers do 
    if getVehicleOccupant( vehicle, seat ) then 
    return false 
    end 
    end 
    end 
    return true 
    end 
      
      
    

    *Edit no command to respawn Auto 1 hr

  3. function replaceModel()  
    txd = engineLoadTXD ( "data/Minion.txd" ) 
    engineImportTXD ( txd, 20 ) 
    dff = engineLoadDFF ( "data/Minion.dff", 20 ) 
    engineReplaceModel ( dff, 20 ) 
    end 
    addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), replaceModel) 
    

  4. function spawn(player) 
       if getElementType(player)=="player" then 
          local desiredSkin = getElementData(player, "skinID") 
          if desiredSkin then 
             skinID=desiredSkin 
          else 
             skinID= math.random(9,288) 
          end 
          spawnX = math.random(-691, -671) 
          spawnY = math.random(962, 971) 
          spawnZ = 20 
          repeat 
          until 
          spawnPlayer ( player, spawnX, spawnY, spawnZ, 180, skinID ) 
      
          fadeCamera(player, true) 
          setCameraTarget(player, player) 
       end 
    end 
      
    addEventHandler("onPlayerJoin", root, 
       function() 
          setTimer(function(src) 
             spawn(src) 
          end, 5000, 1, source) 
       end 
    ) 
      
    addEventHandler("onPlayerWasted", root, 
       function() 
          if getElementType(source)=="player" then 
             local tmpID = getPedSkin(source) 
             --outputChatBox(tmpID.."f") 
             setElementData(source,"skinID",tmpID) 
             setTimer(spawn, 5000, 1, source) 
          end 
       end 
    ) 
    

  5. function saveWeaponStats(player) 
        if (not player or not isElement(player)) then return end 
        local account = getPlayerAccount(player) 
        if (account and not isGuestAccount(account)) then 
            local stats = "" 
            for stat=69, 81 do 
                local value = getPedStat(player, stat) 
                stats = stats ..",".. stat ..";".. value 
            end 
            setAccountData(account, "weaponStats", stats) 
        end 
    end 
      
    function loadWeaponStats(player) 
        if (not player or not isElement(player)) then return end 
        local account = getPlayerAccount(player) 
        if (account and not isGuestAccount(account)) then 
            local statsData = getAccountData(account,"weaponStats") 
            local stats = split(statsData, ",") 
            for k, v in ipairs(stats) do 
                local stat = split(v, ";") 
                setPedStat(player, tonumber(stat[1]), tonumber(stat[2])) 
            end 
        end 
    end 
      
    addEventHandler("onPlayerQuit",root,function () saveWeaponStats(source) end) 
    addEventHandler("onPlayerLogin",root,function () loadWeaponStats(source) end) 
    

    onPlayerWasted No saveing

×
×
  • Create New...