Raised This Month: $51 Target: $400
 12% 

Help with sasuke


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
egbertjan
Senior Member
Join Date: Mar 2007
Location: The Netherlands
Old 01-11-2011 , 07:38   Help with sasuke
Reply With Quote #1

So I got the hero sasuke that was once requested.
I deleted the keydown function and made some adjustments, but now when people pick the hero and drop it they can repick it every time untill they have it (this is also stated in the topic itself) but there never really came any sulotion. Is there something that when people don't have the flag and picked it and drop it they can't repick it untill the next round?

Here is the code:
PHP Code:
/* Requested by GodLike29 */

#include <amxmodx>
#include <amxmisc> 
#include <Vexd_Utilities>
#include <superheromod>

#define PLUGIN "SuperHero Sasuke"
#define VERSION "1.0"
#define AUTHOR "Spider"

new gHeroName[]="Sasuke";
new 
bool:gHasPowers[SH_MAXSLOTS+1];
new 
bool:gSelected[SH_MAXSLOTS+1]
new 
gIsBurning[SH_MAXSLOTS+1];
new 
gSpriteSmokegSpriteFiregSpriteBurning;

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_cvar("sasuke_speed","900");
    
register_cvar("sasuke_hp","1500");
    
register_cvar("sasuke_armor","2000");
    
register_cvar("sasuke_regenhp","50");
    
register_cvar("sasuke_level","0");
    
register_cvar("sasuke_adminflag","a");
    
register_cvar("sasuke_cooldown","0.1");
    
register_cvar("sasuke_burndmg","400");
    
register_cvar("sasuke_numburns","60");
    
    
register_event("ResetHUD","sasuke_res","be");
    
register_event("DeathMsg""sasuke_death""a")
    
    
shCreateHero(gHeroName"GodLike Hero""Speed, FireBall, HP, Armor, Regen"false"sasuke_level" );
    
    
register_srvcmd("sasuke_init""sasuke_init");
    
shRegHeroInit(gHeroName"sasuke_init");
    
    
register_srvcmd("sasuke_kd""sasuke_kd");
    
shRegKeyDown(gHeroName"sasuke_kd");
    
    
shSetMaxSpeed(gHeroName"sasuke_speed","[0]");
    
shSetMaxArmor(gHeroName"sasuke_armor");
    
shSetMaxHealth(gHeroName"sasuke_hp");
}

public 
plugin_precache()
{

}

public 
sasuke_init()
{
    
//if(!cmd_access( id,level,cid,0) && (get_cvar_num("sasuke_adminonly") == 1))
    //    return PLUGIN_HANDLED;
    
    
new temp[6];
    
read_argv(1temp5);
    
    new 
id str_to_num(temp);
    
read_argv(2,temp,5);
    new 
hasPowers str_to_num(temp);
    
gHasPowers[id] = (hasPowers != 0);
    
    
gSelected[id] = gHasPowers[id];
    
    if (
is_user_connected(id)) {
        if (
hasPowers) {
            
sasuke_admincheck(id);
        }
        else {
            
shRemSpeedPower(id);
            
shRemHealthPower(id);
            
shRemArmorPower(id);
        }
    }
    
    
set_task(1.0,"sasuke_loop",0,"",0,"b" );
    
    return 
PLUGIN_HANDLED;
}

public 
sasuke_res(id) { 
    
gIsBurning[id] = 0;
    
stopFireSound(id);
    
sasuke_admincheck(id);
    if (
gHasPowers[id])  {
        
gPlayerUltimateUsed[id] = false;
    }
    
    return 
PLUGIN_CONTINUE;
}
public 
sasuke_death(id) {
    
gIsBurning[id] = 0;
    
stopFireSound(id);
    if ( 
gHasPowers[id] ) {
        
gPlayerUltimateUsed[id] = false;
    }
    return 
PLUGIN_CONTINUE;
}

//START AFTERBURN SCRIPT ---> ALL CREDITS TO AFTERBURN AUTHOR!!!


public sasuke_kd() {
    new 
temp[6];
    
read_argv(1,temp,5);
    new 
id=str_to_num(temp);
    if ( !
is_user_alive(id) || !hasRoundStarted() || !gHasPowers[id] || get_user_team(id) < || get_user_team(id) > 2) return PLUGIN_HANDLED;
    if ( 
Entvars_Get_IntidEV_INT_waterlevel ) == ) {
        
console_print(id,"[SH] You cannot use the Flame Thrower while underwater")
        
playSoundDenySelect(id)
        return 
PLUGIN_HANDLED;
    }
    
    if ( 
gPlayerUltimateUsed[id] ) {
        
playSoundDenySelect(id)
        return 
PLUGIN_HANDLED;
    }
    
    
emit_sound(idCHAN_WEAPON"ambience/flameburst1.wav"1.0ATTN_NORM0PITCH_NORM)
    new 
vec[3]
    new 
aimvec[3]
    new 
velocityvec[3]
    new 
length
    
new speed 10
    get_user_origin
(id,vec)
    
get_user_origin(id,aimvec,2)
    new 
dist get_distance(vec,aimvec)
    
    new 
speed1 160
    
new speed2 350
    
new radius 105
    
    
if (dist 50) {
        
radius 0
        speed 
5
    
}
    else if (
dist 150) {
        
speed1 speed2 1
        speed 
5
        radius 
50
    
}
    else if (
dist 200) {
        
speed1 speed2 1
        speed 
5
        radius 
90
    
}
    else if (
dist 250) {
        
speed1 speed2 90
        speed 
6
        radius 
90
    
}
    else if (
dist 300) {
        
speed1 speed2 140
        speed 
7
    
}
    else if (
dist 350) {
        
speed1 speed2 190
        speed 
7
    
}
    else if (
dist 400) {
        
speed1 150
        speed2 
240
        speed 
8
    
}
    else if (
dist 450) {
        
speed1 150
        speed2 
290
        speed 
8
    
}
    else if (
dist 500) {
        
speed1 180
        speed2 
340
        speed 
9
    
}
    
//Edited
    
else if (dist 1000) {
        
speed1 200
        speed2 
400
        speed 
18
        radius 
150
    
}
    else if (
dist 1000) {
        
speed1 300
        speed2 
500
        speed 
35
        radius 
150
    
}
    
    
velocityvec[0] = aimvec[0] - vec[0]
    
velocityvec[1] = aimvec[1] - vec[1]
    
velocityvec[2] = aimvec[2] - vec[2]
    
length sqrt(velocityvec[0]*velocityvec[0] + velocityvec[1]*velocityvec[1] + velocityvec[2]*velocityvec[2])
    if (!
lengthlength 1
    velocityvec
[0] = velocityvec[0]*speed length
    velocityvec
[1] = velocityvec[1]*speed length
    velocityvec
[2] = velocityvec[2]*speed length
    
    
new args[6]
    
args[0] = vec[0]
    
args[1] = vec[1]
    
args[2] = vec[2]
    
args[3] = velocityvec[0]
    
args[4] = velocityvec[1]
    
args[5] = velocityvec[2]
    
set_task(0.1"te_spray"0args6"a"2)
    
check_burnzone(idvecaimvecspeed1speed2radius)
    
    if (
get_cvar_float("sasuke_cooldown") > 0.0ultimateTimer(idget_cvar_float("sasuke_cooldown"))
    
    return 
PLUGIN_HANDLED;
}

public 
te_spray(args[])
{
    
//TE_SPRAY
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
    
write_byte(120)        // Throws a shower of sprites or models
    
write_coord(args[0])    // start pos
    
write_coord(args[1])
    
write_coord(args[2])
    
write_coord(args[3])    // velocity
    
write_coord(args[4])
    
write_coord(args[5])
    
write_short(gSpriteFire)    // spr
    
write_byte(8)        // count
    
write_byte(70)        // speed
    
write_byte(100)    // (noise)
    
write_byte(5)        // (rendermode)
    
message_end()
}

check_burnzone(idvec[], aimvec[], speed1speed2radius)
{
new 
tbodytid
get_user_aiming
(idtidtbody9999)

if (
tid <= || tid SH_MAXSLOTS) return

if ( 
get_cvar_num("mp_friendlyfire") == ) {
    
burn_victim(tidid)
}
else if ( 
get_user_team(id) != get_user_team(tid) ) {
    
burn_victim(tidid)
}

new 
burnvec1[3],burnvec2[3],length1

burnvec1
[0] = aimvec[0]-vec[0]
burnvec1[1] = aimvec[1]-vec[1]
burnvec1[2] = aimvec[2]-vec[2]

length1 sqrt(burnvec1[0]*burnvec1[0] + burnvec1[1]*burnvec1[1] + burnvec1[2]*burnvec1[2])
if (!
length1length1 1
burnvec2
[0] = burnvec1[0]*speed2 length1
burnvec2
[1] = burnvec1[1]*speed2 length1
burnvec2
[2] = burnvec1[2]*speed2 length1
burnvec1
[0] = burnvec1[0]*speed1 length1
burnvec1
[1] = burnvec1[1]*speed1 length1
burnvec1
[2] = burnvec1[2]*speed1 length1
burnvec1
[0] += vec[0]
burnvec1[1] += vec[1]
burnvec1[2] += vec[2]
burnvec2[0] += vec[0]
burnvec2[1] += vec[1]
burnvec2[2] += vec[2]

new 
origin[3]
for (new 
1<= SH_MAXSLOTSi++){
    if ( 
is_user_alive(i) && != id && ( get_cvar_num("mp_friendly_fire") || get_user_team(id) != get_user_team(i) ) ) {
        
get_user_origin(iorigin)
        if ( 
get_distance(originburnvec1) < radius ) {
            
burn_victim(iid)
        }
        else if ( 
get_distance(originburnvec2) < radius ) {
            
burn_victim(iid)
        }
    }
}
}

public 
burn_victim(idkiller)
{
if ( 
Entvars_Get_IntidEV_INT_waterlevel ) == ) return
if ( 
gIsBurning[id] ) return

gIsBurning[id] = 1

emit_sound
(idCHAN_ITEM"ambience/burning1.wav"1.0ATTN_NORM0PITCH_NORM)

new 
args[3]
args[0] = id
args
[1] = killer
set_task
(0.3"on_fire"451args3"a"get_cvar_num("sasuke_numburns"))
set_task(0.7"fire_scream"0args3)
set_task(5.5"stopFireSound"id)
}

public 
on_fire(args[])
{
new 
id args[0]
new 
killer args[1]

if( !
is_user_connected(id) || !is_user_alive(id) ) {
    
gIsBurning[id] = 0
    
return
}
if( 
Entvars_Get_IntidEV_INT_waterlevel ) == ) {
    
gIsBurning[id] = 0
    
return
}
if (!
gIsBurning[id]) return

new 
rxryrzforigin[3]
rx random_num(-3030)
ry random_num(-3030)
rz random_num(-3030)
get_user_origin(idforigin)

//TE_SPRITE - additive sprite, plays 1 cycle
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
write_byte(17)
write_coord(forigin[0]+rx)    // coord, coord, coord (position)
write_coord(forigin[1]+ry)
write_coord(forigin[2]+10+rz)
write_short(gSpriteBurning)    // short (sprite index)
write_byte(30)                // byte (scale in 0.1's)
write_byte(200)            // byte (brightness)
message_end()

//Smoke
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
write_byte(5)
write_coord(forigin[0]+(rx*2))    // coord, coord, coord (position)
write_coord(forigin[1]+(ry*2))
write_coord(forigin[2]+100+(rz*2))
write_short(gSpriteSmoke)    // short (sprite index)
write_byte(60)                // byte (scale in 0.1's)
write_byte(15)                // byte (framerate)
message_end()

new 
health get_user_health(id)
new 
damage get_cvar_num("sasuke_burndmg")

//Prevents the shExtraDamage from saying you attacked a teammate for every cycle of the loop
if(health damage  <= 0) {
    
shExtraDamage(idkillerdamage"Fire")
}
else {
    
set_user_health(idhealth damage)
    
    
//let them know who is hurting them with a flame
    
new attackerName[32]
    
get_user_name(killerattackerName31)
    
client_print(idprint_chat"[SH]%s is burning you from beyond the grave"attackerName)
}
}

public 
fire_scream(args[])
{
emit_sound(args[0], CHAN_AUTO"scientist/c1a0_sci_catscream.wav"1.0ATTN_NORM0PITCH_NORM)
}

public 
stopFireSound(id)
{
new 
sndStop = (1<<5)
gIsBurning[id] = 0
emit_sound
(idCHAN_ITEM"ambience/burning1.wav"1.0ATTN_NORMsndStopPITCH_NORM)
}

//END AFTERBURN SCRIPT

public sasuke_admincheck(id) {
new 
accessLevel[10];
get_cvar_string("sasuke_adminflag"accessLevel9);
//trim(accessLevel);
console_print(1,"%s",accessLevel);
if (
accessLevel[0] != '0') {
    if (
gSelected[id] && !(get_user_flags(id) & read_flags(accessLevel))) {
        
client_print(idprint_chat"[SH](%s) **Admin Only** You are not authorized to use this hero"gHeroName)
        
gHasPowers[id] = false;
        
client_cmd(id"say drop %s"gHeroName);
        
shRemSpeedPower(id);
        
shRemHealthPower(id);
        
shRemArmorPower(id);
    }
}
}

public 
sasuke_loop() {
new  
players[SH_MAXSLOTS],pnum,id;
get_players(players,pnum,"a")
for (new 
i=0;pnum;i++) {
    
id=players[i];
    if (
gHasPowers[id]) {
        
shAddHPs(idget_cvar_num("sasuke_regenhp"), get_cvar_num("sasuke_hp"));
    }
}

Thanks in advance!
egbertjan is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 01-11-2011 , 08:28   Re: Help with sasuke
Reply With Quote #2

When you drop a hero in SH mod you are able to pick it again right away. That is the way superhero works and you can't change that.

Also with the way you are doing it, if you did so they can't drop heroes while alive, they don't actually drop the hero.
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
egbertjan
Senior Member
Join Date: Mar 2007
Location: The Netherlands
Old 01-11-2011 , 08:33   Re: Help with sasuke
Reply With Quote #3

They can drop the hero when they are alive, but they just repick it because nothing is holding them back to just repick it.
egbertjan is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 01-11-2011 , 08:42   Re: Help with sasuke
Reply With Quote #4

Yes. If they pick it again they should just drop it once again.
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
egbertjan
Senior Member
Join Date: Mar 2007
Location: The Netherlands
Old 01-11-2011 , 09:01   Re: Help with sasuke
Reply With Quote #5

Yes, they drop it but because they still have to select a hero they can repick sasuke. After a few times of picking the hero is like "what ever I will just give him the power then I can rest" and he has the hero.
egbertjan is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 01-11-2011 , 09:24   Re: Help with sasuke
Reply With Quote #6

He doesn't really has the hero.

What happens is that the flood protection in amxx kicks in. The hero itself makes him write "drop sasuke" as a say command. If he starts spamming it, he just get the message "Stop flooding the server!" and then messages wont be printed, which is why it actually is not dropped from the list.

However, the check boolean is set to false which means, even though he has the hero on his hero list he does not have the hero. He is not able to use any of Sasuke's powers.

One way to quicky fix that is to disable the flood protection. I know fr33m@n also made a fix for it, I just can't remember where, you will need to search for that.
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
G-Dog
Senior Member
Join Date: Dec 2005
Location: Thunderstorm Central
Old 01-11-2011 , 09:34   Re: Help with sasuke
Reply With Quote #7

there are 2 methods of dealing with that.
1. after the drop force the player to close the menu
PHP Code:
menu_cancel(player
2. set the hero to not actually do anything for non admins, though superhero thinks they have the hero the plugin itself doesn't
__________________
If at first you don't succeed, then skydiving isn't for you.
G-Dog is offline
Send a message via AIM to G-Dog
egbertjan
Senior Member
Join Date: Mar 2007
Location: The Netherlands
Old 01-11-2011 , 09:50   Re: Help with sasuke
Reply With Quote #8

Quote:
Originally Posted by G-Dog View Post
there are 2 methods of dealing with that.
1. after the drop force the player to close the menu
PHP Code:
menu_cancel(player
2. set the hero to not actually do anything for non admins, though superhero thinks they have the hero the plugin itself doesn't
When they will type showmenu it just pops on again, though I could try this.
egbertjan is offline
egbertjan
Senior Member
Join Date: Mar 2007
Location: The Netherlands
Old 01-11-2011 , 10:14   Re: Help with sasuke
Reply With Quote #9

The player is an undifined symbol. What boolean does it need?
egbertjan is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 01-11-2011 , 10:35   Re: Help with sasuke
Reply With Quote #10

Quote:
Originally Posted by egbertjan View Post
The player is an undifined symbol. What boolean does it need?
It doesn't need any boolean, it needs a player index.

Also, doing this wont fix your problem. The menu will just show again the next round. Though you will get rid of the bug where he can have the hero without actually having it.
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:18.


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