AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Heroes (https://forums.alliedmods.net/forumdisplay.php?f=51)
-   -   Sandman (https://forums.alliedmods.net/showthread.php?t=30080)

Freecode 07-18-2004 02:44

Sandman
 
1 Attachment(s)
Sandman (formerly the Hero plugin Quicksand)

Description
Quicksand - Use +power key on Enemy in crosshair to Trap them in Quicksand

http://www.thekingpin.net/adminspace/vittu/sandman.jpg

http://en.marveldatabase.com/William_Baker_(Earth-616)

shconfig.cfg CVARS
Code:

//Sandman
sandman_level 9
sandman_cooldown 20                //Seconds before you can use quicksand again (Default 20)


Tassadarmaster 04-29-2005 22:46

anyone still working on this hero? cuz there are some native errors

kanu | DarkPredator 04-29-2005 22:49

well this is freecode's hero, so if hes wants to update it he can, i took a quick look at the code, and it seems what it does is buries you in the ground, except at one point bury is spelled "burry" with two r's maybe that's your problem. there is an amx_bury command ive seen and use on my server which could do this pretty well maybe ill take a crack at updating it.

S!LverBulleT 04-29-2005 23:02

This worked for me when i compiled it for amxx.

OSAKA35 06-17-2010 07:06

Re: Sandman
 
freecode please.

it doesnt found for me.

New and Clueless 06-21-2016 17:56

Re: Sandman
 
any way to make this reset back to normal? for example, after 5 seconds player will go back up from ground and be able to walk around.

heliumdream 06-27-2016 10:30

Re: Sandman
 
i didn't compile and test this, but i did make the code changes.
arguably it was fine the way it was. this is good punishment for not having a hero to counter with - like blink, shadowcat or the phasing matrix twins.

Code:

Check the last post in the thread for the latest code

New and Clueless 06-27-2016 14:15

Re: Sandman
 
Quote:

Originally Posted by heliumdream (Post 2431118)
i didn't compile and test this, but i did make the code changes.
arguably it was fine the way it was. this is good punishment for not having a hero to counter with - like blink, shadowcat or the phasing matrix twins.

Code:

// SANDMAN! - from Marvel Comics, possesses the ability to convert all or part of his body into a sand-like substance by mental command.

/* CVARS - copy and paste to shconfig.cfg

//Sandman
sandman_level 9
sandman_cooldown 20                //Seconds before you can use quicksand again (Default 20)
sandman_duration 5

*/


/*
* v1.2 - heliumdream - 6/27/2016
*        - added sandman_duration cvar
*        - created 'unsink' and 'unsink_effects' functions, basically reversing the existing sink and sink_effects.
*/

/*
* v1.1 - vittu - 4/2/06
*      - Re-coded and cleaned up.
*      - Renamed to Sandman since it fits better.
*      - Added extra checks preventing from being buried too far
*          and to make sure user is buryable able.
*      - Changed cooldown to only set if you bury someone.
*      - Removed ability to bury team mates.
*
*  Hero Originally named Quicksand created by Freecode.
*/


#include <amxmod>
#include <Vexd_Utilities>
#include <superheromod>

#if defined AMX98
        #define FL_ONGROUND (1<<9) //Only for the constant
#endif

// GLOBAL VARIABLES
new HeroName[]="Sandman"
new bool:HasSandman[SH_MAXSLOTS+1]
new MSGSetFOV
//----------------------------------------------------------------------------------------------
public plugin_init()
{
        // Plugin Info
        register_plugin("SUPERHERO Sandman", "1.1", "Freecode/vittu")

        // DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
        register_cvar("sandman_level", "9")
        register_cvar("sandman_cooldown", "20")
        register_cvar("sandman_duration", "5")

        // FIRE THE EVENT TO CREATE THIS SUPERHERO!
        shCreateHero(HeroName, "Quicksand", "Use +power key on Enemy in crosshair to Trap them in Quicksand", true, "sandman_level")

        // REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)
        // INIT
        register_srvcmd("sandman_init", "sandman_init")
        shRegHeroInit(HeroName, "sandman_init")

        // KEY DOWN
        register_srvcmd("sandman_kd", "sandman_kd")
        shRegKeyDown(HeroName, "sandman_kd")

        // NEW SPAWN
        register_event("ResetHUD", "newSpawn", "b")

        // Sets field of view
        MSGSetFOV = get_user_msgid("SetFOV")
}
//----------------------------------------------------------------------------------------------
public sandman_init()
{
        // First Argument is an id
        new temp[6]
        read_argv(1,temp,5)
        new id = str_to_num(temp)

        // 2nd Argument is 0 or 1 depending on whether the id has the hero
        read_argv(2, temp, 5)
        new hasPowers = str_to_num(temp)

        switch(hasPowers)
        {
                case true:
                        HasSandman[id] = true

                case false:
                        HasSandman[id] = false
        }
}
//----------------------------------------------------------------------------------------------
public newSpawn(id)
{
        if ( task_exists(id) )
                remove_task(id)

        gPlayerUltimateUsed[id] = false
}
//----------------------------------------------------------------------------------------------
public sandman_kd()
{
        if ( !hasRoundStarted() )
                return

        // First Argument is an id
        new temp[6]
        read_argv(1, temp, 5)
        new id = str_to_num(temp)

        if ( !is_user_alive(id) || !HasSandman[id] )
                return

        if ( gPlayerUltimateUsed[id] )
        {
                playSoundDenySelect(id)
                return
        }

        quicksand(id)
}
//----------------------------------------------------------------------------------------------
public quicksand(id)
{
        if ( !shModActive() || !is_user_alive(id) || !HasSandman[id] )
                return

        new targetid, body
        get_user_aiming(id, targetid, body)

        if ( !is_user_alive(targetid) || get_user_team(id) == get_user_team(targetid) )
                targetid = 0

        switch(targetid)
        {
                case 0:
                {
                        client_print(id, print_center, "[SH](%s) No target found", HeroName)
                        playSoundDenySelect(id)
                        return
                }

                default:
                {
                        // Get origin at this point so if they move it will keep them in the same spot
                        new origin[3]
                        get_user_origin(targetid, origin)

                        new Float:testOrigin[3]
                        IVecFVec(origin, testOrigin)

                        if ( PointContents(testOrigin) == -2 )
                        {
                                client_print(id, print_center, "[SH](%s) Target already in Quicksand", HeroName)
                                playSoundDenySelect(id)
                                return
                        }

                        if ( !(Entvars_Get_Int(targetid, EV_INT_flags)&FL_ONGROUND) )
                        {
                                client_print(id, print_center, "[SH](%s) Target not on ground", HeroName)
                                playSoundDenySelect(id)
                                return
                        }

                        new Float:cooldown = get_cvar_float("sandman_cooldown")
                        if ( cooldown > 0.0 )
                                ultimateTimer(id, cooldown)

                        sinking_effects(id, targetid)

                        new params[6]
                        params[0] = origin[0]
                        params[1] = origin[1]
                        params[2] = origin[2]
                        params[3] = targetid
                        params[4] = id
                        params[5] = 40

                        sink(params)
                }
        }
}
//----------------------------------------------------------------------------------------------
public sink(params[])
{
        new targetid = params[3]
        new id = params[4]

        if ( shModActive() && is_user_connected(id) && HasSandman[id] && is_user_alive(targetid) && params[5] > 0 )
        {
                // Causes this function to repeat until it equals 0
                --params[5]

                new origin[3]
                origin[0] = params[0]
                origin[1] = params[1]
                origin[2] = --params[2]

                set_user_origin(targetid, origin)

                set_task(0.1, "sink", id, params, 6)
        }
        else
        {
                new Float:duration = get_cvar_float("sandman_cooldown")
                set_task(duration, "unsink", id, params, 6)
        }
}
//----------------------------------------------------------------------------------------------
public unsink(parameters[])
{
        new targetid = params[3]
        new id = params[4]       

        new origin[3]
        origin[0] = params[0]
        origin[1] = params[1]
        origin[2] = params[2]       

        set_user_origin(targetid, origin)

        unsink_effects(id, targetid)
}
//----------------------------------------------------------------------------------------------
public sinking_effects(id, targetid)
{
        if ( !shModActive() || !is_user_connected(id) || !is_user_alive(targetid) || !HasSandman[id] )
                return

        new targname[32], idname[32]
        get_user_name(targetid, targname, 31)
        get_user_name(id, idname, 31)

        set_hudmessage(46, 139, 87, -1.0, 0.24, 0, 1.0, 4.0, 0.0, 0.0, 6)
        show_hudmessage(id, "%s has been cought in your Quicksand", targname)
        show_hudmessage(targetid, "You have been cought in %s's Quicksand", idname)

        set_user_rendering(targetid, kRenderFxGlowShell, 255, 222, 173, kRenderNormal, 12)

        // Set targets field of view
        message_begin(MSG_ONE, MSGSetFOV, {0,0,0}, targetid)
        write_byte(135)
        message_end()
}
//----------------------------------------------------------------------------------------------
public unsink_effects(id, targetid)
{
        new targname[32], idname[32]
        get_user_name(targetid, targname, 31)
        get_user_name(id, idname, 31)

        set_hudmessage(46, 139, 87, -1.0, 0.24, 0, 1.0, 4.0, 0.0, 0.0, 6)
        show_hudmessage(id, "%s has been released from your Quicksand", targname)
        show_hudmessage(targetid, "You have been released from %s's Quicksand", idname)

        set_user_rendering(targetid,kRenderFxGlowShell,0,0,0,kRenderNormal,25)       
}a


Thanks dude, here are errors:

Code:

//// sh_b_sandman.sma
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmod
x\scripting\sh_b_sandman.sma(215) : error 017: undefined symbol "params"
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmod
x\scripting\sh_b_sandman.sma(215) : warning 215: expression has no effect
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmod
x\scripting\sh_b_sandman.sma(215) : error 001: expected token: ";", but found "]
"
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmod
x\scripting\sh_b_sandman.sma(215) : error 029: invalid expression, assumed zero
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmod
x\scripting\sh_b_sandman.sma(215) : fatal error 107: too many error messages on
one line
//
// Compilation aborted.
// 4 Errors.
// Could not locate output file compiled\sh_b_sandman.amx (compile failed).
//
// Compilation Time: 0.34 sec
// ----------------------------------------

edit: do you think its possible to make it so only 1 time per 30 sec sandman is able to be used on the person, for example if enemy use sandman on him, they can not keep using sandman over and over even if its from a different person, they have to wait 30 sec

heliumdream 06-28-2016 14:38

Re: Sandman
 
sorry buddy, i loaded up my compiler.

i forgot i renamed one of the 'params' arrays to 'parameters' for clarity. i didnt test it on my server, but it compiles fine now.

as far as your request to flag a player...takes me longer to explain it than to code it so...i just went ahead and did it.
enjoy the version 1.3 attached file. it also compiles fine but is untested.

Code:

Check the last post in the thread for the latest code

New and Clueless 06-29-2016 11:58

Re: Sandman
 
Quote:

Originally Posted by heliumdream (Post 2431572)
sorry buddy, i loaded up my compiler.

i forgot i renamed one of the 'params' arrays to 'parameters' for clarity. i didnt test it on my server, but it compiles fine now.

as far as your request to flag a player...takes me longer to explain it than to code it so...i just went ahead and did it.
enjoy the version 1.3 attached file. it also compiles fine but is untested.

Code:

/* !!!! - newer version added as an attachment - !!!!*/

// SANDMAN! - from Marvel Comics, possesses the ability to convert all or part of his body into a sand-like substance by mental command.

/* CVARS - copy and paste to shconfig.cfg

//Sandman
sandman_level 9
sandman_cooldown 20                //Seconds before you can use quicksand again (Default 20)
sandman_duration 5

*/


/*
* v1.2 - heliumdream - 6/27/2016
*        - added sandman_duration cvar
*        - created 'unsink' and 'unsink_effects' functions, basically reversing the existing sink and sink_effects.
*/

/*
* v1.1 - vittu - 4/2/06
*      - Re-coded and cleaned up.
*      - Renamed to Sandman since it fits better.
*      - Added extra checks preventing from being buried too far
*          and to make sure user is buryable able.
*      - Changed cooldown to only set if you bury someone.
*      - Removed ability to bury team mates.
*
*  Hero Originally named Quicksand created by Freecode.
*/


#include <amxmod>
#include <Vexd_Utilities>
#include <superheromod>

#if defined AMX98
        #define FL_ONGROUND (1<<9) //Only for the constant
#endif

// GLOBAL VARIABLES
new HeroName[]="Sandman"
new bool:HasSandman[SH_MAXSLOTS+1]
new MSGSetFOV
//----------------------------------------------------------------------------------------------
public plugin_init()
{
        // Plugin Info
        register_plugin("SUPERHERO Sandman", "1.1", "Freecode/vittu")

        // DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
        register_cvar("sandman_level", "9")
        register_cvar("sandman_cooldown", "20")
        register_cvar("sandman_duration", "5")

        // FIRE THE EVENT TO CREATE THIS SUPERHERO!
        shCreateHero(HeroName, "Quicksand", "Use +power key on Enemy in crosshair to Trap them in Quicksand", true, "sandman_level")

        // REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)
        // INIT
        register_srvcmd("sandman_init", "sandman_init")
        shRegHeroInit(HeroName, "sandman_init")

        // KEY DOWN
        register_srvcmd("sandman_kd", "sandman_kd")
        shRegKeyDown(HeroName, "sandman_kd")

        // NEW SPAWN
        register_event("ResetHUD", "newSpawn", "b")

        // Sets field of view
        MSGSetFOV = get_user_msgid("SetFOV")
}
//----------------------------------------------------------------------------------------------
public sandman_init()
{
        // First Argument is an id
        new temp[6]
        read_argv(1,temp,5)
        new id = str_to_num(temp)

        // 2nd Argument is 0 or 1 depending on whether the id has the hero
        read_argv(2, temp, 5)
        new hasPowers = str_to_num(temp)

        switch(hasPowers)
        {
                case true:
                        HasSandman[id] = true

                case false:
                        HasSandman[id] = false
        }
}
//----------------------------------------------------------------------------------------------
public newSpawn(id)
{
        if ( task_exists(id) )
                remove_task(id)

        gPlayerUltimateUsed[id] = false
}
//----------------------------------------------------------------------------------------------
public sandman_kd()
{
        if ( !hasRoundStarted() )
                return

        // First Argument is an id
        new temp[6]
        read_argv(1, temp, 5)
        new id = str_to_num(temp)

        if ( !is_user_alive(id) || !HasSandman[id] )
                return

        if ( gPlayerUltimateUsed[id] )
        {
                playSoundDenySelect(id)
                return
        }

        quicksand(id)
}
//----------------------------------------------------------------------------------------------
public quicksand(id)
{
        if ( !shModActive() || !is_user_alive(id) || !HasSandman[id] )
                return

        new targetid, body
        get_user_aiming(id, targetid, body)

        if ( !is_user_alive(targetid) || get_user_team(id) == get_user_team(targetid) )
                targetid = 0

        switch(targetid)
        {
                case 0:
                {
                        client_print(id, print_center, "[SH](%s) No target found", HeroName)
                        playSoundDenySelect(id)
                        return
                }

                default:
                {
                        // Get origin at this point so if they move it will keep them in the same spot
                        new origin[3]
                        get_user_origin(targetid, origin)

                        new Float:testOrigin[3]
                        IVecFVec(origin, testOrigin)

                        if ( PointContents(testOrigin) == -2 )
                        {
                                client_print(id, print_center, "[SH](%s) Target already in Quicksand", HeroName)
                                playSoundDenySelect(id)
                                return
                        }

                        if ( !(Entvars_Get_Int(targetid, EV_INT_flags)&FL_ONGROUND) )
                        {
                                client_print(id, print_center, "[SH](%s) Target not on ground", HeroName)
                                playSoundDenySelect(id)
                                return
                        }

                        new Float:cooldown = get_cvar_float("sandman_cooldown")
                        if ( cooldown > 0.0 )
                                ultimateTimer(id, cooldown)

                        sinking_effects(id, targetid)

                        new params[6]
                        params[0] = origin[0]
                        params[1] = origin[1]
                        params[2] = origin[2]
                        params[3] = targetid
                        params[4] = id
                        params[5] = 40

                        sink(params)
                }
        }
}
//----------------------------------------------------------------------------------------------
public sink(params[])
{
        new targetid = params[3]
        new id = params[4]

        if ( shModActive() && is_user_connected(id) && HasSandman[id] && is_user_alive(targetid) && params[5] > 0 )
        {
                // Causes this function to repeat until it equals 0
                --params[5]

                new origin[3]
                origin[0] = params[0]
                origin[1] = params[1]
                origin[2] = --params[2]

                set_user_origin(targetid, origin)

                set_task(0.1, "sink", id, params, 6)
        }
        else
        {
                new Float:duration = get_cvar_float("sandman_cooldown")
                set_task(duration, "unsink", id, params, 6)
        }
}
//----------------------------------------------------------------------------------------------
public unsink(parameters[])
{
        new targetid = parameters[3]
        new id = parameters[4]       

        new origin[3]
        origin[0] = parameters[0]
        origin[1] = parameters[1]
        origin[2] = parameters[2]       

        set_user_origin(targetid, origin)

        unsink_effects(id, targetid)
}
//----------------------------------------------------------------------------------------------
public sinking_effects(id, targetid)
{
        if ( !shModActive() || !is_user_connected(id) || !is_user_alive(targetid) || !HasSandman[id] )
                return

        new targname[32], idname[32]
        get_user_name(targetid, targname, 31)
        get_user_name(id, idname, 31)

        set_hudmessage(46, 139, 87, -1.0, 0.24, 0, 1.0, 4.0, 0.0, 0.0, 6)
        show_hudmessage(id, "%s has been cought in your Quicksand", targname)
        show_hudmessage(targetid, "You have been cought in %s's Quicksand", idname)

        set_user_rendering(targetid, kRenderFxGlowShell, 255, 222, 173, kRenderNormal, 12)

        // Set targets field of view
        message_begin(MSG_ONE, MSGSetFOV, {0,0,0}, targetid)
        write_byte(135)
        message_end()
}
//----------------------------------------------------------------------------------------------
public unsink_effects(id, targetid)
{
        new targname[32], idname[32]
        get_user_name(targetid, targname, 31)
        get_user_name(id, idname, 31)

        set_hudmessage(46, 139, 87, -1.0, 0.24, 0, 1.0, 4.0, 0.0, 0.0, 6)
        show_hudmessage(id, "%s has been released from your Quicksand", targname)
        show_hudmessage(targetid, "You have been released from %s's Quicksand", idname)

        set_user_rendering(targetid,kRenderFxGlowShell,0,0,0,kRenderNormal,25)       
}


Alright, so I get the message that person was released from quicksand but they are still in quicksand, they couldn't walk until they die.


All times are GMT -4. The time now is 13:32.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.