1. Post #1
    StormFusions's Avatar
    June 2014
    37 Posts
    Hey guys I've created a RTD system that goes great with any gamemode and is working for the current Gmod build.

    Features
    Custom global message
    Custom local message
    Custom chat commands for anyone
    Preset of results for the RTD system
    Delay timer to stop you spamming the command
    Config for the chat messages and timer



    Commands
    !rtd
    !rtd reset (For Super Admins only)

    Other
    There is a way to add your own results to the RTD, to go into the RTDResults.lua and add your own code anywhere you like make sure to name the function and add it to the table at the bottom of the script.

    Example:
    Code:
    local function Rocket(ply)
        ply:SetGroundEntity(NULL)
        ply:SetVelocity(Vector(0, 0, 1000))
        ply:EmitSound(Sound("weapons/rpg/rocketfire1.wav"))
        
        timer.Simple(1, function()
            if not ply:Alive() then return end
        
            local effectdata = EffectData()
            effectdata:SetStart(ply:GetPos())
            effectdata:SetOrigin(ply:GetPos())
            effectdata:SetScale(3)
            util.Effect("HelicopterMegaBomb", effectdata)
    
    
            ply:EmitSound("ambient/explosions/explode_1.wav", 100, 100)
            ply:Kill()
    
    
            RTDGlobalMessage(ply, " has been rocketed into the air!")
        end)
    end
    
    RTD.Result = {
            Rocket,
    }
    This is a simple addon that will work with all gamemodes, also I've created a Deathrun version of this addon which will be available below! The only difference in the Deathrun version of the addon is that deaths can't use the command! Hope you guys enjoy the script!

    Download
    Original RTD: Here
    Deathrun RTD: Here
    Reply With Quote Edit / Delete Reply Windows 10 Chrome Show Events Dumb Dumb x 1Useful Useful x 1 (list)

  2. Post #2

    October 2014
    834 Posts
    You should be using IsValid in the timer.
    Reply With Quote Edit / Delete Reply Windows 10 Chrome Show Events Agree Agree x 2 (list)

  3. Post #3

    December 2011
    72 Posts
    why if the player is alive meaning its valid.
    i cant find a reason for player alive to be true and valid false.....

  4. Post #4

    October 2014
    834 Posts
    why if the player is alive meaning its valid.
    i cant find a reason for player alive to be true and valid false.....
    If the player is not valid, :Alive will error. You can't check if something is alive if it doesn't exist. That 1 second delay in the timer is enough time for the player to disconnect, for example. If the player disconnects from the server, they don't exist anymore, and thus, are not valid.
    Reply With Quote Edit / Delete Reply Windows 10 Chrome Show Events Disagree Disagree x 1 (list)

  5. Post #5
    Dennab
    April 2016
    225 Posts
    why if the player is alive meaning its valid.
    i cant find a reason for player alive to be true and valid false.....
    Code:
    if !IsValid( ply ) then return end
    If the player does leave in that second that the timer's delayed for, then it's trying to use ply:Alive() on an invalid player, creating an error. It returns true if the player's alive and returns false if the player's dead; it is NOT an alternative for IsValid().

  6. Post #6

    December 2011
    72 Posts
    If the player is not valid, :Alive will error. You can't check if something is alive if it doesn't exist. That 1 second delay in the timer is enough time for the player to disconnect, for example. If the player disconnects from the server, they don't exist anymore, and thus, are not valid.
    i see didnt account for the timer delay ;p