AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   New Plugin Submissions (https://forums.alliedmods.net/forumdisplay.php?f=26)
-   -   God Mode On Reload (https://forums.alliedmods.net/showthread.php?t=222271)

Balck 07-31-2013 19:12

God Mode On Reload
 
7 Attachment(s)
*Description
This plugin gives GODMODE to a player when he is reloading his weapon


*CVAR
* amx_godmodeOR 0/1 - Disable/Enable plugin. <default: 1>
* amx_reloadglow 0/1 - Disable/Enable green glow on reload. <default: 1>


*CREDITS
A very big thanks to EpicMonkey for the big help :)

Mauricio Frb 07-31-2013 19:30

Re: God Mode On Reload
 
Suggestion

Code:

public client_PreThink(id)
{
        if(get_pcvar_num(gmreload) == 0)
        {
                return PLUGIN_CONTINUE
        }

        if (!is_user_connected(id))
        {
                return PLUGIN_CONTINUE
        }

        if(get_user_button(id) & IN_RELOAD)
        {
                startgodmode(id)
        }
        return PLUGIN_CONTINUE
}

->>

public client_PreThink(id)
{
        if(!get_pcvar_num(gmreload) || !is_user_connected(id))
                return PLUGIN_HANDLED

        if(get_user_button(id) & IN_RELOAD)
                startgodmode(id)
       
        return PLUGIN_CONTINUE
}


Balck 07-31-2013 19:42

Re: God Mode On Reload
 
Quote:

Originally Posted by Mauricio Frb (Post 2003155)
Suggestion

Code:

public client_PreThink(id)
{
        if(get_pcvar_num(gmreload) == 0)
        {
                return PLUGIN_CONTINUE
        }

        if (!is_user_connected(id))
        {
                return PLUGIN_CONTINUE
        }

        if(get_user_button(id) & IN_RELOAD)
        {
                startgodmode(id)
        }
        return PLUGIN_CONTINUE
}

->>

public client_PreThink(id)
{
        if(!get_pcvar_num(gmreload) || !is_user_connected(id))
                return PLUGIN_HANDLED

        if(get_user_button(id) & IN_RELOAD)
                startgodmode(id)
       
        return PLUGIN_CONTINUE
}


It is the same but ok :S :)

Mauricio Frb 07-31-2013 19:48

Re: God Mode On Reload
 
No, it's more oprimized. (I think)

Jhob94 07-31-2013 19:49

Re: God Mode On Reload
 
Well, you could reduce the amount of lines very, but really very much.
btw i dont think this plugin gonna be approved even if the code be good.

Balck 07-31-2013 19:54

Re: God Mode On Reload
 
Quote:

Originally Posted by Jhob94 (Post 2003164)
Well, you could reduce the amount of lines very, but really very much.
btw i dont think this plugin gonna be approved even if the code be good.

i know it is not so good coded but :S it's working well :)

Jhob94 07-31-2013 20:01

Re: God Mode On Reload
 
Iam just saying to you work on it.
Bad coded? Yes. But you can improve and optimize it ;)
Btw the task time is really correct? Because it wouldnt be much fun to a guy that has godmode shoot me :3

Edit:
Also add cvar to blind while reload.
Or if player wants reload with godmode, needs get blinded, because while reloading he can take the crosshair in enemie to kill him. Also if i see lot of enemies, i can simply reload and run away what isnt fair, so with blind i think it would be fine :)

bibu 07-31-2013 20:12

Re: God Mode On Reload
 
Very nice plugin! Thanks for sharing such a beauty plugin.

YamiKaitou 07-31-2013 21:33

Re: God Mode On Reload
 
Quote:

Originally Posted by Mauricio Frb (Post 2003163)
No, it's more oprimized. (I think)

Actually, it is worse. Don't return PLUGIN_HANDLED in events that you don't want to block

ConnorMcLeod 08-01-2013 05:33

Re: God Mode On Reload
 
Code is redundant, make a table with weapons maxclip and another with weapons reload time, so you don't need this switch statement anymore.
Also, i think reload time you have put are not accurate, where have you found them ?

Last, i'm pretty sure your reload detection method can return false positive, depending on weapon state players could abuse of it.


All times are GMT -4. The time now is 12:58.

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