SA-MP Forums Archive
/irc chat to message admins - 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: /irc chat to message admins (/showthread.php?tid=94686)



/irc chat to message admins - Striker_Moe - 31.08.2009

How to do that? Iґm using seifadmin. A command looks like that:
Code:

	if(strcmp(cmd, "/drugs", true) == 0) // Will make the player invinsible until death
	{
	 	if (AccountInfo[playerid][AdminLevel] > 1 || IsPlayerAdmin(playerid))
	 	{
	  	SetPlayerHealth(playerid,999999999); // max HP
	  	Drugs[playerid] = 1;
	  	SendClientMessage(playerid, GREEN, "You are now high on drugs...");
	 	}
	 	else SendClientMessage(playerid, RED, "Drugs are bad for you!");
		return 1;
	}
	
Just like this way:
Player1: /irc hello
Message to player1:
Player1 on IRC: hello
Message to all admins: Player1 on IRC: hello


Re: /irc chat to message admins - Striker_Moe - 31.08.2009

Anyone?


Re: /irc chat to message admins - Striker_Moe - 31.08.2009

Iґve tried it alone but get a bunch of errors, whats wrong here?

Code:
	if(strcmp(cmd, "/irc", true) == 0) // Available for everyone: reports a player to the admins
	{
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp))
		{
			SendClientMessage(playerid, ORANGE, "USAGE: /irc [text]");
			SendClientMessage(playerid, ORANGE, "FUNCTION: Will send a message to the online admins");
			return 1;
	 	}
		new targetid = ReturnUser(tmp);
		if(targetid != INVALID_PLAYER_ID)
		{
			GetPlayerName(playerid, sendername, sizeof(sendername));
			new reason[128];
			reason = bigstrtok(cmdtext, idx);
			if(!strlen(reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /irc [text]");
			format(string, sizeof(string), "|- %s on IRC: %s ]", sendername,giveplayername,reason);
			SendClientMessageToAdmins(ADMIN_RED, string,1);
			format(string, sizeof(string), "Your message has been sent to the online admins.", giveplayername);
			SendClientMessage(playerid, GREEN, string);
		return 1;
	}



Re: /irc chat to message admins - Striker_Moe - 31.08.2009

I managed to get it half working

Code:
	if(strcmp(cmd, "/irc", true) == 0) // Available for everyone: reports a player to the admins
	{
			GetPlayerName(playerid, sendername, sizeof(sendername));
			new reason[128];
			reason = bigstrtok(cmdtext, idx);
			if(!strlen(reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /irc [text]");
			format(string, sizeof(string), "|- %s on IRC: %s ]", sendername,giveplayername,reason);
			SendClientMessageToAdmins(ADMIN_RED, string,1);
			format(string, sizeof(string), "Your message has been sent to the online admins.", giveplayername);
			SendClientMessage(playerid, GREEN, string);
			return 1;
	}
Just the text is not being displayed, why?


Re: /irc chat to message admins - Striker_Moe - 31.08.2009

Okay, I got it fixed.. it works
Code:
	if(strcmp(cmd, "/irc", true) == 0) 
	{
			GetPlayerName(playerid, sendername, sizeof(sendername));
			new reason[128];
			reason = bigstrtok(cmdtext, idx);
			if(!strlen(reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /irc [text]");
			format(string, sizeof(string), "|- %s on IRC: %s ]", sendername,reason);
			SendClientMessageToAdmins(GREEN, string,1);
			format(string, sizeof(string), "Your message has been sent to the online admins.", giveplayername);
			SendClientMessage(playerid, GREEN, string);
			return 1;
	}
Only one question, how can I add the ID of the player, so itґs displayed like "Mo3 (12) on IRC:"?