AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   help with this (https://forums.alliedmods.net/showthread.php?t=40605)

Lotion 06-30-2006 07:21

help with this
 
I'm kind of stumped on this.

Code:
    new speed = str_to_num(buffer)     set_user_maxspeed(id, %i, speed)     client_cmd(id,"cl_forwardspeed %i", speed)     client_cmd(id,"cl_sidespeed %i", speed)     client_cmd(id,"cl_backspeed %i", speed)
you can probably see what I'm trying to do, but I know im doing this wrong somehow. Speed is a variable pulled out of mysql. I can't figure out how to do this. Ive never really done anything with variables and doing this.

v3x 06-30-2006 08:17

Re: help with this
 
set_user_maxspeed(id, float(speed));

;)

Hawk552 06-30-2006 12:29

Re: help with this
 
I think the better way would be:

Code:
new Float:speed = str_to_float(buffer) set_user_maxspeed(id, speed) client_cmd(id,"cl_forwardspeed %f", speed) client_cmd(id,"cl_sidespeed %f", speed) client_cmd(id,"cl_backspeed %f", speed)

Lotion 07-02-2006 16:05

Re: help with this
 
ah,thanks

EDIT: I tried it Hawk552, and I gueds str_to_float didn't exist in amxx 1.01? Or I'm not using the right includes? I get an unidentified symbol error.

Hawk552 07-02-2006 20:38

Re: help with this
 
Quote:

Originally Posted by Lotion
ah,thanks

EDIT: tryed it Hawk552 and I gues str_to_float didnt exist in amxx 1.01? Or i'm not using the righ includes? I get an unidentified symbol error

Try floatstr, I think it's in 1.01.

Lotion 07-02-2006 21:01

Re: help with this
 
Yeah it is, looked in the inc. How do I use it? I'm pretty new to amxx scripting and this is going to be my first major plugin. I'm not really sure how to interpret incs. Would I use it like this?

Code:
    new float:speed = floatstr(buffer)     set_user_maxspeed(id,speed)     client_cmd(id,"cl_forwardspeed %f", speed)     client_cmd(id,"cl_sidespeed %f", speed)     client_cmd(id,"cl_backspeed %f", speed)

Yep, apparently thats how you use it.
Thanks bud, works now. :D

Hawk552 07-02-2006 21:28

Re: help with this
 
Quote:

Originally Posted by Lotion
Yeah it is, looked in the inc. How do I use it? I'm pretty new to amxx scripting and this is going to be my first major plugin. I'm not really sure how to interpret incs. Would I use it like this?

Code:
    new float:speed = floatstr(buffer)     set_user_maxspeed(id,speed)     client_cmd(id,"cl_forwardspeed %f", speed)     client_cmd(id,"cl_sidespeed %f", speed)     client_cmd(id,"cl_backspeed %f", speed)


Yep, apparently thats how you use it.
Thanks bud, works now. :D

It shouldn't work, it needs to be Float, not float.

Xanimos 07-02-2006 22:32

Re: help with this
 
Don't quote code :-)

Hawk552 07-02-2006 22:38

Re: help with this
 
Quote:

Originally Posted by Suicid3
Don't quote code :-)

Thanks, because I didn't see that myself and I need your advice.

Lotion 07-03-2006 03:24

Re: help with this
 
Hmm...well it seems to be working anyway... strange?


All times are GMT -4. The time now is 08:00.

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