AFK / BRB / BACK Commands (compile error,help)
#1

How to define AFK ,REP +1 who helps
The problem
Код:
C:\Users\Korisnik\Desktop\Yugoslavia Trucking v.0.3.7\include\BT_PlayerCommands.inc(18) : error 017: undefined symbol "AFK"
C:\Users\Korisnik\Desktop\Yugoslavia Trucking v.0.3.7\include\BT_PlayerCommands.inc(23) : error 017: undefined symbol "AFK"
C:\Users\Korisnik\Desktop\Yugoslavia Trucking v.0.3.7\include\BT_PlayerCommands.inc(33) : error 017: undefined symbol "AFK"
C:\Users\Korisnik\Desktop\Yugoslavia Trucking v.0.3.7\include\BT_PlayerCommands.inc(44) : error 017: undefined symbol "AFK"
C:\Users\Korisnik\Desktop\Yugoslavia Trucking v.0.3.7\include\BT_PlayerCommands.inc(49) : error 017: undefined symbol "AFK"
C:\Users\Korisnik\Desktop\Yugoslavia Trucking v.0.3.7\include\BT_PlayerCommands.inc(59) : error 017: undefined symbol "AFK"
C:\Users\Korisnik\Desktop\Yugoslavia Trucking v.0.3.7\include\BT_PlayerCommands.inc(69) : error 017: undefined symbol "AFK"
C:\Users\Korisnik\Desktop\Yugoslavia Trucking v.0.3.7\include\BT_PlayerCommands.inc(74) : error 017: undefined symbol "AFK"
C:\Users\Korisnik\Desktop\Yugoslavia Trucking v.0.3.7\include\BT_PlayerCommands.inc(82) : error 017: undefined symbol "AFK"
C:\Users\Korisnik\Desktop\Yugoslavia Trucking v.0.3.7\include\BT_PlayerCommands.inc(111) : error 017: undefined symbol "AFK"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


10 Errors.
The commands
Код:
COMMAND:afk(playerid, params[])
{
    new string[256], name[64];
	SendAdminText(playerid, "/afk", params);
	
	if(APlayerData[playerid][AFK] == 1)
    {
		SendClientMessage(playerid, COLOR_RED, "Greska: Vec ste upisali /afk ili /brb komandu. Upisite /back za povratak.");
        return 1;
    }
    else if(APlayerData[playerid][AFK] == 0)
	{
		new pname[MAX_PLAYER_NAME];
		GetPlayerName(playerid, pname, sizeof(pname));
		format(string, sizeof(string), "Igrac %s (ID:%d) nije za tipkovnicom. (Naredba: /afk)", pname,playerid);
		SendClientMessageToAll(COLOR_YELLOW, string);
		TogglePlayerControllable(playerid,0);
		SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(playerid) + 50);
		format(name, sizeof(name), "%s[AFK]", pname,playerid);
		SetPlayerName(playerid, name);
		APlayerData[playerid][AFK] = 1;
		return 1;
	}
	return 0;
}

COMMAND:brb(playerid, params[])
{
	new string[256];
	SendAdminText(playerid, "/brb", params);
	
	if(APlayerData[playerid][AFK] == 1)
	{
		SendClientMessage(playerid, COLOR_RED, "Greska: Vec ste upisali /afk ili /brb komandu. Upisite /back za povratak.");
		return 1;
	}
    else if(APlayerData[playerid][AFK] == 0)
	{
		new pname[MAX_PLAYER_NAME], name[64];
		GetPlayerName(playerid, pname, sizeof(pname));
		format(string, sizeof(string), "Igrac %s (ID:%d) ce se vratiti brzo. (Naredba: /brb)", pname,playerid);
		SendClientMessageToAll(COLOR_GREEN, string);
		TogglePlayerControllable(playerid,0);
		format(name, sizeof(name), "%s[BRB]", pname,playerid);
		SetPlayerName(playerid, name);
		SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(playerid) + 50);
		APlayerData[playerid][AFK] = 1;
		return 1;
	}
	return 0;
}

COMMAND:back(playerid, params[])
{
	SendAdminText(playerid, "/back", params);
	new string [256];
	if(APlayerData[playerid][AFK] == 0)
	{
		SendClientMessage(playerid, COLOR_RED, "Greska: Vas status nije /afk ili /brb.");
		return 1;
	}
	else if(APlayerData[playerid][AFK] == 1)
	{
		new pname[MAX_PLAYER_NAME];
		GetPlayerName(playerid, pname, sizeof(pname));
		format(string, sizeof(string), "Igrac %s (ID:%d) se vratio natrag u igru.", pname,playerid);
		SendClientMessageToAll(COLOR_GREEN, string);
		TogglePlayerControllable(playerid,1);
		SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(playerid) - 50);
		APlayerData[playerid][AFK] = 0;
		SetPlayerName(playerid, APlayerData[playerid][PlayerName]);
		return 1;
	}
	return 0;
}

COMMAND:afkigraci(playerid, params[])
{
	// Setup local variables
	new AdminList[100], Name[24];

	// Send the command to all admins so they can see it
	SendAdminText(playerid, "/afkigraci", params);

	// Check if the player has logged in
	if (APlayerData[playerid][LoggedIn] == true)
	{
		// Scan through all players
		for (new i; i < MAX_PLAYERS; i++)
		{
			// Check if this player is connected
			if (IsPlayerConnected(i))
			{
				// Get the name of the player
				GetPlayerName(i, Name, sizeof(Name));


				//Check if that player is an admin (using the PlayerLevel)
				if (APlayerData[i][AFK] >= 1)
				{
					// Add all admin players to the list
					format(AdminList, 500, "%sAFK/BRB: %s (id: %i) %i\n", AdminList, Name, playerid); // Add the name of the admin-player to the list
				}
			}
		}

		if (strlen(AdminList) > 0)
		    ShowPlayerDialog(playerid, DialogNoResponse, DIALOG_STYLE_LIST, "AFK/BRB igrači:", AdminList, "OK", "Odustani");
		else
			SendClientMessage(playerid, 0xFF0000FF, "Nema AFK/BRB korisnika online"); // No admins are online
	}
	else
	    return 0;

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

Open your .pwn and search for:

pawn Код:
new APlayerData[MAX_PLAYERS]
It will look something like this:

pawn Код:
enum aInfo
{

a,
b,
c,
d,
e,
f,

}
new APlayerData[MAX_PLAYERS][aInfo];
You have to add "AFK," somewhere in those lines and it should be fine.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)