Raised This Month: $ Target: $400
 0% 

removing letter from begining of string


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
whosyourdaddy
Senior Member
Join Date: Apr 2008
Old 01-22-2009 , 22:30   Re: removing letter from begining of string
Reply With Quote #1

how do i put g_szText in param for example param[1] = g_szText[]
whosyourdaddy is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-22-2009 , 23:21   Re: removing letter from begining of string
Reply With Quote #2

Quote:
Originally Posted by whosyourdaddy View Post
how do i put g_szText in param for example param[1] = g_szText[]
You cant. What is the source of the text you want to use?
__________________
Bugsy is offline
whosyourdaddy
Senior Member
Join Date: Apr 2008
Old 01-23-2009 , 00:07   Re: removing letter from begining of string
Reply With Quote #3

this is what im doing
Code:
if ( is_user_alive( id ) )
{
    /*new iLen = strlen( szString ); 
    if(iLen > 60)
        for( new z = 0; z < iLen; z++ )
        {
            x /= z
            if( iLen - 2 != z )
           {
                copy(szStringer, sizeof(szString) - 1, szString[z]);
                parm[2] = szStringer[] 
                set_task( 0.5+x, "Create_StatusText2", TASK_STATUSTEXT + id, parm, 3 );
            }
            else
            {
                set_task( 0.5+x, "Create_StatusText2", TASK_STATUSTEXT + id, parm, 3 );
                parm[2] = szString[]
            }
        }
    else*/
        Create_StatusText( id, 0, szString);
}
 
stock Create_StatusText2(parm[]){

    parm[0] = id
    parm[1] = linenumber
    parm[2] = text[256]
    id -= TASK_STATUSTEXT
    message_begin( MSG_ONE, gmsgStatusText, {0,0,0}, id )
    write_byte( linenumber ) // line number of status bar text
    write_string( text ) // status bar text
    message_end()
}

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

Quote:
Originally Posted by whosyourdaddy View Post
this is what im doing
When I say what is the source of the text, I mean what is szString holding? Where and what value is it assigned?

Here is the code with the text passed through to the task via param[]. Replace console_print with your Create_StatusText2 function as you see appropriate. I revised the code and removed 2 unneeded string variables.

PHP Code:
#include <amxmodx>

#pragma semicolon    1


public plugin_init()
{
    
register_plugin("scroll text" "0.1" "bugsy");
    
    
register_concmd("amx_showtext""DisplayText" ADMIN_ADMIN );
    
register_concmd("amx_stoptext""StopText" ADMIN_ADMIN );
}

public 
DisplayText(id)
{
    new 
param[62];
    
param[0] = id;
    
    
formatparam[1] , 60"THIS WILL SCROLL TEXT, REMOVING ONE CHAR AT A TIME" );
    
    if( 
strlen(param[1]) > 10 )
        
set_task0.5 "Rotate" 5128+id param,62,"b");
    else
        
console_printid ,"%s" param[1] );
        
    return 
PLUGIN_HANDLED;        
}

public 
StopText(id)
{
    
remove_task(5128+id);
    return 
PLUGIN_HANDLED;
}

public 
Rotate(param[62])
{
    
//param[0] = player id
    //param[1-61] = text
    
    
static iIdx;
    
    if( 
iIdx )
        
console_print(param[0], "%s" param[iIdx+1] );
    else
        
console_print(param[0], "%s" param[1] );
    
    if( 
iIdx == (strlen(param[1])-1))
        
iIdx 0;
    else
         
iIdx++;            

__________________

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

hmm kk i see how u did it i will try that out later the thing is for me that the status text depends on what the user has baought so its always different for every1 and never the same
whosyourdaddy 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