Raised This Month: $ Target: $400
 0% 

other way of while loop?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Crusher918
Senior Member
Join Date: Feb 2007
Location: New York
Old 05-23-2007 , 20:41   other way of while loop?
Reply With Quote #1

I was trying to make something for my plugin that has this

PHP Code:
#include <amxmodx>
 
#define PLUGIN "while loop"
#define VERSION "1.0"
#define AUTHOR "Crusher"
 
new x[10]
 
public 
plugin_init() {
 
register_plugin(PLUGINVERSIONAUTHOR)
 
register_plugin("say /test","cmd_test")
}
public 
cmd_test(id) {
 new 
number 
 
 
while(x[number] != 1) {
 
  
number random_num(1,10)
 
 }
 
x[number] = 1
 
 client_print
(id,print_chat,"Test number: %d",number)
 return 
PLUGIN_HANDLED

the problem is the 9th or 10th time using the command Sometimes the number returns as 0

Does anyone knows of any other way to do this?
__________________
My Plugins
Newest plugin: semiclip , amx_bankrupt

Last edited by Crusher918; 05-23-2007 at 23:37.
Crusher918 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 10:31.


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