SA-MP Forums Archive
explode_ function. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: explode_ function. (/showthread.php?tid=103937)



explode_ function. - MenaceX^ - 21.10.2009

Hi.
I'm looking for this function, if someone has it, post it please.
Thanks.


Re: explode_ function. - Westie - 21.10.2009

http://forum.sa-mp.com/index.php?topic=110557.0


Re: explode_ function. - Google63 - 21.10.2009

I prefer explode() from YSI's misc.own because it is probably faster and efficient...


Re: explode_ function. - Westie - 21.10.2009

Sure, Joe?


Re: explode_ function. - MenaceX^ - 21.10.2009

Isn't this Westie's function?
and thanks Westie, I was looking for this.


Re: explode_ function. - Westie - 21.10.2009

Quote:
Originally Posted by Seif_
Quote:
Originally Posted by MenaceX^
Isn't this Westie's function?
and thanks Westie, I was looking for this.
No, explode is a PHP function. Westie made a pawn version of it.
I took the PHP functions and made an as direct port as possible.


Re: explode_ function. - MenaceX^ - 21.10.2009

Quote:
Originally Posted by Seif_
Quote:
Originally Posted by MenaceX^
Isn't this Westie's function?
and thanks Westie, I was looking for this.
No, explode is a PHP function. Westie made a pawn version of it.
That's what I meant...


Erhm, Westie, you deleted the codes from there.. Anywhere to find them?


Re: explode_ function. - Westie - 21.10.2009

Recheck the topic.


Re: explode_ function. - MenaceX^ - 21.10.2009

Just did.


Re: explode_ function. - Kyeno - 22.12.2009

Got some veery strange and hard to debug issues with Westie's explode().

It compiles with no warnings, it runs, but while my test /dbg command reaches it, i get "Server: Unknown command" in my SAMP game.

The code portion (if any1 curious) would be like:
Код:
	// 1. build the query
	new query[1024];
	format(query, sizeof(query), "SELECT * FROM %s WHERE %s='%s'", table, row, id);

	SendClientMessage(playerid, 0xFFFFFFAA, query); 	// dbg
	
	// 2. execute and catch result
	samp_mysql_query(query);
	samp_mysql_store_result();

	new line[2048];
	new message[256];

	if(samp_mysql_fetch_row(line)) {

		format(message, sizeof(message), "Record: %s", line);
	    SendClientMessage(playerid, 0xFFFFFFAA, message);  // dbg

		// Describe
		// Explode result
		// assign associative (?)

		new result[4][256];
		explode(result, line, "|");   // ** here it fails
		

		format(message, sizeof(message), "Found: %s", result[1]);
		SendClientMessage(0, 0xFFFFFFAA, message);
	}
	else SendClientMessage(playerid, 0xFFFFFFAA, "Nothing found...");
I get the proper result in line var as f.e. 3|Kyeno|SomeSecretPass|SomeOtherStuff

Where do i find YSI's one?