AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   a stock (https://forums.alliedmods.net/showthread.php?t=172798)

Dr7sTyLe 11-26-2011 06:30

a stock
 
can someone give me a stock that takes a string e.g "my name is" and turn it into "si eman ym" it is possible i saw it on some servers.

jim_yang 11-26-2011 08:42

Re: a stock
 
Code:

stock reverse(a[])
{
        new l = strlen(a);
        new lm1 = l - 1;
        new hl = l / 2;
        new c;
        for(new i = 0; i < hl; ++i)
        {
                c = a[i];
                a[i] = a[lm1 - i];
                a[lm1 - i] = c;
        }
}


ConnorMcLeod 11-26-2011 12:01

Re: a stock
 
Just made something similar to revert chat : http://forums.alliedmods.net/showpos...3&postcount=35

MyPc 11-26-2011 13:34

Re: a stock
 
Quote:

Originally Posted by jim_yang (Post 1602904)
Code:

stock reverse(a[])
{
        new l = strlen(a);
        new lm1 = l - 1;
        new hl = l / 2;
        new c;
        for(new i = 0; i < hl; ++i)
        {
                c = a[i];
                a[i] = a[lm1 - i];
                a[lm1 - i] = c;
        }
}


always wanted to know is there a difference between "/" and "%" in this code ? if there is what is the difference ?

drekes 11-26-2011 14:14

Re: a stock
 
Quote:

Originally Posted by MyPc (Post 1603134)
always wanted to know is there a difference between "/" and "%" in this code ? if there is what is the difference ?

Check the pawn language guide

ConnorMcLeod 11-26-2011 17:48

Re: a stock
 
http://en.wikipedia.org/wiki/Modulo_operation

Dr7sTyLe 11-28-2011 08:45

Re: a stock
 
Both stocks skipping some chars


All times are GMT -4. The time now is 08:35.

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