Raised This Month: $ Target: $400
 0% 

Array Wont hold Value....


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 09-15-2005 , 20:24  
Reply With Quote #6

Quote:
Code:
new arg1[32], arg2[32], name[32], victim[32], target         get_user_name(id, name, 31)             read_argv(1, arg1, 31)         read_argv(2, arg2, 31)         str_to_num(arg2)                 target = cmd_target(id, arg1, 2)         get_user_name(target, victim, 31)         coins[target] += floatstr(arg2[31])
When you use str_to_num you usually have num = str_to_num.
But you dont us it anyways.
with
"coins[target] += floatstr(arg2[31])" you are starting at the 31st character of the string to get the float which is why its always 0.0000

You have two choices to fix
1) new Add = str_to_num(arg2)
//...
coins[target] += Add

2) remove line str_to_num(arg2)
//...
coins[target] += floatstr(arg2)

[Edit]
Quote:
Code:
server_print( " [COIN MOD] ADMIN %s Added %f coins to player %s!", name, arg2, victim )
arg2 is still a string ;p also why it would print 0.0000
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:34.


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