AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Array String Help (https://forums.alliedmods.net/showthread.php?t=224368)

zekStein 08-23-2013 12:17

Array String Help
 
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.

Arkshine 08-23-2013 12:19

Re: Array String Help
 
What is the problem with the ^ ?

zekStein 08-23-2013 13:07

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

Could you help me with the array part?

Arkshine 08-23-2013 13:22

Re: Array String Help
 
You have just to escape ^, like ^^.

Or you can use for your plugin another escape character, using #pragma crltchar '\' if you want \ instead.

zekStein 08-23-2013 13:34

Re: Array String Help
 
2x post.

zekStein 08-23-2013 13:41

Re: Array String Help
 
I cant escape like ^^ .. and if i change the control char with $ for example i get a lot of error at formatex html ..

Arkshine 08-23-2013 13:56

Re: Array String Help
 
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:51:35: [Untitled.amxx] string Mod ^.^

So, what is your problem ? Give me a concrete example which doesn't work.

zekStein 08-23-2013 14:28

Re: Array String Help
 
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.

Arkshine 08-23-2013 14:40

Re: Array String Help
 
set_fail_state() can't be formated, but as per 1.8.3-dev+, you can now.

zekStein 08-23-2013 14:49

Re: Array String Help
 
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 ]


All times are GMT -4. The time now is 18:53.

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