oleg041096
Новичок
warning 219: local variable "playerid" shadows a variable at a preceding leve
Помогите решить проблему с варнингом:
Вот строчка с ошибкой:
Вот код (с 362 по 476):
Помогите пожалуйста решить проблему! С меня +-ик
Помогите решить проблему с варнингом:
Код:
(368) : warning 219: local variable "playerid" shadows a variable at a preceding level
Код:
for (new playerid; playerid < MAX_PLAYERS; playerid++)
Код:
forward GlobalTimer(playerid);
public GlobalTimer(playerid)
{
// Setup local variables
new OldVehicleID, NewVehicleID, OldTrailerID, NewTrailerID;
// Loop through all players
for (new playerid; playerid < MAX_PLAYERS; playerid++)
{
// Check if this player is logged in
if (APlayerData[playerid][LoggedIn] == true)
{
// Get the vehicle-id's from this player
OldVehicleID = APlayerData[playerid][VehicleID];
NewVehicleID = GetPlayerVehicleID(playerid);
OldTrailerID = APlayerData[playerid][TrailerID];
NewTrailerID = GetVehicleTrailer(GetPlayerVehicleID(playerid));
// Check the class of the player
switch (APlayerData[playerid][PlayerClass])
{
case ClassTruckDriver:
{
// Check if the trucker has a job
if (APlayerData[playerid][JobStarted] == true)
{
// Check if the vehicletimer didn't run out yet
if (APlayerData[playerid][VehicleTimerTime] != 0)
{
// If VehicleID and TrailerID are still the same as when the player accepted the job
if ((OldVehicleID == NewVehicleID) && (OldTrailerID == NewTrailerID))
APlayerData[playerid][VehicleTimerTime] = Job_TimeToFailMission; // Reset the time before the mission fails
else // One (or both) aren't still the same (player lost his trailer or vehicle)
PlayerLeftVehicle(playerid); // Inform the player that he left his vehicle and that he must re-enter it
}
else // Time left has reached 0
FailJob(playerid);
}
}
case ClassBusDriver:
{
// Check if the busdriver has a job
if (APlayerData[playerid][JobStarted] == true)
{
if (APlayerData[playerid][VehicleTimerTime] != 0)
{
// If VehicleID is still the same as when the player accepted the job
if (OldVehicleID == NewVehicleID)
APlayerData[playerid][VehicleTimerTime] = Job_TimeToFailMission; // Reset the time before the mission fails
else // Player got out of his bus
PlayerLeftVehicle(playerid); // Inform the player that he left his vehicle and that he must re-enter it
}
else // Time left has reached 0
FailJob(playerid);
}
}
case ClassMafia:
{
// Check if the mafia has a job
if (APlayerData[playerid][JobStarted] == true)
{
if (APlayerData[playerid][VehicleTimerTime] != 0)
{
// If VehicleID is still the same as when the player accepted the job
if (OldVehicleID == NewVehicleID)
APlayerData[playerid][VehicleTimerTime] = Job_TimeToFailMission; // Reset the time before the mission fails
else // Player left his vehicle
PlayerLeftVehicle(playerid); // Inform the player that he left his vehicle and that he must re-enter it
}
else // Time left has reached 0
FailJob(playerid);
}
}
case ClassCourier:
{
// Check if the courier has a job
if (APlayerData[playerid][JobStarted] == true)
{
if (APlayerData[playerid][VehicleTimerTime] != 0)
{
// If VehicleID and TrailerID are still the same as when the player accepted the job
if (OldVehicleID == NewVehicleID)
APlayerData[playerid][VehicleTimerTime] = Job_TimeToFailMission; // Reset the time before the mission fails
else // Player stepped out of his vehicle
PlayerLeftVehicle(playerid); // Inform the player that he left his vehicle and that he must re-enter it
}
else // Time left has reached 0
FailJob(playerid);
}
}
case ClassRoadWorker:
{
// Check if the roadworker has a job
if (APlayerData[playerid][JobStarted] == true)
{
// Check if the vehicletimer didn't run out yet
if (APlayerData[playerid][VehicleTimerTime] != 0)
{
// If VehicleID and TrailerID are still the same as when the player accepted the job
// In case of the "tow broken vehicle" jobtype, the mission starts without a trailer (so it's 0),
// but gets updated when the player enters the checkpoint to set the broken vehicle as trailer
if ((OldVehicleID == NewVehicleID) && (OldTrailerID == NewTrailerID))
APlayerData[playerid][VehicleTimerTime] = Job_TimeToFailMission; // Reset the time before the mission fails
else // VehicleID isn't still the same (player lost his vehicle or trailer)
PlayerLeftVehicle(playerid); // Inform the player that he left his vehicle and that he must re-enter it
}
else // Time left has reached 0
FailJob(playerid);
}
}
}
}
}
GlobalAfkCheck(); // AFK system
return 1;
}
Последнее редактирование:
