Raised This Month: $ Target: $400
 0% 

can someone convert the c++ code to amxx


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 05-26-2009 , 02:02   Re: can someone convert the c++ code to amxx
Reply With Quote #2

PHP Code:
    new buf[] = "127.0.0.1"
    
new buf2[sizeof buf]

    new 
pos = -1

    
for(new sizeof buf i>= 0i--)
    {
        if (
buf[i] == '.')
        {
            
pos i;
            break;
        }
    }
        
    if(
pos != -1)
    {
        
copy(buf2,pos 1,buf)
    }

    
server_print("Buf2 = ^"%s^"^n",buf2
Try this. I didn't tested it yet. I'm gonna test it in some minutes

Edit: I tested it. It prints:

Buf2 = "127.0.0."

I think that's what you want. If you want it to print Buf2 = "127.0.0", change the "pos + 1" given to copy() by "pos"
__________________

Last edited by joaquimandrade; 05-26-2009 at 02:15.
joaquimandrade 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 01:34.


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