Raised This Month: $ Target: $400
 0% 

arguments - whats wrong ?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
DS
SourceMod Developer
Join Date: Sep 2004
Location: WI, USA
Old 10-20-2004 , 07:14  
Reply With Quote #3

Almost correct, Da Bishop. When checking for 0 or 1, those would need to be single quotes, I believe. Also the checking for 10 or 100 would never work because all you're doing is comparing the first char of the string to "10". Heh, how can one character be the same as "10". That's not going to work.

I would recommend creating a new variable and turning that argument string into a number. Checking it for some value will be much easier that way, I think.

Code:
#include <amxmod> #include <amxmisc> #define textlength 192 #pragma tabsize 0 public plugin_init() { register_plugin("test","073","MC-Olivenoel") register_clcmd("make_test","maketest",0,"make the test") } public maketest(id) { new varil[textlength+1] read_argv(1,varil,textlength) new numvar = str_to_num(varil) if (numvar == 0){ //numvar is 0     client_cmd(id,"say numvar is 0") return PLUGIN_HANDLED } if (numvar == 1){ //numvar is 1     client_cmd(id,"say numvar is 1") return PLUGIN_HANDLED } if (numvar == 10){ //numvar is 10     client_cmd(id,"say numvar is 10") return PLUGIN_HANDLED } if (numvar == 200){ //numvar is 200     client_cmd(id,"say numvar is 200") return PLUGIN_HANDLED } else {     client_cmd(id,"say numvar is not 0,1,10 or 200") }       return PLUGIN_HANDLED }
DS is offline
 



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 17:11.


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