Senior Member
|
06-29-2016
, 11:58
Re: Sandman
|
#10
|
Quote:
Originally Posted by heliumdream
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.
__________________
ANY SCRIPTER ON THIS FORUM HAS FREE VIP/ADMIN IN MY SERVER!
|
|