AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Unapproved/Old Plugins (https://forums.alliedmods.net/forumdisplay.php?f=27)
-   -   Stealthy Snipers (https://forums.alliedmods.net/showthread.php?t=306507)

man_s_our 04-03-2018 12:32

Stealthy Snipers
 
1 Attachment(s)
a simple plugin that makes every sniper transparent.
cvars:
sniper_visibility 0-255 // default 100

SkumTomteN 04-04-2018 16:12

Re: Stealthy Snipers
 
Did it take you 1 min to make this plugin?.

You can optimize it alot.
  1. When buying the item, make them invisible then instead of using prethink.
  2. You are using cstrike for no reason at all.
  3. I would use pdata to get weapon id, or use ham_item_deploy and cache id instead.
  4. You're not checking if player is alive or not.

Or, if you want to make a more simple plugin, use atfp.

Please learn a bit more before posting a plugin.

man_s_our 04-04-2018 18:26

Re: Stealthy Snipers
 
Quote:

Originally Posted by SkumTomteN (Post 2586061)
When buying the item, make them invisible then instead of using prethink.

it's possible that the player pickup the sniper or drop it. that's why I used prethink.

41aaa41 06-19-2019 09:54

Re: Stealthy Snipers
 
Hello
I have a suggestion
I think if Sniperla stays still for three seconds, it'il be invisible.
Which one is invisible.
0 visible = 255 invisible
Thx
note : I am blind person ....

edon1337 06-19-2019 15:12

Re: Stealthy Snipers
 
Quote:

Originally Posted by man_s_our (Post 2586081)
it's possible that the player pickup the sniper or drop it. that's why I used prethink.

There is pick-up and drop events.

thEsp 06-19-2019 16:07

Re: Stealthy Snipers
 
There is a possibility of player carrying two different snipers. If someone was to drop one sniper out of two or more, plugin would break. So checking if player is currently using sniper is a way better idea.

wilianmaique 06-19-2019 19:29

Re: Stealthy Snipers
 
use CurWeapon better than preThink.

Code:

#include <amxmodx>
#include <fun>

#define PLUGIN "Stealthy Sniper"
#define VERSION "1.0"
#define AUTHOR "man_s_our"

new trans

public plugin_init()
{
        register_plugin(PLUGIN, VERSION, AUTHOR)

        trans = register_cvar("sniper_visibility" , "100")

        register_event("CurWeapon", "xCurWeapon", "be", "1=1")
}

public xCurWeapon(id)
{
        static weapon

        weapon = get_user_weapon(id)

        if(is_user_alive(id) && (weapon == CSW_AWP || weapon == CSW_SG550 || weapon == CSW_SCOUT || weapon == CSW_G3SG1))
                set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, get_pcvar_num(trans))
        else
                set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 255)
}


HamletEagle 06-29-2019 12:02

Re: Stealthy Snipers
 
As stated before, the code can be improved.

Unapproved because the section needs cleaning. If you decide to improve and add more features, PM me.

simanovich 06-29-2019 15:01

Re: Stealthy Snipers
 
@wilianmaique


Use Ham_Item_Deploy


All times are GMT -4. The time now is 16:26.

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