SA-MP Forums Archive
Warning 202! - 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: Warning 202! (/showthread.php?tid=641841)



Warning 202! - BlackLineCnR - 21.09.2017

My Admin On Duty Command Is Giving Warning 202 While Compiling!!
Code:-
Код:
COMMAND:aod(playerid, params[])
{
	if(playerData[playerid][playerLoggedIn])
	{
		if(playerData[playerid][playerLevel] >= 1)
		{
			// If AdminDuty is 1
			if (!playerData[playerid][playerAdminDuty])
			{
				SendClientMessage(playerid, COLOR_WHITE, "{FE9A2E}[ADMIN] {FFFFFF}You're now an on duty administrator.");
                                SendClientMessageToAll(COLOR_LIGHTBLUE, "Administrator %s is now On-Duty!", playerData[tempAdminName]);
				playerData[playerid][playerAdminDuty] = true;
				playerData[playerid][playerAdminLabel] = Create3DTextLabel("Admin on Duty", 0x47476Bff, 30.0, 40.0, 50.0, 60.0, -1, 1);
				Attach3DTextLabelToPlayer(playerData[playerid][playerAdminLabel], playerid, 0.0, 0.0, 0.4);

				// Give them infinite health.
				SetPlayerHealth(playerid, 9999999);
                                SetPlayerArmour(playerid, 9999999);
				SetPlayerColor(playerid, 0x47476B);
				TextDrawShowForPlayer(playerid, Text:AdminDuty);
			}
			else
			{
				// Admin is already on duty, so we'll now put them off duty
				SendClientMessage(playerid, COLOR_WHITE, "{FE9A2E}[ADMIN] {FFFFFF}You're now an off duty administrator.");
                                SendClientMessageToAll(COLOR_LIGHTBLUE, "Administrator %s is now Off-Duty!", playerData[tempAdminName]);
				playerData[playerid][playerAdminDuty] = false;
				Delete3DTextLabel(playerData[playerid][playerAdminLabel]);
			
				// Give them default health
				SetPlayerHealth(playerid, 100);
                                SetPlayerArmour(playerid, 0);
				newPlayerColour(playerid);
				TextDrawHideForPlayer(playerid, Text:AdminDuty);
			}
		}
		else
		{
			return 0;
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}You must be logged in to use commands.");
	}
	
	return 1;
}
Hope I will Be Helped!

I Am Getting Error On These Lines:-
Код:
                                SendClientMessageToAll(COLOR_LIGHTBLUE, "Administrator %s is now On-Duty!", playerData[tempAdminName);



Re: Warning 202! - Zedder - 21.09.2017

Thats because the syntax is wrong.You cannot format a string inside SendClientMessageToAll. You need to format the string first and you also forgot '[' after tempadminname.
here is the corrected code.
PHP код:
//You need to format the strings before putting it in SendClientMessageToAll.
new admnotification[128];
format(admnotificationsizeof(admnotification), "Administrator %s is now On-Duty!"playerData[playerid][tempAdminName]);
SendClientMessageToAll(COLOR_LIGHTBLUEadmnotification); 



Re: Warning 202! - Luke_James - 21.09.2017

It helps if you provide us with the error.

You're missing a square bracket after 'tempAdminName'


Re: Warning 202! - BlackLineCnR - 21.09.2017

Thanks, Now I Am Getting Undefined Symbol: adminnotification !!!


Re: Warning 202! - BlackLineCnR - 21.09.2017

Thanks A Lot Man, It Worked and BTW +Rep For You, Forgot To add
new admnotification[128];