Raised This Month: $32 Target: $400
 8% 

while loop


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MagicShot
Senior Member
Join Date: Mar 2004
Location: MN
Old 03-19-2004 , 18:42   while loop
Reply With Quote #1

How would you write a "while loop"?
__________________
|v|agic$hot
.
Without a Sound
MagicShot is offline
Send a message via MSN to MagicShot Send a message via Yahoo to MagicShot
BAILOPAN
Join Date: Jan 2004
Old 03-19-2004 , 19:11  
Reply With Quote #2

while (condition)
{
//code
}



ex.. loop from 0 to 50
new i = 0
while (i++ < 50) {
//stuff
}
__________________
egg
BAILOPAN is offline
QwertyAccess
Veteran Member
Join Date: Feb 2004
Location: Enjiru Layer
Old 03-19-2004 , 19:29  
Reply With Quote #3

i see a new OLO
__________________
QwertyAccess is offline
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 03-19-2004 , 19:43  
Reply With Quote #4

Quote:
Originally Posted by QwertyAccess
i see a new OLO
dont gotta be OLO to know this.
Freecode is offline
tnsk8er27
Senior Member
Join Date: Mar 2004
Location: richfield MN
Old 03-19-2004 , 20:12  
Reply With Quote #5

lol i know


i coulda told him how LOL
__________________
Toxic
tnsk8er27 is offline
Send a message via AIM to tnsk8er27
MagicShot
Senior Member
Join Date: Mar 2004
Location: MN
Old 03-19-2004 , 21:27   hmm
Reply With Quote #6

Thanx Bail!
How Does this Look?

Code:
weapname() {     new i = 0     while (i++ < 50) {         if (weaponname[i][0] == weap) {             curweap = i             return PLUGIN_CONTINUE         }     }     return PLUGIN_CONTINUE }
__________________
|v|agic$hot
.
Without a Sound
MagicShot is offline
Send a message via MSN to MagicShot Send a message via Yahoo to MagicShot
BAILOPAN
Join Date: Jan 2004
Old 03-19-2004 , 21:40  
Reply With Quote #7

I think you need to read a bit about multidim character arrays...

if weaponname[X][], X goes up to 50, it'll work, but since I don'tknow what you're doing, eh. weap isn't even defined, what is it?
__________________
egg
BAILOPAN is offline
MagicShot
Senior Member
Join Date: Mar 2004
Location: MN
Old 03-19-2004 , 21:59   Umm
Reply With Quote #8

Its part of that weap thing I am working on.. Most Current Source is here to see what it looks like.. Keep in mind.. Most of the Basics are there but not complete yet.. I think it the basics shoudl I think work.

http://forums.alliedmods.net/showthr...p?t=216&page=2
__________________
|v|agic$hot
.
Without a Sound
MagicShot is offline
Send a message via MSN to MagicShot Send a message via Yahoo to MagicShot
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 03-20-2004 , 03:23  
Reply With Quote #9

Quote:
Originally Posted by BAILOPAN
while (condition)
{
//code
}



ex.. loop from 0 to 50
new i = 0
while (i++ < 50) {
//stuff
}
most people use for loops for that kind of looping
Code:
new i; for (i = 0; i <= 50; ++i) {    // stuff }
that should be more readable for people new to scripting...
__________________
hello, i am pm
PM is offline
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 03-20-2004 , 03:37  
Reply With Quote #10

Hello , I'm trying to learn scripting and I have a question for you PM ,
Code:
new i; for (i = 0; i <= 50; ++i) {    // stuff }
What does that do? I know it's an example and not a plugin but explain to me a bit more I'm new
Peli is offline
Send a message via MSN to Peli
Reply



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 23:26.


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