mIRC Home    About    Download    Register    News    Help

Print Thread
help conver php function for mIRC script #248975 08/11/14 04:28 PM
Joined: Nov 2014
Posts: 3
A
anonprophet Offline OP
Self-satisified door
OP Offline
Self-satisified door
A
Joined: Nov 2014
Posts: 3
could someone help me change this php function for mIRC script please

Php Code:
function str_to_clantag($int)
{
	$str = pack("N", $int);
	if ($find = strpos($str, "\0"))
		$str = substr($str, 0, $find);

	return $str;
} 

Re: help conver php function for mIRC script [Re: anonprophet] #248976 08/11/14 04:42 PM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
I personally don't know any php, could you explain what the function is used for and what the expected result of entering values return?


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: help conver php function for mIRC script [Re: Nillen] #248977 08/11/14 04:57 PM
Joined: Nov 2014
Posts: 3
A
anonprophet Offline OP
Self-satisified door
OP Offline
Self-satisified door
A
Joined: Nov 2014
Posts: 3
please see this
http://forums.harpywar.com/viewtopic.php?id=1255
https://translate.google.com/translate?hl=en&sl=auto&tl=en&u=http%3A%2F%2Fwikiservia.org%2Findex.php%3Ftitle%3DPvPGN%253AClantag

pvpgn save "UNIX" to database to this 1431193944
i want return "UNIX" string from that number in IRC script

Last edited by anonprophet; 08/11/14 04:59 PM.
Re: help conver php function for mIRC script [Re: anonprophet] #248978 08/11/14 05:53 PM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
And how does 1431193944 translate into "UNIX"? Is there a website or a database you're pulling the translation from?

From what I can gather is that you create a test clan named UNIX which stands for "United Clan of Executive" - This gets saved on a database into
1 1431193944 United Clan of Executive
You want to translate 1431193944 into UNIX. But what I don't know is how UNIX initially is translated to only numbers. If we could cross-reference with some language that originally translated it to the numbers, it'd be possible. But as of right now, those numbers mean nothing to me as long as I don't know how to evaluate them into text.

I used the website listed, but I can't get the same result.
UNIX should translate into 85787388 the way I see it


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: help conver php function for mIRC script [Re: Nillen] #248979 08/11/14 06:30 PM
Joined: Nov 2014
Posts: 3
A
anonprophet Offline OP
Self-satisified door
OP Offline
Self-satisified door
A
Joined: Nov 2014
Posts: 3
thank you so much to try help,
if you know C,
i think this function will translate UNIX to 1431193944
Code:
extern t_clantag str_to_clantag(const char *str)
{
	t_clantag tag = 0;

	if (str[0])
	{
		tag |= str[0] << 24;
		if (str[1])
		{
			tag |= str[1] << 16;
			if (str[2])
			{
				tag |= str[2] << 8;
				if (str[3])
					tag |= str[3];
			}
		}
	}

	return tag;
}


and this will translate 1431193944 to UNIX
Code:
extern const char * clantag_to_str(t_clantag tag)
{
	static char tagstr[sizeof(tag)+1];

	std::sprintf(tagstr, "%c%c%c%c", tag >> 24, (tag >> 16) & 0xff, (tag >> 8) & 0xff, tag & 0xff);
	return tagstr;
}