error /warn command
#1

Waring Errors
Код:
warning 219: local variable "PlayerName" shadows a variable at a preceding level
error 035: argument type mismatch (argument 2)
error 017: undefined symbol "name"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Код:
// Warn a player
COMMAND:warn(playerid, params[])
{
	new id, Reason[128], ReasonMsg[128], Name[24];

    SendAdminText(playerid, "/warn", params);
	// Check if the player has logged in
	if (APlayerData[playerid][LoggedIn] == true)
	{
		// Check if the player's admin-level is at least 1
		if (APlayerData[playerid][PlayerLevel] >= 1)
		{
			if (sscanf(params, "us[128]", id, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /warn [id] [Reason]");
			else
				if (IsPlayerConnected(id)) // If the player is a valid playerid (he's connected)
				{
					// Increase the number of warnings
					APlayerData[id][Warnings]++;

					// Get the name of the player who warned the player
					GetPlayerName(playerid, Name, sizeof(Name));
					// Send the warned player a message who warned him and why he's been warned
                    new PlayerName[MAX_PLAYER_NAME+1];
                    GetPlayerName(playerid, PlayerName, sizeof(name));
					format(ReasonMsg, 128, "%s have been warned by Administrator %s Reason: %s warnings: %i/%i)",Name, PlayerName, Reason,APlayerData[id][Warnings], AutoKickWarnings);
                    SendClientMessage(id, 0xFF0000FF, ReasonMsg);
					// Get the name of the warned player
					GetPlayerName(id, Name, sizeof(Name));
					// Automatically kick the player if he got 3 warnings (if autokick is enabled)
					if ((APlayerData[id][Warnings] == AutoKickWarnings) && (AutoKickAfterWarn == 1))
						Kick(id);
				}
				else
    				SendClientMessage(playerid, 0xFF0000FF, "ERROR: That player isn't online");
		}
		else
		    return 0;
	}
	else
	    return 0;

	// Let the server know that this was a valid command
	return 1;
}
Reply


Messages In This Thread
error /warn command - by DerickClark - 13.05.2013, 02:53
Re : error /warn command - by DaTa[X] - 13.05.2013, 02:59

Forum Jump:


Users browsing this thread: 1 Guest(s)