AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   define/register_cvar (https://forums.alliedmods.net/showthread.php?t=89118)

One 04-02-2009 13:16

define/register_cvar
 
Hi,

idk why this not works. i have a cvar like :

PHP Code:

register_cvar("my_speed","2.0")

speed 320.0 get_cvar_float("my_speed"

but i dont wanna to have a cvar. so i tried to change this to :

PHP Code:

#define my_speed 2.0


speed 320.0 my_speed 

problem :

player get speed over 1500 :shock: i thinked so the speed must be 640 or not ?this all are the same or not???

xPaw 04-02-2009 14:38

Re: define/register_cvar
 
i'm not sure but try
PHP Code:

#define MY_SPEED 2

new Float:iSpeed = ( 320.0 float(MY_SPEED) ); 


ot_207 04-02-2009 14:53

Re: define/register_cvar
 
Show the full code

One 04-02-2009 15:00

Re: define/register_cvar
 
TY xpaw, ill try it & say if this works.

@ ot_207: i dont think that we need the full code for this. the code works perfect without any bugs but i dont like to have a cvar for this func.

ot_207 04-02-2009 15:03

Re: define/register_cvar
 
Quote:

Originally Posted by One (Post 795603)
@ ot_207: i dont think that we need the full code for this. the code works perfect without any bugs but i dont like to have a cvar for this func.

Sometimes that can be usefull ...
And advice, use pcvars not cvars

SchlumPF* 04-02-2009 15:11

Re: define/register_cvar
 
defining a float or integer wont change the result, the error has to be in your code somewhere.

One 04-02-2009 15:20

Re: define/register_cvar
 
Quote:

Originally Posted by SchlumPF* (Post 795611)
defining a float or integer wont change the result, the error has to be in your code somewhere.

its my catch mod.i want try to fix the mod. but be sure that in the code about speed, u can never find any errors.btw ill try that what xpaw said & if this not works, ill post the full code here.


All times are GMT -4. The time now is 02:28.

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