legoman0404 / evolvemod

Automatically exported from code.google.com/p/evolvemod
0 stars 0 forks source link

!slap addon #317

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I liked it where when u slapped someone it hit them in the air a little maybe 
you could change it so it would be like !slap [Damage] [Amount]

Original issue reported on code.google.com by nubm...@gmail.com on 20 Mar 2011 at 2:30

GoogleCodeExporter commented 9 years ago
function ulx.whip( calling_ply, target_plys, times, dmg )
    local affected_plys = {}

    for i=1, #target_plys do
        local v = target_plys[ i ]

        if v.whipped then
            ULib.tsayError( calling_ply, v:Nick() .. " is already being whipped by " .. v.whippedby, true )
        elseif v:IsFrozen() then
            ULib.tsayError( calling_ply, v:Nick() .. " is frozen!", true )
        else
            local dtime = 0
            v.whipped = true
            v.whippedby = calling_ply:IsValid() and calling_ply:Nick() or "(Console)"
            v.whipcount = 0
            v.whipamt = times

            timer.Create( "ulxWhip" .. v:EntIndex(), 0.5, 0, function() -- Repeat forever, we have an unhooker inside.
                if not v:IsValid() then timer.Remove( "ulxWhip" .. v:EntIndex() ) return end  -- Gotta make sure they're still there since this is a timer.
                if v.whipcount == v.whipamt or not v:Alive() then
                    v.whipped = nil
                    v.whippedby = nil
                    v.whipcount = nil
                    v.whipamt = nil
                    timer.Remove( "ulxWhip" .. v:EntIndex() )
                else
                    ULib.slap( v, dmg )
                    v.whipcount = v.whipcount + 1
                end
            end )

            table.insert( affected_plys, v )
        end
    end

    ulx.fancyLogAdmin( calling_ply, "#A whipped #T #i times with #i damage", affected_plys, times, dmg )
end
local whip = ulx.command( CATEGORY_NAME, "ulx whip", ulx.whip, "!whip" )
whip:addParam{ type=ULib.cmds.PlayersArg }
whip:addParam{ type=ULib.cmds.NumArg, min=2, max=100, default=10, hint="times", 
ULib.cmds.optional, ULib.cmds.round }
whip:addParam{ type=ULib.cmds.NumArg, min=0, default=0, hint="damage", 
ULib.cmds.optional, ULib.cmds.round }
whip:defaultAccess( ULib.ACCESS_ADMIN )
whip:help( "Slaps target(s) x times with given damage each time." )

This would work if you had ULib with it too....

Original comment by robinr...@gmail.com on 7 Oct 2011 at 10:54

GoogleCodeExporter commented 9 years ago
addons/evolve/lua/ev_plugins sh_slap.lua

its already there

Original comment by Darkassa...@gmail.com on 6 Jan 2012 at 1:24