C:\Users\Daoud\Desktop\Pilots heaven\gamemodes\PH.pwn(3978) : warning 219: local variable "ID" shadows a variable at a preceding level
C:\Users\Daoud\Desktop\Pilots heaven\gamemodes\PH.pwn(3985) : error 022: must be lvalue (non-constant)
C:\Users\Daoud\Desktop\Pilots heaven\gamemodes\PH.pwn(3985) : warning 215: expression has no effect
C:\Users\Daoud\Desktop\Pilots heaven\gamemodes\PH.pwn(3988) : warning 217: loose indentation
C:\Users\Daoud\Desktop\Pilots heaven\gamemodes\PH.pwn(3978) : warning 204: symbol is assigned a value that is never used: "ID"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.
GetNearestCoordsForPlayer(playerid)
{
new
Float:DefDist = 999999999.9,
Float:CurDist,
ID = -1;
for(new d; d != sizeof(ALocations); d++)
{
CurDist = GetPlayerDistanceFromPoint(playerid, ALocations[d][LocX], ALocations[d][LocY], ALocations[d][LocZ]);
if(CurDist < DefDist)
{
DefDist = CurDist;
ID = d;
}
}
return ID;
}
Line 3978: ID = -1;
Line 3985: ID = d;
Line 3985: ID = d;
Line 3988: return ID;
Line 3978: ID = -1;
stock GetNearestCoordsForPlayer(playerid)
{
new
Float:DefDist = 999999999.9,
Float:CurDist,
id = -1
;
for(new d; d != sizeof(ALocations); d++)
{
CurDist = GetPlayerDistanceFromPoint(playerid, ALocations[d][LocX], ALocations[d][LocY], ALocations[d][LocZ]);
if(CurDist < DefDist)
{
DefDist = CurDist;
id = d;
}
}
return id;
}
Compiled!!!! i hope it works thanks so much man what was wrong with it?
|
stock GetNearestCoordsForPlayer(playerid)
{
new
Float:DefDist = 999999999.9,
Float:CurDist,
id = -1
;
for(new d; d != sizeof(ALocations); d++)
{
CurDist = GetPlayerDistanceFromPoint(playerid, ALocations[d][LocX], ALocations[d][LocY], ALocations[d][LocZ]);
if(CurDist < DefDist)
{
DefDist = CurDist;
id = d;
}
}
return id;
}
public StartMission(playerid)
{
if(TypeFlight[playerid] == 1) // Andromada
{
new rand = GetNearestCoordsForPlayer(playerid);
if(rand == -1) return SendClientMessage(playerid, COLOR_WHITE, "ERROR");
new message[128];
StartedMission[playerid] = 1;
SetPlayerCheckpoint(playerid, ALocations[rand][LocX],ALocations[rand][LocY],ALocations[rand][LocZ], 15.0);
strcat((FirstAPName[playerid][0]='\0',FirstAPName[playerid]),ALocations[rand][LocationName],sizeof(FirstAPName[])); //PASSWORD
format(message,sizeof(message), "Head to {FF9900}%s {FFFFFF}and pick up the cargo goods.", ALocations[rand][LocationName]);
SendClientMessage(playerid, COLOR_WHITE, message);
GameTextForPlayer(playerid, "~w~Andromada ~r~Mission Started", 4000, 3);
TypeFlight[playerid] = 1;
MissionStage[playerid] = 1;
WantsRecording[playerid] = 1;
Pos1[playerid] = ALocations[rand][LocX];
Pos2[playerid] = ALocations[rand][LocY];
Pos3[playerid] = ALocations[rand][LocZ];
}
stock GetNearestCoordsForPlayer(playerid)
{
new
Float:DefDist = 999999999.9,
Float:CurDist,
id = -1
;
for(new d; d != sizeof(ALocations); d++)
{
CurDist = GetPlayerDistanceFromPoint(playerid, ALocations[d][LocX], ALocations[d][LocY], ALocations[d][LocZ]);
if(CurDist < DefDist)
{
DefDist = CurDist;
id = d;
}
}
return id;
}
else if(TypeFlight[playerid] == 2) // AT-400
{
StartedMission[playerid] = 1;
new rand = random(sizeof(ALocations));
new string2[65], message[128];
SetPlayerCheckpoint(playerid, ALocations[rand][LocX],ALocations[rand][LocY],ALocations[rand][LocZ], 15.0);
format(string2, sizeof(string2), "%s", ALocations[rand][LocationName]); //PASSWORD
strmid(FirstAPName[playerid], string2, 0, strlen(string2), 128); //PASSWORD
//FirstAPName[playerid] = ALocations[rand][LocationName];
//FirstAPName[playerid] = AndroDName;
format(message,sizeof(message), "Head to {FF9900}%s {FFFFFF}and pick up the passengers.", ALocations[rand][LocationName]);
SendClientMessage(playerid, COLOR_WHITE, message);
GameTextForPlayer(playerid, "~w~AT-400 ~r~Mission Started", 4000, 3);
TypeFlight[playerid] = 2;
MissionStage[playerid] = 1;
WantsRecording[playerid] = 1;
Pos1[playerid] = ALocations[rand][LocX];
Pos2[playerid] = ALocations[rand][LocY];
Pos3[playerid] = ALocations[rand][LocZ];
}