SA-MP Forums Archive
Staff chat problem - 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: Staff chat problem (/showthread.php?tid=441221)



Staff chat problem - Diamondier - 02.06.2013

So, here's my staff chat problem. What I just added a developer system to the script, so there can be devs in it. I want them to be able to use and read the /sc (staff chat) but when I add them to the command, it gives me these errors -

Код:
C:\Users\Justin\Desktop\SA-MP Server - Scripts\.Main.Red Chaos.Main\gamemodes\RedRB.pwn(4682) : error 029: invalid expression, assumed zero
C:\Users\Justin\Desktop\SA-MP Server - Scripts\.Main.Red Chaos.Main\gamemodes\RedRB.pwn(4682) : error 001: expected token: ";", but found ")"
C:\Users\Justin\Desktop\SA-MP Server - Scripts\.Main.Red Chaos.Main\gamemodes\RedRB.pwn(4682) : error 029: invalid expression, assumed zero
C:\Users\Justin\Desktop\SA-MP Server - Scripts\.Main.Red Chaos.Main\gamemodes\RedRB.pwn(4682) : fatal error 107: too many error messages on one line
Here is the command

Код:
CMD:sc(playerid, params[])
{
    new string[128];
   	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(!PlayerInfo[playerid][pHelper] && !PlayerInfo[playerid][pAdmin]) || !PlayerInfo[playerid][pDev]) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sc [text]");
	if(AntiAdv(playerid, params)) return 1;
	if(PlayerInfo[playerid][pHelper] > PlayerInfo[playerid][pAdmin]) format(string, sizeof(string), "*%s %s: {FFFFFF}%s", RPHLN(playerid), RPN(playerid), params);
	if(PlayerInfo[playerid][pDev] > PlayerInfo[playerid][pDev]) format(string, sizeof(string), "*%s %s: {FFFFFF}%s", RPDLN(playerid), RPN(playerid), params);
    else if(PlayerInfo[playerid][pAdmin] > PlayerInfo[playerid][pHelper])format(string, sizeof(string), "*%s %s: {FFFFFF}%s", RPALN(playerid), RPN(playerid), params);
	foreach(Player, i)
	{
		if(IsPlayerLoggedIn(i))
		{
			if(PlayerInfo[i][pHelper] || PlayerInfo[i][pAdmin] || PlayerInfo[i][pDev])
			{
		    	SendClientMessage(i, COLOR_PURPLE, string);
			}
		}
	}
	// Logs
	if(PlayerInfo[playerid][pHelper] && !PlayerInfo[playerid][pAdmin]) format(string, sizeof(string), "*%s %s: %s", RPHLN(playerid), RPN(playerid), params);
	if(PlayerInfo[playerid][pDev] > PlayerInfo[playerid][pDev]) format(string, sizeof(string), "*%s %s: {FFFFFF}%s", RPDLN(playerid), RPN(playerid), params);
    else if(!PlayerInfo[playerid][pHelper] && PlayerInfo[playerid][pAdmin])format(string, sizeof(string), "*%s %s: %s", RPALN(playerid), RPN(playerid), params);
	Log("logs/helperchat.log", string);
	return 1;
}
Line 4682 which is giving me the errors

Код:
if(!PlayerInfo[playerid][pHelper] && !PlayerInfo[playerid][pAdmin]) || !PlayerInfo[playerid][pDev]) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");



Re: Staff chat problem - Diamondier - 02.06.2013

I've fixed it, simply by taking out the '||' in the error line and replacing it with '&&'.


Re: Staff chat problem - Diamondier - 02.06.2013

Alright... So I have another problem. So... the command works and all, but the titles aren't working. So say I am developer level 4, which is lead developer, I have junior developer? Anyone know why this would be? This is my code.

Код:
CMD:sc(playerid, params[])
{
    new string[128];
   	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(!PlayerInfo[playerid][pHelper] && !PlayerInfo[playerid][pAdmin] && !PlayerInfo[playerid][pDev]) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sc [text]");
	if(AntiAdv(playerid, params)) return 1;
	if(PlayerInfo[playerid][pHelper] > PlayerInfo[playerid][pAdmin]) format(string, sizeof(string), "*%s %s: {FFFFFF}%s", RPHLN(playerid), RPN(playerid), params);
	if(PlayerInfo[playerid][pDev] > PlayerInfo[playerid][pAdmin]) format(string, sizeof(string), "*%s %s: {FFFFFF}%s", RPDLN(playerid), RPN(playerid), params);
    else if(PlayerInfo[playerid][pAdmin] > PlayerInfo[playerid][pHelper])format(string, sizeof(string), "*%s %s: {FFFFFF}%s", RPALN(playerid), RPN(playerid), params);
	foreach(Player, i)
	{
		if(IsPlayerLoggedIn(i))
		{
			if(PlayerInfo[i][pHelper] || PlayerInfo[i][pAdmin] || PlayerInfo[i][pDev])
			{
		    	SendClientMessage(i, COLOR_PURPLE, string);
			}
		}
	}
	// Logs
	if(PlayerInfo[playerid][pHelper] && !PlayerInfo[playerid][pAdmin]) format(string, sizeof(string), "*%s %s: %s", RPHLN(playerid), RPN(playerid), params);
	if(PlayerInfo[playerid][pDev] && PlayerInfo[playerid][pDev]) format(string, sizeof(string), "*%s %s: {FFFFFF}%s", RPDLN(playerid), RPN(playerid), params);
    else if(!PlayerInfo[playerid][pHelper] && PlayerInfo[playerid][pAdmin])format(string, sizeof(string), "*%s %s: %s", RPALN(playerid), RPN(playerid), params);
	Log("logs/helperchat.log", string);
	return 1;
}