Warning 202!
#1

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);
Reply
#2

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); 
Reply
#3

It helps if you provide us with the error.

You're missing a square bracket after 'tempAdminName'
Reply
#4

Thanks, Now I Am Getting Undefined Symbol: adminnotification !!!
Reply
#5

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


Forum Jump:


Users browsing this thread: 1 Guest(s)