Senior Member
|
06-27-2016
, 14:15
Re: Sandman
|
#8
|
Quote:
Originally Posted by heliumdream
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
__________________
ANY SCRIPTER ON THIS FORUM HAS FREE VIP/ADMIN IN MY SERVER!
Last edited by New and Clueless; 06-28-2016 at 06:17.
|
|