SA-MP Forums Archive
OOC Chat, help. - 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)
+--- Thread: OOC Chat, help. (/showthread.php?tid=390199)



OOC Chat, help. - Joshswag - 05.11.2012

Okay, so I tried to edit my script so that when an administrator with a certain admin level said something in OOC chat, It came up with his rank. I attempted and it resulted in this.


This is my code in the script.
Код:
command(o, playerid, params[])
{
	new Message[128], string[128];
	if(sscanf(params, "z", Message))
	{
		SendClientMessage(playerid, WHITE, "SYNTAX: /o(oc) [message]");
	}
	else
	{
	    if(Player[playerid][oMuted] >= 1)
	    {
	        SendClientMessage(playerid, WHITE, "You have been muted from the global OOC channel by an administrator.");
	    }
	    else
	    {
			if(Player[playerid][AdminLevel] >= 2)
			{
			    format(string, sizeof(string), "((Administrator %s: %s)) ", GetName(playerid), Message);
			    SendClientMessageToAll(OOC_CHAT, string);
			}
			if(Player[playerid][AdminLevel] >= 5)
			{
			    format(string, sizeof(string), "((Head Administrator %s: %s)) ", GetName(playerid), Message);
			    SendClientMessageToAll(OOC_CHAT, string);
			}
			if(Player[playerid][AdminLevel] >= 1)
			{
			    format(string, sizeof(string), "((Moderator %s: %s)) ", GetName(playerid), Message);
			    SendClientMessageToAll(OOC_CHAT, string);
			}
			if(Player[playerid][AdminLevel] >= 1338)
			{
			    format(string, sizeof(string), "((Server Owner %s: %s)) ", GetName(playerid), Message);
			    SendClientMessageToAll(OOC_CHAT, string);
			}
			else if(oocenabled == 1 && Player[playerid][Authenticated] >= 1)
			{
			    if(Player[playerid][VipRank] >= 1)
			    {
			        format(string, sizeof(string), "((VIP %s: %s)) ", GetName(playerid), Message);
			    	for(new i = 0; i < MAX_PLAYERS; i++)
					{

						if(IsPlayerConnectedEx(i) && Player[i][ToggedOOC] == 0)
						{
					   		SendClientMessage(i, OOC_CHAT, string);
						}
					}

					OOCChatLog(string);
			    }
			    else
			    {
				    if(Player[playerid][PlayingHours] < 1)
				    {
						format(string, sizeof(string), "((%s %s: %s))", OOCRanks[Rank1], GetName(playerid), Message);
			    		for(new i = 0; i < MAX_PLAYERS; i++)
					    {
					        if(IsPlayerConnectedEx(i) && Player[i][ToggedOOC] == 0)
					        {
					            SendClientMessage(i, OOC_CHAT, string);
					        }
					    }
					}
				    else if(Player[playerid][PlayingHours] >= 1 && Player[playerid][PlayingHours] < 25)
				    {
						format(string, sizeof(string), "((%s %s: %s))", OOCRanks[Rank2], GetName(playerid), Message);
			    		for(new i = 0; i < MAX_PLAYERS; i++)
					    {
					        if(IsPlayerConnectedEx(i) && Player[i][ToggedOOC] == 0)
					        {
					            SendClientMessage(i, OOC_CHAT, string);
					        }
					    }
					}
				    else if(Player[playerid][PlayingHours] >= 25 && Player[playerid][PlayingHours] < 100)
				    {
						format(string, sizeof(string), "((%s %s: %s))", OOCRanks[Rank3], GetName(playerid), Message);
			    		for(new i = 0; i < MAX_PLAYERS; i++)
					    {
					        if(IsPlayerConnectedEx(i) && Player[i][ToggedOOC] == 0)
					        {
					            SendClientMessage(i, OOC_CHAT, string);
					        }
					    }
					}
				    else if(Player[playerid][PlayingHours] >= 100 && Player[playerid][PlayingHours] < 300)
				    {
						format(string, sizeof(string), "((%s %s: %s))", OOCRanks[Rank4], GetName(playerid), Message);
			    		for(new i = 0; i < MAX_PLAYERS; i++)
					    {
					        if(IsPlayerConnectedEx(i) && Player[i][ToggedOOC] == 0)
					        {
					            SendClientMessage(i, OOC_CHAT, string);
					        }
					    }
				    }
				    else if(Player[playerid][PlayingHours] >= 300)
				    {
						format(string, sizeof(string), "((%s %s: %s))", OOCRanks[Rank5], GetName(playerid), Message);
					    for(new i = 0; i < MAX_PLAYERS; i++)
					    {
					        if(IsPlayerConnectedEx(i) && Player[i][ToggedOOC] == 0)
					        {
					            SendClientMessage(i, OOC_CHAT, string);
					        }
					    }
					}

				    OOCChatLog(string);
			    }
			}
			else if(oocenabled == 0)
			{
			    SendClientMessage(playerid, WHITE, "OOC channel is currently disabled.");
			}
		}
	}
	return 1;
}
I tried to define the admin rank to the name, but it just came up with undefined, If someone could help that'd be amazing.


Re: OOC Chat, help. - -=Dar[K]Lord=- - 05.11.2012

hmm can u please explain or u wanna tell that u want the rankname and the rank too or only rank ?


Re: OOC Chat, help. - Joshswag - 05.11.2012

If you look at the code, I want that rank too that admin level, but if you look at the screenshot, They all seem to take effect if your all the admin levels.


Re: OOC Chat, help. - -=Dar[K]Lord=- - 05.11.2012

Quote:
Originally Posted by Joshswag
Посмотреть сообщение
If you look at the code, I want that rank too that admin level, but if you look at the screenshot, They all seem to take effect if your all the admin levels.
O.o i didnt understand ... the highest admin level will always have controll on other powers ... of smallers levels u mean to say like this

pawn Код:
((Server Owner [Level: 1338] Dark : test))



Re: OOC Chat, help. - Glad2BeHere - 05.11.2012

z nope iz s[32] in sscanf not z and use params


Re: OOC Chat, help. - -=Dar[K]Lord=- - 05.11.2012

Quote:
Originally Posted by Glad2BeHere
Посмотреть сообщение
z nope iz s[32] in sscanf not z
well s[32] will help cuz "s" also helps lol...


Re: OOC Chat, help. - Joshswag - 05.11.2012

Can you rewrite the script for me?


Re: OOC Chat, help. - Glad2BeHere - 05.11.2012

sure


Re: OOC Chat, help. - Glad2BeHere - 05.11.2012

u copied this for sure, alot of tags are missing imma fix up the entire code 4 u


Re: OOC Chat, help. - justinnater - 05.11.2012

Change >= to ==