This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Array String Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
zekStein
Member
Join Date: Feb 2011
Location: Romania :(
Old 08-23-2013 , 12:17   Array String Help
Reply With Quote #1

Hello,

I don't want to use formatex in this situation because of the problems with the ^ escape character.
So don't try to tell me about formatex cuz i tried 1000 milion times.

So :

I have :
new Array:szQuerySql = ArrayCreate( 1024 );

Then :
ArrayPushString( szQuerySql, "SELECT `asd` FROM `asd` WHERE (");

Its ok.

Then i want to append to that string ( select bla bla bla ) a piece of strings ( bla2string, bla3stringasd , ");" ).

In the end, i want to obtain the entire string, that looks like select bla bla bla bla2string bla3stringasd ); and print it .

How to do that ?

I tried with ArrayInsertStringAfter but the string remains as in the beggining.

Please help !

Thanks.
__________________
DUMITRU
zekStein is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-23-2013 , 12:19   Re: Array String Help
Reply With Quote #2

What is the problem with the ^ ?
__________________
Arkshine is offline
zekStein
Member
Join Date: Feb 2011
Location: Romania :(
Old 08-23-2013 , 13:07   Re: Array String Help
Reply With Quote #3

If i formatex a string like that : "string %s", 'Mod ^.^" , it remains Mod . .. the ^ dissapear.

Could you help me with the array part?
__________________
DUMITRU
zekStein is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-23-2013 , 13:22   Re: Array String Help
Reply With Quote #4

You have just to escape ^, like ^^.

Or you can use for your plugin another escape character, using #pragma crltchar '\' if you want \ instead.
__________________
Arkshine is offline
zekStein
Member
Join Date: Feb 2011
Location: Romania :(
Old 08-23-2013 , 13:34   Re: Array String Help
Reply With Quote #5

2x post.
__________________
DUMITRU

Last edited by zekStein; 08-23-2013 at 13:41.
zekStein is offline
zekStein
Member
Join Date: Feb 2011
Location: Romania :(
Old 08-23-2013 , 13:41   Re: Array String Help
Reply With Quote #6

I cant escape like ^^ .. and if i change the control char with $ for example i get a lot of error at formatex html ..
__________________
DUMITRU
zekStein is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-23-2013 , 13:56   Re: Array String Help
Reply With Quote #7

new string1[] = "string %s";
new string2[] = "Mod ^^.^^";

new output[ sizeof string1 + sizeof string2 ];
formatex( output, charsmax( output ), string1, string2 );

log_amx( "%s", output );


result = L 08/23/2013 - 19:515: [Untitled.amxx] string Mod ^.^

So, what is your problem ? Give me a concrete example which doesn't work.
__________________
Arkshine is offline
zekStein
Member
Join Date: Feb 2011
Location: Romania :(
Old 08-23-2013 , 14:28   Re: Array String Help
Reply With Quote #8

It seems to be ok.
So i tested and its ok.
The problem was in the set_fail_state( i dont used log_amx, why ? im crazy .. ).

Now it's ok thanks a lot !

I just have to work a little with mysql cuz its resulting me annoyng.
__________________
DUMITRU
zekStein is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-23-2013 , 14:40   Re: Array String Help
Reply With Quote #9

set_fail_state() can't be formated, but as per 1.8.3-dev+, you can now.
__________________

Last edited by Arkshine; 08-23-2013 at 14:48.
Arkshine is offline
zekStein
Member
Join Date: Feb 2011
Location: Romania :(
Old 08-23-2013 , 14:49   Re: Array String Help
Reply With Quote #10

thanks.
If you want to give me an ideea, i have top 10 players. i take the players, i make a query to take their kills, i query the mysql, i use SQL_MoreResults and i have an array but the results( player's kills ) are randomly shown, not in the order i queried. an ideea to put them in order ?
to make the top like : for( i = 0; i <= 9 ; i ++ ) ... i. playername[ i ] playerkills [ i ]
__________________
DUMITRU
zekStein 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 14:37.


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