AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   This does nothing, but should do something... (https://forums.alliedmods.net/showthread.php?t=45850)

hippo.exe 10-13-2006 05:12

This does nothing, but should do something...
 
Code:


public event_limit(id)
{
 new g_hp
 g_hp = get_user_health(id)
 new y = g_damage_taken[id]
 if (y > (g_hp))
 {
  (y = (g_hp))
 }
 return PLUGIN_CONTINUE;
}

Anyone see anything wrong with this... I've compiled this with the rest of the script and it doesnt limit the damage.. any ideas? Thanks all for helping

Silencer123 10-13-2006 07:07

Re: This does nothing, but should do something...
 
It is an Event, not a Forward, also I do not see where you change g_damage_taken.

hippo.exe 10-13-2006 08:05

Re: This does nothing, but should do something...
 
what do you mean?
Quote:

It is an Event, not a Forward, also I do not see where you change g_damage_taken.

Silencer123 10-13-2006 08:27

Re: This does nothing, but should do something...
 
Well it might be wrong what I say. I suggest you ALWAYS give the whole Code.
You got to do so anyways when you are making a Plugin public.

jim_yang 10-13-2006 10:50

Re: This does nothing, but should do something...
 
Quote:

This does nothing, but should do something...
the only thing this function does is giving the temp variable y a value

Rolnaaba 10-13-2006 10:51

Re: This does nothing, but should do something...
 
thats what I thought, since he didnt post all code it seems that y doesn't actually stand for anyhting unless that g_damage_taken[] variable is something he didnt post

Silencer123 10-13-2006 14:25

Re: This does nothing, but should do something...
 
Yeah, learn how to get Help, hippo.exe.
If you only give us ten Lines of a big Plugin
we cannot help you, except those Lines
are completely independent. (Those aren't)
We can't help lazy People.
We won't help dumb People.
(There I make a difference
between dumb and unexperienced)

Hawk552 10-13-2006 16:50

Re: This does nothing, but should do something...
 
I don't think you really understand how this works.

Basically, AMXX will provide you with the information you need to change things, but in order to formally change them you need to call natives.

In this case, you are just copying the information and then leaving it, thus your calculations are not needed. In order to reduce damage, you would have to change the Damage event's parameters, and also call set_user_health (or equivalent).

hippo.exe 10-13-2006 17:15

Re: This does nothing, but should do something...
 
Well... I am a noob.. so Thank you for all your imput guys/gals.


All times are GMT -4. The time now is 04:54.

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