AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   if hit user else (https://forums.alliedmods.net/showthread.php?t=245786)

monkey. 08-06-2014 22:03

if hit user else
 
Hello, i need something like this

if dont hit user(id){
screen fade(id)
}
else{
nothing happens
}

i have the code for screen fade but i dont know how to do the if hit enemy thing

fysiks 08-07-2014 00:29

Re: if hit user else
 
You'll need to explain in more detail regarding what you want (don't use any code to describe it).

If I had to guess, you would need to hook Ham_TakeDamage and process information from there.

monkey. 08-07-2014 07:58

Re: if hit user else
 
Well i need the users screen to fade if he shoots somewhere randomly, but when he hits someone from the enemies then his screen wont fade.

Decak 08-07-2014 08:09

Re: if hit user else
 
Register Client PreThink, define Button and use someone like this:
Code:

if(Button == FIRE) {
set_fade...


fysiks 08-07-2014 08:43

Re: if hit user else
 
Quote:

Originally Posted by monkey. (Post 2180274)
Well i need the users screen to fade if he shoots somewhere randomly, but when he hits someone from the enemies then his screen wont fade.

But what if he is close but still misses?

Quote:

Originally Posted by Decak (Post 2180279)
Register Client PreThink, define Button and use someone like this:
Code:

if(Button == FIRE) {
set_fade...


There are much better ways to determine when someone shoots. This method is bad (and wrong).

monkey. 08-07-2014 09:08

Re: if hit user else
 
Like it doesnt matter how far or close he is, if he doesnt hit anyone then screen fades but if hits enemy then doesnt fade

Decak 08-07-2014 10:30

Re: if hit user else
 
@fysiks no only this code, this need some checks...

monkey. 08-24-2014 07:00

Re: if hit user else
 
Could someone help with this then? I am not the best coder.

HamletEagle 08-24-2014 07:25

Re: if hit user else
 
Quote:

Originally Posted by Decak (Post 2180339)
@fysiks no only this code, this need some checks...

Still a bad ideea.

Since you are in scripting help forum, don't expect that you will receive already made code. You can send a trace and check it's results. If the trace don't hit a player from the enemy team, fade screen.


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

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