Raised This Month: $ Target: $400
 0% 

removing letter from begining of string


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-22-2009 , 00:01   Re: removing letter from begining of string
Reply With Quote #1

Quote:
Originally Posted by whosyourdaddy View Post
ok now im using a for loop and all is there a way i can do a for loop and after every loop it will wait .5 seconds or something before doing another loop?
No, but you can use a task with a variable as an index which can simulate a for-loop. The below code should simulate this for-loop.
PHP Code:
for( new iIndex START_VALiIndex<= END_VALiIndex++)
{
    
//your code
    
Pause 0.5

I have not tested it but something like below can simulate a for-loop with a timeout.

PHP Code:
new param[2];
param[0] = START_VAL;
param[1] = END_VAL;

set_task0.5 "YourCode" 5555 param "b"); 
PHP Code:
public YourCode(param[2])
{
    static 
iIndex;

    if( 
iIndex param[0] )
        
iIndex param[0];

    
// your code here

    
if( iIndex == param[1] )
        
remove_task5555 );
    else
        
iIndex++;

__________________

Last edited by Bugsy; 01-22-2009 at 00:17.
Bugsy is offline
whosyourdaddy
Senior Member
Join Date: Apr 2008
Old 01-22-2009 , 00:37   Re: removing letter from begining of string
Reply With Quote #2

Quote:
Originally Posted by Bugsy View Post
PHP Code:
for( new iIndex START_VALiIndex<= END_VALiIndex++)
{
    
//your code
    
Pause 0.5

so the pause 0.5 will work for sure in a for loop?
whosyourdaddy is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-22-2009 , 00:44   Re: removing letter from begining of string
Reply With Quote #3

Quote:
Originally Posted by whosyourdaddy View Post
so the pause 0.5 will work for sure in a for loop?
No, I was giving you an example of what the code below that would simulate.

To start your for-loop, do this

PHP Code:
new param[2];
param[0] = START_VAL;
param[1] = END_VAL;

//This will start a 'loop' with 0.5 seconds between iterations.
set_task0.5 "YourCode" 5555 param "b"); 
Put your for-loop code in here:
PHP Code:
public YourCode(param[2])
{
    static 
iIndex;

    if( 
iIndex param[0] )
        
iIndex param[0];

    
// your for-loop code here

    
if( iIndex == param[1] )
        
remove_task5555 );
    else
        
iIndex++;

__________________
Bugsy is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-22-2009 , 01:40   Re: removing letter from begining of string
Reply With Quote #4

Quote:
Originally Posted by whosyourdaddy View Post
so the pause 0.5 will work for sure in a for loop?
If you do not understand my code or what I am explaining, post what you have so far and what you are trying to do and I will try to write it for you.
__________________
Bugsy is offline
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 01:41.


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