• [Release] Role The Dice (RTD) System
    5 replies, posted
Hey guys I've created a RTD system that goes great with any gamemode and is working for the current Gmod build. [U][B]Features[/B][/U] 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 [IMG]http://puu.sh/pDLsR/c5e40dca02.jpg[/IMG] [U][B]Commands[/B][/U] !rtd !rtd reset (For Super Admins only) [U][B]Other[/B][/U] 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. [U][B]Example:[/B][/U] [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, } [/code] 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! [U][B]Download[/B][/U] Original RTD: [URL="http://puu.sh/pDKG6/795f91262c.zip"]Here[/URL] Deathrun RTD: [URL="http://puu.sh/pDKFA/3a8cd3cf2d.zip"]Here[/URL]
You should be using [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/IsValid]IsValid[/url] in the timer.
why if the player is alive meaning its valid. i cant find a reason for player alive to be true and valid false.....
[QUOTE=shipstreet;50605980]why if the player is alive meaning its valid. i cant find a reason for player alive to be true and valid false.....[/QUOTE] 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.
[QUOTE=shipstreet;50605980]why if the player is alive meaning its valid. i cant find a reason for player alive to be true and valid false.....[/QUOTE] [CODE]if !IsValid( ply ) then return end[/CODE] 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().
[QUOTE=man with hat;50606098]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.[/QUOTE] i see didnt account for the timer delay ;p
Sorry, you need to Log In to post a reply to this thread.