RemoveBuildingForPlayer
#4

Quote:
Originally Posted by $mooth
Посмотреть сообщение
And i get this error code when i complie
Код:
...
C:\Users\erik\Desktop\testserver\pawno\include\PPC_PlayerCommands.inc(4773) : warning 219: local variable "Name" shadows a variable at a preceding level
C:\Users\erik\Desktop\testserver\pawno\include\PPC_PlayerCommands.inc(4823) : warning 219: local variable "Name" shadows a variable at a preceding level
C:\Users\erik\Desktop\testserver\pawno\include\removebuilding.inc(72) : error 017: undefined symbol "RemoveBuildingForPlayer"
C:\Users\erik\Desktop\testserver\gamemodes\PPC_Trucking.pwn(6066) : error 017: undefined symbol "RemoveBuildingForPlayer"
C:\Users\erik\Desktop\testserver\gamemodes\PPC_Trucking.pwn(6067) : error 017: undefined symbol "RemoveBuildingForPlayer"
C:\Users\erik\Desktop\testserver\gamemodes\PPC_Trucking.pwn(6068) : error 017: undefined symbol "RemoveBuildingForPlayer"
C:\Users\erik\Desktop\testserver\gamemodes\PPC_Trucking.pwn(6069) : error 017: undefined symbol "RemoveBuildingForPlayer"
C:\Users\erik\Desktop\testserver\gamemodes\PPC_Trucking.pwn(6070) : error 017: undefined symbol "RemoveBuildingForPlayer"
C:\Users\erik\Desktop\testserver\gamemodes\PPC_Trucking.pwn(6071) : error 017: undefined symbol "RemoveBuildingForPlayer"
C:\Users\erik\Desktop\testserver\gamemodes\PPC_Trucking.pwn(6072) : error 017: undefined symbol "RemoveBuildingForPlayer"
C:\Users\erik\Desktop\testserver\gamemodes\PPC_Trucking.pwn(6073) : error 017: undefined symbol "RemoveBuildingForPlayer"
C:\Users\erik\Desktop\testserver\gamemodes\PPC_Trucking.pwn(6074) : error 017: undefined symbol "RemoveBuildingForPlayer"
C:\Users\erik\Desktop\testserver\gamemodes\PPC_Trucking.pwn(6075) : error 017: undefined symbol "RemoveBuildingForPlayer"
C:\Users\erik\Desktop\testserver\gamemodes\PPC_Trucking.pwn(6076) : error 017: undefined symbol "RemoveBuildingForPlayer"
C:\Users\erik\Desktop\testserver\gamemodes\PPC_Trucking.pwn(6077) : error 017: undefined symbol "RemoveBuildingForPlayer"
C:\Users\erik\Desktop\testserver\gamemodes\PPC_Trucking.pwn(6078) : error 017: undefined symbol "RemoveBuildingForPlayer"
C:\Users\erik\Desktop\testserver\gamemodes\PPC_Trucking.pwn(6079) : error 017: undefined symbol "RemoveBuildingForPlayer"
C:\Users\erik\Desktop\testserver\gamemodes\PPC_Trucking.pwn(6080) : error 017: undefined symbol "RemoveBuildingForPlayer"
C:\Users\erik\Desktop\testserver\gamemodes\PPC_Trucking.pwn(6081) : error 017: undefined symbol "RemoveBuildingForPlayer"
C:\Users\erik\Desktop\testserver\gamemodes\PPC_Trucking.pwn(6082) : error 017: undefined symbol "RemoveBuildingForPlayer"
C:\Users\erik\Desktop\testserver\gamemodes\PPC_Trucking.pwn(6083) : error 017: undefined symbol "RemoveBuildingForPlayer"
C:\Users\erik\Desktop\testserver\gamemodes\PPC_Trucking.pwn(6084) : error 017: undefined symbol "RemoveBuildingForPlayer"
C:\Users\erik\Desktop\testserver\gamemodes\PPC_Trucking.pwn(6085) : error 017: undefined symbol "RemoveBuildingForPlayer"
C:\Users\erik\Desktop\testserver\gamemodes\PPC_Trucking.pwn(6086) : error 017: undefined symbol "RemoveBuildingForPlayer"
C:\Users\erik\Desktop\testserver\gamemodes\PPC_Trucking.pwn(6087) : error 017: undefined symbol "RemoveBuildingForPlayer"
C:\Users\erik\Desktop\testserver\gamemodes\PPC_Trucking.pwn(6091) : error 055: start of function body without function header
C:\Users\erik\Desktop\testserver\gamemodes\PPC_Trucking.pwn(6093) : error 010: invalid function or declaration
C:\Users\erik\Desktop\testserver\gamemodes\PPC_Trucking.pwn(6094) : error 010: invalid function or declaration

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


26 Errors.
And this is the whole code:
Код:
// This callback gets called when a player connects to the server
public OnPlayerConnect(playerid)
{
	RemoveBuildingForPlayer(playerid, 3516, 1817.5469, 857.6797, 13.0078, 0.25);
	RemoveBuildingForPlayer(playerid, 9120, 2027.3906, 833.1172, 5.8750, 0.25);
	RemoveBuildingForPlayer(playerid, 9160, 2027.3906, 833.1172, 5.8750, 0.25);
	RemoveBuildingForPlayer(playerid, 1290, 1938.5234, 843.1094, 12.0313, 0.25);
	RemoveBuildingForPlayer(playerid, 1540, 1974.8438, 836.7031, 10.7031, 0.25);
	RemoveBuildingForPlayer(playerid, 3516, 2042.5234, 831.0156, 9.0469, 0.25);
	RemoveBuildingForPlayer(playerid, 3509, 2057.5156, 865.3516, 6.0938, 0.25);
	RemoveBuildingForPlayer(playerid, 1290, 2082.1484, 843.0781, 11.8984, 0.25);
	RemoveBuildingForPlayer(playerid, 3516, 2082.2578, 860.4766, 9.1406, 0.25);
	RemoveBuildingForPlayer(playerid, 1540, 2098.8750, 836.7031, 10.7031, 0.25);
	RemoveBuildingForPlayer(playerid, 1294, 2186.2109, 816.9922, 10.2422, 0.25);
	RemoveBuildingForPlayer(playerid, 3509, 2057.5156, 873.2891, 6.0938, 0.25);
	RemoveBuildingForPlayer(playerid, 3509, 2057.3984, 897.2109, 6.8672, 0.25);
	RemoveBuildingForPlayer(playerid, 3509, 2057.2266, 911.2578, 7.5078, 0.25);
	RemoveBuildingForPlayer(playerid, 3463, 2057.4531, 950.7969, 9.4844, 0.25);
	RemoveBuildingForPlayer(playerid, 3509, 2057.2891, 936.1953, 8.7109, 0.25);
	RemoveBuildingForPlayer(playerid, 3509, 2057.5313, 960.8594, 9.5547, 0.25);
	RemoveBuildingForPlayer(playerid, 647, 2057.5703, 942.1016, 10.6016, 0.25);
	RemoveBuildingForPlayer(playerid, 3733, 310.6172, -1145.5234, 85.8750, 0.25);
	RemoveBuildingForPlayer(playerid, 3737, 279.1328, -1152.2266, 82.4141, 0.25);
	RemoveBuildingForPlayer(playerid, 3604, 279.1328, -1152.2266, 82.4141, 0.25);
	RemoveBuildingForPlayer(playerid, 3607, 310.6172, -1145.5234, 85.8750, 0.25);
	
    return 1;
}


{
	// Always allow NPC's to login without password or account
	if (IsPlayerNPC(playerid))
		return 1;

	// Setup local variables
	new Name[MAX_PLAYER_NAME], NewPlayerMsg[128], HouseID;

	// Setup a PVar to allow cross-script money-transfers (only from filterscript to this mainscript) and scorepoints
	SetPVarInt(playerid, "PVarMoney", 0);
	SetPVarInt(playerid, "PVarScore", 0);

	// Get the playername
	GetPlayerName(playerid, Name, sizeof(Name));
	// Also store this name for the player
	GetPlayerName(playerid, APlayerData[playerid][PlayerName], 24);

	// Send a message to all players to let them know somebody else joined the server
	format(NewPlayerMsg, 128, TXT_PlayerJoinedServer, Name, playerid);
	SendClientMessageToAll(0xFFFFFFFF, NewPlayerMsg);

	// Try to load the player's datafile ("PlayerFile_Load" returns "1" is the file has been read, "0" when the file cannot be read)
	if (PlayerFile_Load(playerid) == 1)
	{
		// Check if the player is still banned
		if (APlayerData[playerid][BanTime] < gettime()) // Player ban-time is passed
			ShowPlayerDialog(playerid, DialogLogin, DIALOG_STYLE_INPUT, TXT_DialogLoginTitle, TXT_DialogLoginMsg, TXT_DialogLoginButton1, TXT_DialogButtonCancel);
		else // Player is still banned
		{
			ShowRemainingBanTime(playerid); // Show the remaining ban-time to the player is days, hours, minutes, seconds
			Kick(playerid); // Kick the player
		}
	}
	else
		ShowPlayerDialog(playerid, DialogRegister, DIALOG_STYLE_INPUT, TXT_DialogRegisterTitle, TXT_DialogRegisterMsg, TXT_DialogRegisterButton1, TXT_DialogButtonCancel);

	// The houses have been loaded but not the cars, so load all vehicles assigned to the player's houses
	for (new HouseSlot; HouseSlot < MAX_HOUSESPERPLAYER; HouseSlot++)
	{
	    // Get the HouseID from this slot
	    HouseID = APlayerData[playerid][Houses][HouseSlot];
	    // Check if there is a house in this slot
		if (HouseID != 0)
		    HouseFile_Load(HouseID, true); // Load the cars of the house
	}

	// Speedometer setup
	Speedometer_Setup(playerid);

	// MissionText TextDraw setup
	APlayerData[playerid][MissionText] = TextDrawCreate(320.0, 430.0, " "); // Setup the missiontext at the bottom of the screen
	TextDrawAlignment(APlayerData[playerid][MissionText], 2); // Align the missiontext to the center
	TextDrawUseBox(APlayerData[playerid][MissionText], 1); // Set the missiontext to display inside a box
	TextDrawBoxColor(APlayerData[playerid][MissionText], 0x00000066); // Set the box color of the missiontext


	// Display a message if the player hasn't accepted the rules yet
	if (APlayerData[playerid][RulesRead] == false)
	    SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You haven't accepted the {FFFF00}/rules{FF0000} yet");
	    
	return 1;
}


// This function shows the player how long his ban still is when he tries to login (in days, hours, minutes, seconds)
ShowRemainingBanTime(playerid)
{
	// Setup local variables
	new TotalBanTime, Days, Hours, Minutes, Seconds, Msg[128];

	// Get the total ban-time
	TotalBanTime = APlayerData[playerid][BanTime] - gettime();

	// Calculate days
	if (TotalBanTime >= 86400)
	{
		Days = TotalBanTime / 86400;
		TotalBanTime = TotalBanTime - (Days * 86400);
	}
	// Calculate hours
	if (TotalBanTime >= 3600)
	{
		Hours = TotalBanTime / 3600;
		TotalBanTime = TotalBanTime - (Hours * 3600);
	}
	// Calculate minutes
	if (TotalBanTime >= 60)
	{
		Minutes = TotalBanTime / 60;
		TotalBanTime = TotalBanTime - (Minutes * 60);
	}
	// Calculate seconds
	Seconds = TotalBanTime;

	// Display the remaining ban-time for this player
	SendClientMessage(playerid, 0xFFFFFFFF, TXT_StillBanned);
	format(Msg, 128, TXT_BannedDuration, Days, Hours, Minutes, Seconds);
	SendClientMessage(playerid, 0xFFFFFFFF, Msg);
}
And this is your whole fixed code:
pawn Код:
// This callback gets called when a player connects to the server
public OnPlayerConnect(playerid)
{
    // Always allow NPC's to login without password or account
    if (IsPlayerNPC(playerid))
        return 1;
   
    RemoveBuildingForPlayer(playerid, 3516, 1817.5469, 857.6797, 13.0078, 0.25);
    RemoveBuildingForPlayer(playerid, 9120, 2027.3906, 833.1172, 5.8750, 0.25);
    RemoveBuildingForPlayer(playerid, 9160, 2027.3906, 833.1172, 5.8750, 0.25);
    RemoveBuildingForPlayer(playerid, 1290, 1938.5234, 843.1094, 12.0313, 0.25);
    RemoveBuildingForPlayer(playerid, 1540, 1974.8438, 836.7031, 10.7031, 0.25);
    RemoveBuildingForPlayer(playerid, 3516, 2042.5234, 831.0156, 9.0469, 0.25);
    RemoveBuildingForPlayer(playerid, 3509, 2057.5156, 865.3516, 6.0938, 0.25);
    RemoveBuildingForPlayer(playerid, 1290, 2082.1484, 843.0781, 11.8984, 0.25);
    RemoveBuildingForPlayer(playerid, 3516, 2082.2578, 860.4766, 9.1406, 0.25);
    RemoveBuildingForPlayer(playerid, 1540, 2098.8750, 836.7031, 10.7031, 0.25);
    RemoveBuildingForPlayer(playerid, 1294, 2186.2109, 816.9922, 10.2422, 0.25);
    RemoveBuildingForPlayer(playerid, 3509, 2057.5156, 873.2891, 6.0938, 0.25);
    RemoveBuildingForPlayer(playerid, 3509, 2057.3984, 897.2109, 6.8672, 0.25);
    RemoveBuildingForPlayer(playerid, 3509, 2057.2266, 911.2578, 7.5078, 0.25);
    RemoveBuildingForPlayer(playerid, 3463, 2057.4531, 950.7969, 9.4844, 0.25);
    RemoveBuildingForPlayer(playerid, 3509, 2057.2891, 936.1953, 8.7109, 0.25);
    RemoveBuildingForPlayer(playerid, 3509, 2057.5313, 960.8594, 9.5547, 0.25);
    RemoveBuildingForPlayer(playerid, 647, 2057.5703, 942.1016, 10.6016, 0.25);
    RemoveBuildingForPlayer(playerid, 3733, 310.6172, -1145.5234, 85.8750, 0.25);
    RemoveBuildingForPlayer(playerid, 3737, 279.1328, -1152.2266, 82.4141, 0.25);
    RemoveBuildingForPlayer(playerid, 3604, 279.1328, -1152.2266, 82.4141, 0.25);
    RemoveBuildingForPlayer(playerid, 3607, 310.6172, -1145.5234, 85.8750, 0.25);
   
    // Setup local variables
    new Name[MAX_PLAYER_NAME], NewPlayerMsg[128], HouseID;

    // Setup a PVar to allow cross-script money-transfers (only from filterscript to this mainscript) and scorepoints
    SetPVarInt(playerid, "PVarMoney", 0);
    SetPVarInt(playerid, "PVarScore", 0);

    // Get the playername
    GetPlayerName(playerid, Name, sizeof(Name));
    // Also store this name for the player
    GetPlayerName(playerid, APlayerData[playerid][PlayerName], 24);

    // Send a message to all players to let them know somebody else joined the server
    format(NewPlayerMsg, 128, TXT_PlayerJoinedServer, Name, playerid);
    SendClientMessageToAll(0xFFFFFFFF, NewPlayerMsg);

    // Try to load the player's datafile ("PlayerFile_Load" returns "1" is the file has been read, "0" when the file cannot be read)
    if (PlayerFile_Load(playerid) == 1)
    {
        // Check if the player is still banned
        if (APlayerData[playerid][BanTime] < gettime()) // Player ban-time is passed
            ShowPlayerDialog(playerid, DialogLogin, DIALOG_STYLE_INPUT, TXT_DialogLoginTitle, TXT_DialogLoginMsg, TXT_DialogLoginButton1, TXT_DialogButtonCancel);
        else // Player is still banned
        {
            ShowRemainingBanTime(playerid); // Show the remaining ban-time to the player is days, hours, minutes, seconds
            Kick(playerid); // Kick the player
        }
    }
    else
        ShowPlayerDialog(playerid, DialogRegister, DIALOG_STYLE_INPUT, TXT_DialogRegisterTitle, TXT_DialogRegisterMsg, TXT_DialogRegisterButton1, TXT_DialogButtonCancel);

    // The houses have been loaded but not the cars, so load all vehicles assigned to the player's houses
    for (new HouseSlot; HouseSlot < MAX_HOUSESPERPLAYER; HouseSlot++)
    {
        // Get the HouseID from this slot
        HouseID = APlayerData[playerid][Houses][HouseSlot];
        // Check if there is a house in this slot
        if (HouseID != 0)
            HouseFile_Load(HouseID, true); // Load the cars of the house
    }

    // Speedometer setup
    Speedometer_Setup(playerid);

    // MissionText TextDraw setup
    APlayerData[playerid][MissionText] = TextDrawCreate(320.0, 430.0, " "); // Setup the missiontext at the bottom of the screen
    TextDrawAlignment(APlayerData[playerid][MissionText], 2); // Align the missiontext to the center
    TextDrawUseBox(APlayerData[playerid][MissionText], 1); // Set the missiontext to display inside a box
    TextDrawBoxColor(APlayerData[playerid][MissionText], 0x00000066); // Set the box color of the missiontext


    // Display a message if the player hasn't accepted the rules yet
    if (APlayerData[playerid][RulesRead] == false)
        SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You haven't accepted the {FFFF00}/rules{FF0000} yet");
   
    return 1;
}


// This function shows the player how long his ban still is when he tries to login (in days, hours, minutes, seconds)
ShowRemainingBanTime(playerid)
{
    // Setup local variables
    new TotalBanTime, Days, Hours, Minutes, Seconds, Msg[128];

    // Get the total ban-time
    TotalBanTime = APlayerData[playerid][BanTime] - gettime();

    // Calculate days
    if (TotalBanTime >= 86400)
    {
        Days = TotalBanTime / 86400;
        TotalBanTime = TotalBanTime - (Days * 86400);
    }
    // Calculate hours
    if (TotalBanTime >= 3600)
    {
        Hours = TotalBanTime / 3600;
        TotalBanTime = TotalBanTime - (Hours * 3600);
    }
    // Calculate minutes
    if (TotalBanTime >= 60)
    {
        Minutes = TotalBanTime / 60;
        TotalBanTime = TotalBanTime - (Minutes * 60);
    }
    // Calculate seconds
    Seconds = TotalBanTime;

    // Display the remaining ban-time for this player
    SendClientMessage(playerid, 0xFFFFFFFF, TXT_StillBanned);
    format(Msg, 128, TXT_BannedDuration, Days, Hours, Minutes, Seconds);
    SendClientMessage(playerid, 0xFFFFFFFF, Msg);
}
Beware that always when 26 errors appear, or some other strange error, like something isn't defined while it must be (SA-MP natives for instance) you most likely missed a closing or opening bracket {, } somewhere in the code.
Reply


Messages In This Thread
RemoveBuildingForPlayer - by $mooth - 23.07.2012, 17:31
Re: RemoveBuildingForPlayer - by Ranama - 23.07.2012, 18:40
Re: RemoveBuildingForPlayer - by Kaperstone - 23.07.2012, 18:54
Re: RemoveBuildingForPlayer - by Virtual1ty - 23.07.2012, 22:24

Forum Jump:


Users browsing this thread: 2 Guest(s)