07.06.2012, 23:41
pawn Code:
new ZoneAttacker[sizeof(ZoneInfo)] = {-1, ...};
Code:
C:\Users\Jo\Downloads\MySQL.pwn(163) : error 018: initialization data exceeds declared size
new ZoneAttacker[sizeof(ZoneInfo)] = {-1, ...};
C:\Users\Jo\Downloads\MySQL.pwn(163) : error 018: initialization data exceeds declared size
new ZoneAttacker[ZoneInfo] = {-1, ...};
enum pInfo
{
Float:zMinX,
Float:zMinY,
Float:zMaxX,
Float:zMaxY,
zTeam,
Kills,
Deaths
}
new ZoneInfo[][pInfo] = {
{1976.0409,-1351.8186,1862.2743,-1450.5481,COLOR_GRAY}
};
mine is:
pawn Code:
|
enum pInfo
{
Float:zMinX,
Float:zMinY,
Float:zMaxX,
Float:zMaxY,
zTeam,
Kills,
Deaths
}
new ZoneInfo[][pInfo] = {
{1976.0409,-1351.8186,1862.2743,-1450.5481,COLOR_GRAY}
};
enum pInfo
{
Float:zMinX,
Float:zMinY,
Float:zMaxX,
Float:zMaxY,
zTeam,
Kills,
Deaths
}
new ZoneInfo[][pInfo] = {
{1976.0409,-1351.8186,1862.2743,-1450.5481,COLOR_GRAY}
};
new PlayerInfo[MAX_PLAYERS][pInfo];
new ZoneID[sizeof(ZoneInfo)];
new ZoneAttacker[ZoneInfo] = {-1, ...};
new ZoneAttackTime[sizeof(ZoneInfo)];
public ZoneTimer()
{
for(new i=0; i < sizeof(ZoneInfo); i++) // loop all zones
{
if(ZoneAttacker[i] != -1) // zone is being attacked
{
if(GetPlayersInZone(i, ZoneAttacker[i]) >= MIN_MEMBERS_TO_START_WAR) // team has enough members in the zone
{
ZoneAttackTime[i]++;
if(ZoneAttackTime[i] == TAKEOVER_TIME) // zone has been under attack for enough time and attackers take over the zone
{
GangZoneStopFlashForAll(ZoneID[i]);
ZoneInfo[i][zTeam] = ZoneAttacker[i];
GangZoneShowForAll(ZoneID[i], GetTeamZoneColor(ZoneInfo[i][zTeam])); // update the zone color for new team
ZoneAttacker[i] = -1;
}
}
else // attackers failed to take over the zone
{
GangZoneStopFlashForAll(ZoneID[i]);
ZoneAttacker[i] = -1;
}
}
else // check if somebody is attacking
{
for(new t=0; t < sizeof(Teams); t++) // loop all teams
{
if(Teams[t] != ZoneInfo[i][zTeam] && GetPlayersInZone(i, Teams[t]) >= MIN_MEMBERS_TO_START_WAR) // if there are enough enemies in the zone
{
ZoneAttacker[i] = Teams[t];
ZoneAttackTime[i] = 0;
GangZoneFlashForAll(ZoneID[i], GetTeamZoneColor(ZoneAttacker[i]));
}
}
}
}
}
for(new i=0; i < sizeof(ZoneInfo); i++)
{
GangZoneShowForPlayer(playerid, ZoneID[i], GetTeamZoneColor(ZoneInfo[i][zTeam]));
if(ZoneAttacker[i] != -1) GangZoneFlashForPlayer(playerid, ZoneID[i], GetTeamZoneColor(ZoneAttacker[i]));
}
new ZoneInfo[1][pInfo] = {//sizeof(ZoneInfo) will return the size of the first dimension
{1976.0409,-1351.8186,1862.2743,-1450.5481,COLOR_GRAY}
};
new ZoneAttacker[sizeof(ZoneInfo)]={-1,...);//sizeof is returning 1
new ZoneAttacker[1]={-1,...);//cant store more than one value if the size is 1
new ZoneAttacker[1]={1,2,3);