AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   getting random damage (https://forums.alliedmods.net/showthread.php?t=188972)

jimaway 07-02-2012 09:36

getting random damage
 
Code:
#include <amxmodx> #include <amxmisc> #include <fakemeta> #define PLUGIN "skating" #define VERSION "1.0" #define AUTHOR "Jim Richardson" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_forward(FM_PlayerPreThink, "PreThink") } public PreThink(id) {         if (fm_distance_to_floor(id) < 4.0) {         new Float:origin[3]         pev(id, pev_origin, origin)         origin[2] += 4         set_pev(id, pev_origin, origin)     } } stock Float:fm_distance_to_floor(index, ignoremonsters = 1) {     new Float:start[3], Float:dest[3], Float:end[3]     pev(index, pev_origin, start)     dest[0] = start[0]     dest[1] = start[1]     dest[2] = -8191.0     engfunc(EngFunc_TraceLine, start, dest, ignoremonsters, index, 0)     get_tr2(0, TR_vecEndPos, end)     pev(index, pev_absmin, start)     new Float:ret = start[2] - end[2]     return ret > 0 ? ret : 0.0 }

why do i keep getting randomly damage when using this?

Exolent[jNr] 07-02-2012 09:37

Re: getting random damage
 
You should set Z velocity to 0 as well.

jimaway 07-02-2012 09:50

Re: getting random damage
 
thanks, the damage part is now fixed, but i keep "jumping" up and down constantly (you can feel the z origin changing), how could i change it so its smoother, something like if youre floating with sv_gravity 0

Exolent[jNr] 07-02-2012 09:51

Re: getting random damage
 
You can set player's gravity to 0.

jimaway 07-02-2012 10:07

Re: getting random damage
 
how would i do that?
http://www.amxmodx.org/funcwiki.php?go=func&id=125
Quote:

Also, be aware 0.0 sets gravity to normal the same as 1.0.

Exolent[jNr] 07-02-2012 11:05

Re: getting random damage
 
0.000001 would work.

EDIT: Also, don't make another topic if you already have this one open.

jimaway 07-02-2012 11:40

Re: getting random damage
 
i made a new topic cause this one has misleading title since the damage thing is already fixed

but can you tell me how many units shorter does player get when hes ducking?

Exolent[jNr] 07-02-2012 11:47

Re: getting random damage
 
18 units difference from ducking and standing.


All times are GMT -4. The time now is 15:11.

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