Raised This Month: $ Target: $400
 0% 

a stock


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dr7sTyLe
Senior Member
Join Date: Dec 2010
Old 11-26-2011 , 06:30   a stock
Reply With Quote #1

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.
Dr7sTyLe is offline
jim_yang
Veteran Member
Join Date: Aug 2006
Old 11-26-2011 , 08:42   Re: a stock
Reply With Quote #2

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;
	}
}
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-26-2011 , 12:01   Re: a stock
Reply With Quote #3

Just made something similar to revert chat : http://forums.alliedmods.net/showpos...3&postcount=35
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
MyPc
Senior Member
Join Date: Sep 2011
Old 11-26-2011 , 13:34   Re: a stock
Reply With Quote #4

Quote:
Originally Posted by jim_yang View Post
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 ?

Last edited by MyPc; 11-26-2011 at 13:44.
MyPc is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 11-26-2011 , 14:14   Re: a stock
Reply With Quote #5

Quote:
Originally Posted by MyPc View Post
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
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-26-2011 , 17:48   Re: a stock
Reply With Quote #6

http://en.wikipedia.org/wiki/Modulo_operation
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 11-26-2011 at 17:48.
ConnorMcLeod is offline
Dr7sTyLe
Senior Member
Join Date: Dec 2010
Old 11-28-2011 , 08:45   Re: a stock
Reply With Quote #7

Both stocks skipping some chars
Dr7sTyLe 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 08:35.


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