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

inviswoman getting visible when shooting


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
golem
Junior Member
Join Date: Oct 2004
Location: Hannover
Old 02-08-2007 , 12:48   inviswoman getting visible when shooting
Reply With Quote #1

i think the topic says everything...

inviswoman:
Code:
//INVISIBLE WOMAN! from the Fantastic Four, Sue Richards psionic ability to manipulate ambient cosmic energy enables her to bend light around her body without distortion.

/* CVARS - copy and paste to shconfig.cfg

//Invisible Woman
inviswoman_level 6
inviswoman_alpha 0                //Value of invisiblity 0-invisible 255-completly visible (default=0)
inviswoman_time 5                //# of seconds of invisiblity
inviswoman_cooldown 30        //# of seconds before invisiblity can be used again from keydown

*/

/*
* v1.1 - vittu - 8/8/05
*      - Cleaned up code.
*      - Added cvar for alpha value.
*      - Changed sound from cows "moo" to a heartbeat, very low volume.
*
*/

#include <amxmod>
#include <superheromod>

// GLOBAL VARIABLES
new gHeroName[]="Invisible Woman"
new bool:gHasInvisWomanPower[SH_MAXSLOTS+1]
new gInvisWomanTimer[SH_MAXSLOTS+1]
new gInvisWomanMode[SH_MAXSLOTS+1]
new gAlpha
new gInvisWomanSound[]="player/heartbeat1.wav"
//----------------------------------------------------------------------------------------------
public plugin_init()
{
        // Plugin Info
        register_plugin("SUPERHERO Invisible Woman", "1.1", "Glooba")

        // DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
        register_cvar("inviswoman_level", "6")
        register_cvar("inviswoman_alpha", "0")
        register_cvar("inviswoman_time", "5")
        register_cvar("inviswoman_cooldown", "30")

        // FIRE THE EVENT TO CREATE THIS SUPERHERO!
        shCreateHero(gHeroName, "Invisibility", "Press +power key to become invisible for a short period of time", true, "inviswoman_level")

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

        // KEY DOWN
        register_srvcmd("inviswoman_kd", "inviswoman_kd")
        shRegKeyDown(gHeroName, "inviswoman_kd")

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

        // DEATH
        register_event("DeathMsg", "inviswoman_death", "a")

        // LOOP
        set_task(1.0, "inviswoman_loop", 0, "", 0, "b")
}
//----------------------------------------------------------------------------------------------
public plugin_precache()
{
        precache_sound(gInvisWomanSound)
}
//----------------------------------------------------------------------------------------------
public inviswoman_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
        read_argv(2, temp, 5)
        new hasPowers = str_to_num(temp)

        if ( hasPowers ) {
                // Make sure looop doesn't fire for them
                gInvisWomanTimer[id] = -1
        }
        //This gets run if they had the power but don't anymore
        else if ( gHasInvisWomanPower[id] && gInvisWomanTimer[id] >= 0 ) {
                inviswoman_endmode(id)
        }

        //Sets this variable to the current status
        gHasInvisWomanPower[id] = (hasPowers != 0)
}
//----------------------------------------------------------------------------------------------
public newSpawn(id)
{
        gPlayerUltimateUsed[id] = false
        gInvisWomanTimer[id] = -1
        if ( gHasInvisWomanPower[id] ) {
                inviswoman_endmode(id)
        }
}
//----------------------------------------------------------------------------------------------
// RESPOND TO KEYDOWN
public inviswoman_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) || !gHasInvisWomanPower[id] ) return

        // Make sure they're not in the middle of invisible woman mode
        // Let them know they already used their ultimate if they have
        if ( gPlayerUltimateUsed[id] || gInvisWomanTimer[id] > 0 ) {
                playSoundDenySelect(id)
                return
        }

        gInvisWomanTimer[id] = get_cvar_num("inviswoman_time")
        if (get_cvar_float("inviswoman_cooldown") > 0.0 ) ultimateTimer(id, get_cvar_float("inviswoman_cooldown"))

        gAlpha = get_cvar_num("inviswoman_alpha")
        set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, gAlpha)

        gInvisWomanMode[id] = true

        new message[128]
        format(message, 127, "You have now turned invisible")
        set_hudmessage(50, 50, 255, -1.0, 0.28, 0, 0.0, 1.0, 0.0, 0.0, 54)
        show_hudmessage(id, message)

        emit_sound(id, CHAN_STATIC, gInvisWomanSound, 0.1, ATTN_NORM, 0, PITCH_NORM)
}
//----------------------------------------------------------------------------------------------
public stopSound(id)
{
        new SND_STOP = (1<<5)
        emit_sound(id, CHAN_STATIC, gInvisWomanSound, 0.1, ATTN_NORM, SND_STOP, PITCH_NORM)
}
//----------------------------------------------------------------------------------------------
public inviswoman_loop()
{
        for ( new id = 1; id <= SH_MAXSLOTS; id++ ) {
                if ( gHasInvisWomanPower[id] && is_user_alive(id) ) {
                        if ( gInvisWomanTimer[id] > 0 ) {
                                new message[128]
                                format(message, 127, "%d second%s left of invisibility", gInvisWomanTimer[id], gInvisWomanTimer[id] == 1 ? "" : "s")
                                set_hudmessage(50, 50, 255, -1.0, 0.28, 0, 0.0, 1.0, 0.0, 0.0, 54)
                                show_hudmessage(id, message)

                                set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, gAlpha)

                                gInvisWomanTimer[id]--
                        }
                        else if ( gInvisWomanTimer[id] == 0 ) {
                                        gInvisWomanTimer[id]--
                                        inviswoman_endmode(id)
                        }
                }
        }
}
//----------------------------------------------------------------------------------------------
public inviswoman_endmode(id)
{
        if ( !is_user_connected(id) ) return

        gInvisWomanTimer[id] = -1
        stopSound(id)

        if ( gInvisWomanMode[id]) {
                set_user_rendering(id)
                gInvisWomanMode[id] = false
        }
}
//----------------------------------------------------------------------------------------------
public inviswoman_death()
{
        new id = read_data(2)

        gPlayerUltimateUsed[id] = false

        gInvisWomanTimer[id] = -1

        if (gHasInvisWomanPower[id]) {
                inviswoman_endmode(id)
        }
}
//----------------------------------------------------------------------------------------------
invisman:
Code:
//Invisible Man

/* CVARS - copy and paste to shconfig.cfg

//Invisible Man
invisman_level 0
invisman_alpha 50                //Alpha level when invisible. 0 = invisible, 255 = full visibility.
invisman_delay 5                //Time a player must be still to become invisible
invisman_checkmove 1         //Should movement be checked, or only shooting? 0 = only check shooting

*/

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

#if defined AMX98
        #include <xtrafun>  //Only for the constants, doesn't use any functions
#endif

// VARIABLES
new gHeroName[]="Invisible Man"
new bool:gHasInvisPower[SH_MAXSLOTS+1]
new gIsInvisible[SH_MAXSLOTS+1]
new gStillTime[SH_MAXSLOTS+1]

//----------------------------------------------------------------------------------------------
public plugin_init()
{
        // Plugin Info
        register_plugin("SUPERHERO The Invisible Man","1.1","AssKicR")

        // DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
        register_cvar("invisman_level", "0")
        register_cvar("invisman_alpha", "50")
        register_cvar("invisman_delay", "5")
        register_cvar("invisman_checkmove", "1")

        // FIRE THE EVENT TO CREATE THIS SUPERHERO!
        shCreateHero(gHeroName, "Invisibility", "Makes you less visible and harder to see. Only works while standing/not shooting and not zooming.", false, "invisman_level" )

        // REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)
        register_event("ResetHUD","newRound","b")
        register_event("Damage", "invisman_damage", "b", "2!0")

        // INIT
        register_srvcmd("invisman_init", "invisman_init")
        shRegHeroInit(gHeroName, "invisman_init")

        // CHECK SOME BUTTONS
        set_task(0.1,"checkButtons",0,"",0,"b")
}
//----------------------------------------------------------------------------------------------
public invisman_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 flash
        read_argv(2,temp,5)
        new hasPowers = str_to_num(temp)
        gHasInvisPower[id] = (hasPowers != 0)

        //Give Powers to the Invisible Man
        if ( !gHasInvisPower[id] ) remInvisibility(id)
}
//----------------------------------------------------------------------------------------------
public newRound(id)
{
        remInvisibility(id)
}
//----------------------------------------------------------------------------------------------
public setInvisibility(id, alpha)
{

        if (alpha < 125) {
                set_user_rendering(id,kRenderFxGlowShell,8,8,8,kRenderTransAlpha,alpha)
        }
        else {
                set_user_rendering(id,kRenderFxNone,0,0,0,kRenderTransAlpha,alpha)
        }
}
//----------------------------------------------------------------------------------------------
public remInvisibility(id)
{
        gStillTime[id] = -1

        if (gIsInvisible[id] > 0) {
                shUnglow(id)
                client_print(id,print_center,"[SH]Invisible Man: You are no longer cloaked")
        }

        gIsInvisible[id] = 0
}
//----------------------------------------------------------------------------------------------
public checkButtons()
{
        if ( !hasRoundStarted() || !shModActive()) return

        new bool:setVisible
        new butnprs

        for(new id = 1; id <= SH_MAXSLOTS; id++) {
                if (!is_user_alive(id) || !gHasInvisPower[id]) continue

                setVisible = false
                butnprs = Entvars_Get_Int(id, EV_INT_button)

                //Always check these
                if (butnprs&IN_ATTACK || butnprs&IN_ATTACK2 || butnprs&IN_RELOAD || butnprs&IN_USE) setVisible = true

                //Only check these if invisman_checkmove is off
                if ( get_cvar_num("invisman_checkmove") ) {
                        if (butnprs&IN_JUMP) setVisible = true
                        if (butnprs&IN_FORWARD || butnprs&IN_BACK || butnprs&IN_LEFT || butnprs&IN_RIGHT) setVisible = true
                        if (butnprs&IN_MOVELEFT || butnprs&IN_MOVERIGHT) setVisible = true
                }

                if (setVisible) remInvisibility(id)
                else {
                        new sysTime = get_systime()
                        new delay = get_cvar_num("invisman_delay")

                        if ( gStillTime[id] < 0 ) {
                                gStillTime[id] = sysTime
                        }
                        if ( sysTime - delay >= gStillTime[id] ) {
                                if (gIsInvisible[id] != 100) client_print(id,print_center,"[SH]Invisible Man: 100%s cloaked", "%")
                                gIsInvisible[id] = 100
                                setInvisibility(id, get_cvar_num("invisman_alpha"))
                        }
                        else if ( sysTime > gStillTime[id] ) {
                                new alpha = get_cvar_num("invisman_alpha")
                                new Float:prcnt =  float(sysTime - gStillTime[id]) / float(delay)
                                new rPercent = floatround(prcnt * 100)
                                alpha = floatround(255 - ((255 - alpha) * prcnt) )
                                client_print(id,print_center,"[SH]Invisible Man: %d%s cloaked", rPercent, "%")
                                gIsInvisible[id] = rPercent
                                setInvisibility(id, alpha)
                        }
                }
        }
}
//----------------------------------------------------------------------------------------------
public invisman_damage(id)
{
        if (!shModActive() || !gHasInvisPower[id] ) return
        remInvisibility(id)
}
//----------------------------------------------------------------------------------------------
like invisMAN invisWOMAN should get visible, when the player's shooting... NOT when moving, this would be silly ^^
golem is offline
yang
Veteran Member
Join Date: May 2005
Location: galoreservers.net
Old 02-08-2007 , 15:15   Re: inviswoman getting visible when shooting
Reply With Quote #2

huh?

lets assume I know what you are talking about, ur saying inviswoman becomes visible when shooting. Well, you just answered urself with invisman. If u you have both heroes selected, when you shoot invisman will set ur visibility back to normal.
__________________
yang is offline
Send a message via AIM to yang
golem
Junior Member
Join Date: Oct 2004
Location: Hannover
Old 02-09-2007 , 09:47   Re: inviswoman getting visible when shooting
Reply With Quote #3

i want inviswomen to get visible, when shooting... that's all i think
(invisman should just be a help, because he will get visible when he's shooting!)
but i'm too silly for coding it myself yet :-/
golem is offline
yang
Veteran Member
Join Date: May 2005
Location: galoreservers.net
Old 02-09-2007 , 19:27   Re: inviswoman getting visible when shooting
Reply With Quote #4

inviswoman is messing with invisman o.O we already established that
__________________
yang is offline
Send a message via AIM to yang
D o o m
Veteran Member
Join Date: Sep 2005
Location: Germany
Old 02-10-2007 , 06:09   Re: inviswoman getting visible when shooting
Reply With Quote #5

If I understand golem right, he doesn't talk about problems while using Invisman and -woman.

He just wanna have Inviswoman to get visible while your shooting if you have the hero.
He posted Invisman, because he is doing that and he just used it as an example.
The thing is, he can't do it and so he is asking someone to do it for him.

If I understood it now wrong, I'm sorry.

But it looks like you 2 are talking about 2 different things..
__________________
Heroes
:+: Deadpool :+:
D o o m is offline
golem
Junior Member
Join Date: Oct 2004
Location: Hannover
Old 02-10-2007 , 06:20   Re: inviswoman getting visible when shooting
Reply With Quote #6

Quote:
Originally Posted by D o o m View Post
If I understand golem right, he doesn't talk about problems while using Invisman and -woman.

He just wanna have Inviswoman to get visible while your shooting if you have the hero.
He posted Invisman, because he is doing that and he just used it as an example.
The thing is, he can't do it and so he is asking someone to do it for him.

If I understood it now wrong, I'm sorry.

But it looks like you 2 are talking about 2 different things..
you understood me right ;-)
golem is offline
vittu
SuperHero Moderator
Join Date: Oct 2004
Location: L.A. County, CA
Old 02-10-2007 , 13:32   Re: inviswoman getting visible when shooting
Reply With Quote #7

It does go invisible while shooting, it's timed and will be invisible no matter movement.

His problem with this is as yang stated already. It's invisible man that wants to turn you visible when you shoot. So if you want to be invisible while shooting drop invisible man or any other hero that makes you glow.


If I make it so invisible woman goes invisible when shooting, he is still gonna have a problem with it. Since the reason he wants this is cause he wants it to work with invisible man, but invisible man is still gonna make him visible when he shoots.



You guys need to realize in order to take advantage of one hero some other heroes might cause it not to work the way you want, you need to make a choice on what heores you use. It's called strategy. I will say this though, the alpha value of glowing should be handled by the core to avoid what this guy is complaining of so that lowest always takes precedence. However, doing that would require a timer type of function since it would not be known when to remove it correctly. So this is not really an option.
vittu is offline
Send a message via AIM to vittu Send a message via MSN to vittu Send a message via Yahoo to vittu
D o o m
Veteran Member
Join Date: Sep 2005
Location: Germany
Old 02-10-2007 , 15:59   Re: inviswoman getting visible when shooting
Reply With Quote #8

Err vittu..

He just wanna have Invisman's powers imported to Inviswoman.
Like an Invisman with key down..

He wants Inviswoman to get VISIBLE while you have the hero and while your shooting..

He just showed Invisman because Invisman is doing that and he doesn't know how to change the code of Inviswoman, so Inviswoman does it too..

Is it so hard to understand? :/
__________________
Heroes
:+: Deadpool :+:
D o o m is offline
vittu
SuperHero Moderator
Join Date: Oct 2004
Location: L.A. County, CA
Old 02-10-2007 , 16:04   Re: inviswoman getting visible when shooting
Reply With Quote #9

Yes but why else would he want that unless he is trying to use both heroes, which we are trying to explain that will not work...

Otherwise if you think about it, invisibility while shooting by itself is kinda pointless.

Last edited by vittu; 02-10-2007 at 16:08.
vittu is offline
Send a message via AIM to vittu Send a message via MSN to vittu Send a message via Yahoo to vittu
golem
Junior Member
Join Date: Oct 2004
Location: Hannover
Old 02-11-2007 , 05:20   Re: inviswoman getting visible when shooting
Reply With Quote #10

Quote:
Originally Posted by vittu View Post
Yes but why else would he want that unless he is trying to use both heroes, which we are trying to explain that will not work...

Otherwise if you think about it, invisibility while shooting by itself is kinda pointless.
why??! ^^
inviswoman is just too unfair... i see it on my server, most guys have inviswoman, get invisible und kill you and you don't know where to shoot
i just want inviswoman to get visible when shooting.
would be nice, if someone could code this
golem is offline
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 13:27.


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