Help classes spawn
#1

Hi

Can someone tell me why it show me this errors
Errors

Код:
(272) : warning 204: symbol is assigned a value that is never used: "Angle"
(271) : warning 204: symbol is assigned a value that is never used: "z"
(270) : warning 204: symbol is assigned a value that is never used: "y"
(269) : warning 204: symbol is assigned a value that is never used: "x"

My script all
Код:
enum TSpawnLocation
{
Float:SpawnX,
Float:SpawnY,
Float:SpawnZ,
Float:SpawnAngle
}
// Setup spawnlocations for each class (when selecting "Spawn" at class-selection, a random spawnlocation is selected)
new ASpawnLocationsTrucker[][TSpawnLocation] =
{
{-525.0, -502.0, 26.0, 0.0}, // Fallen Tree Depot
{-74.7, -1137.5, 4.5, 0.0}, // Flint Trucking Depot
{1457.0, 975.5, 11.0, 0.0}, // LVA Freight Depot
{-2136.0, -247.5, 36.5, 270.0}, // Doherty Depot
{1766.5, -2040.7, 14.0, 270.0}, // El Corona Depot
{-546.0, 2594.0, 54.0, 270.0}, // Las Payasdas Depot
{332.0, 900.0, 25.0, 205.0}, // Quarry Top
{-1575.0, -2724.0, 49.0, 146.0} // Shady Creek Depot
};
new ASpawnLocationsBusDriver[][TSpawnLocation] =
{
{1809.0, -1905.0, 13.6, 90.0}, // Los Santos busdepot
{-1983.0, 110.0, 27.7, 180.0}, // San Fierro busdepot
{1060.0, 1260.0, 11.0, 270.0} // Las Venturas busdepot
};
new ASpawnLocationsPilot[][TSpawnLocation] =
{
{2010.0, -2345.0, 13.6, 90.0}, // Los Santos airport
{-1211.0, -105.0, 14.2, 135.0}, // San Fierro airport
{1630.0, 1615.0, 10.9, 90.0} // Las Venturas airport
};
new ASpawnLocationsMafia[][TSpawnLocation] =
{
{2822.5, 898.5, 10.8, 0.0} // Mafia hideout
};
new ASpawnLocationsCourier[][TSpawnLocation] =
{
{798.0, -618.75, 16.4, 0.0}, // Los Santos
{-1849.25, -135.0, 12.0, 90.0}, // San Fierro
{1050.5, 1931.0, 10.9, 270.0} // Las Venturas
};
new ASpawnLocationsAssistance[][TSpawnLocation] =
{
{211.25, 24.75, 2.6, 270.0}
};
new ASpawnLocationsRoadWorker[][TSpawnLocation] =
{
{-1866.25, -1715.25, 22.7, 125.0} // Junkyard
};
public OnPlayerConnect(playerid)
{

return 1;
}





public OnPlayerRequestSpawn(playerid)
{

new Index, Float:x, Float:y, Float:z, Float:Angle,Name[24], Msg[128];
GetPlayerName(playerid, Name, sizeof(Name));
switch (PlayerInfo[playerid][PlayerClass])
{
case 1:
{
Index = random(sizeof(ASpawnLocationsTrucker));
x = ASpawnLocationsTrucker[Index][SpawnX];
y = ASpawnLocationsTrucker[Index][SpawnY];
z = ASpawnLocationsTrucker[Index][SpawnZ];
Angle = ASpawnLocationsTrucker[Index][SpawnAngle];
}
case 2:
{
Index = random(sizeof(ASpawnLocationsBusDriver));
x = ASpawnLocationsBusDriver[Index][SpawnX];
y = ASpawnLocationsBusDriver[Index][SpawnY];
z = ASpawnLocationsBusDriver[Index][SpawnZ];
Angle = ASpawnLocationsBusDriver[Index][SpawnAngle];
format(Msg, 128, "{00FF00}Player {FFFF00}%s{00FF00} joined {FFFF00}Busdriver class", Name);
}
case 3:
{
Index = random(sizeof(ASpawnLocationsPilot));
x = ASpawnLocationsPilot[Index][SpawnX];
y = ASpawnLocationsPilot[Index][SpawnY];
z = ASpawnLocationsPilot[Index][SpawnZ];
Angle = ASpawnLocationsPilot[Index][SpawnAngle];
format(Msg, 128, "{00FF00}Player {FFFF00}%s{00FF00} joined {FFFF00}Pilot class", Name);
}
case 4:
{
Index = random(sizeof(ASpawnLocationsMafia));
x = ASpawnLocationsPilot[Index][SpawnX];
y = ASpawnLocationsPilot[Index][SpawnY];
z = ASpawnLocationsPilot[Index][SpawnZ];
Angle = ASpawnLocationsMafia[Index][SpawnAngle];
format(Msg, 128, "{00FF00}Player {FFFF00}%s{00FF00} joined {FFFF00}Mafia class", Name);
}
case 5:
{
Index = random(sizeof(ASpawnLocationsCourier));
x = ASpawnLocationsPilot[Index][SpawnX];
y = ASpawnLocationsPilot[Index][SpawnY];
z = ASpawnLocationsPilot[Index][SpawnZ];
Angle = ASpawnLocationsCourier[Index][SpawnAngle];
format(Msg, 128, "{00FF00}Player {FFFF00}%s{00FF00} joined {FFFF00}Courier class", Name);
}
case 6:
{
Index = random(sizeof(ASpawnLocationsAssistance));
x = ASpawnLocationsPilot[Index][SpawnX];
y = ASpawnLocationsPilot[Index][SpawnY];
z = ASpawnLocationsPilot[Index][SpawnZ];
Angle = ASpawnLocationsAssistance[Index][SpawnAngle];
format(Msg, 128, "{00FF00}Player {FFFF00}%s{00FF00} joined {FFFF00}Assistance class", Name);
}
case 7:
{
Index = random(sizeof(ASpawnLocationsRoadWorker));
x = ASpawnLocationsPilot[Index][SpawnX];
y = ASpawnLocationsPilot[Index][SpawnY];
z = ASpawnLocationsPilot[Index][SpawnZ];
Angle = ASpawnLocationsRoadWorker[Index][SpawnAngle];
format(Msg, 128, "{00FF00}Player {FFFF00}%s{00FF00} joined {FFFF00}RoadWorker class", Name);
}
}
return 0;
}
Reply
#2

First of all, it are warnings. You can compile, run and play the server with warnings.

It basicly says you never used the X, Y and Z co-ordinates, if I see in your script you never added any co-ordinates though. So maybe try adding co-ordinates (X, Y, Z) to the spawn locations, also add the angle.

If you need some random co-ordinates to test it out, here you go: (Took it out of my saved positions textfile)
Quote:

AddPlayerClass(101,261.8092,-270.4496,1.5781,118.6376,0,0,0,0,0,0);

Reply
#3

Quote:
Originally Posted by NL-Sultan
Посмотреть сообщение
First of all, it are warnings. You can compile, run and play the server with warnings.

It basicly says you never used the X, Y and Z co-ordinates, if I see in your script you never added any co-ordinates though. So maybe try adding co-ordinates (X, Y, Z) to the spawn locations, also add the angle.

If you need some random co-ordinates to test it out, here you go: (Took it out of my saved positions textfile)
If you read the script, you would see that he did add coordinates. The errors are indicating that you have given a value to x, y, and z, but you aren't actually using them for anything. In other words, you need to actually use them somewhere in the script now that they have a value. Right now you are basically saying x = 1, but now the compiler is asking why you would say that if you aren't going to use x anywhere.
Reply
#4

And what do I need to do
Reply
#5

Quote:
Originally Posted by kalanerik99
Посмотреть сообщение
And what do I need to do
Does your system actually work in-game? If it does work without any bugs, then you can delete the assigned symbols X, Y, Z & Angle, cause you don't use them.
Reply
#6

Errors:
Код:
(219) : error 017: undefined symbol "ClassTruckDriver"
(228) : error 017: undefined symbol "ClassBusDriver"
(237) : error 017: undefined symbol "ClassPilot"
(246) : error 017: undefined symbol "ClassPolice"
(271) : error 017: undefined symbol "ClassMafia"
(280) : error 017: undefined symbol "ClassCourier"
(289) : error 017: undefined symbol "ClassAssistance"
(298) : error 017: undefined symbol "ClassRoadWorker"
Sript lines

Код:
public OnPlayerRequestSpawn(playerid)
{
new Index, Float:x, Float:y, Float:z, Float:Angle, Name[24], Msg[128];

// Get the player's name
GetPlayerName(playerid, Name, sizeof(Name));

// Choose a random spawnlocation based on the player's class
switch (PlayerInfo[playerid][PlayerClass])
{
case ClassTruckDriver:
{
Index = random(sizeof(ASpawnLocationsTrucker)); // Get a random array-index to chose a random spawnlocation
x = ASpawnLocationsTrucker[Index][SpawnX]; // Get the X-position for the spawnlocation
y = ASpawnLocationsTrucker[Index][SpawnY]; // Get the Y-position for the spawnlocation
z = ASpawnLocationsTrucker[Index][SpawnZ]; // Get the Z-position for the spawnlocation
Angle = ASpawnLocationsTrucker[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation
format(Msg, 128, "{00FF00}Player {FFFF00}%s{00FF00} joined {FFFF00}Trucker class", Name);
}
case ClassBusDriver:
{
Index = random(sizeof(ASpawnLocationsBusDriver));
x = ASpawnLocationsBusDriver[Index][SpawnX]; // Get the X-position for the spawnlocation
y = ASpawnLocationsBusDriver[Index][SpawnY]; // Get the Y-position for the spawnlocation
z = ASpawnLocationsBusDriver[Index][SpawnZ]; // Get the Z-position for the spawnlocation
Angle = ASpawnLocationsBusDriver[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation
format(Msg, 128, "{00FF00}Player {FFFF00}%s{00FF00} joined {FFFF00}Busdriver class", Name);
}
case ClassPilot:
{
Index = random(sizeof(ASpawnLocationsPilot));
x = ASpawnLocationsPilot[Index][SpawnX]; // Get the X-position for the spawnlocation
y = ASpawnLocationsPilot[Index][SpawnY]; // Get the Y-position for the spawnlocation
z = ASpawnLocationsPilot[Index][SpawnZ]; // Get the Z-position for the spawnlocation
Angle = ASpawnLocationsPilot[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation
format(Msg, 128, "{00FF00}Player {FFFF00}%s{00FF00} joined {FFFF00}Pilot class", Name);
}
case ClassPolice:
{
if (PlayerInfo[playerid][PlayerScore] < 100)
{
// Let the player know he needs 100 scorepoints
GameTextForPlayer(playerid, "You need 100 scorepoints for police class", 5000, 4);
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You need 100 scorepoints for police class");
return 0; // Don't allow the player to spawn as police player
}
// If the player has a wanted level
if (GetPlayerWantedLevel(playerid) > 0)
{
// Let the player know he cannot have a wanted level to join police
GameTextForPlayer(playerid, "You are not allowed to choose police class when you're wanted", 5000, 4);
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You are not allowed to choose police class when you're wanted");
return 0; // Don't allow the player to spawn as police player
}

Index = random(sizeof(ASpawnLocationsPolice));
x = ASpawnLocationsPolice[Index][SpawnX]; // Get the X-position for the spawnlocation
y = ASpawnLocationsPolice[Index][SpawnY]; // Get the Y-position for the spawnlocation
z = ASpawnLocationsPolice[Index][SpawnZ]; // Get the Z-position for the spawnlocation
Angle = ASpawnLocationsPolice[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation
format(Msg, 128, "{00FF00}Player {FFFF00}%s{00FF00} joined {FFFF00}Police class", Name);
}
case ClassMafia:
{
Index = random(sizeof(ASpawnLocationsMafia));
x = ASpawnLocationsMafia[Index][SpawnX]; // Get the X-position for the spawnlocation
y = ASpawnLocationsMafia[Index][SpawnY]; // Get the Y-position for the spawnlocation
z = ASpawnLocationsMafia[Index][SpawnZ]; // Get the Z-position for the spawnlocation
Angle = ASpawnLocationsMafia[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation
format(Msg, 128, "{00FF00}Player {FFFF00}%s{00FF00} joined {FFFF00}Mafia class", Name);
}
case ClassCourier:
{
Index = random(sizeof(ASpawnLocationsCourier));
x = ASpawnLocationsCourier[Index][SpawnX]; // Get the X-position for the spawnlocation
y = ASpawnLocationsCourier[Index][SpawnY]; // Get the Y-position for the spawnlocation
z = ASpawnLocationsCourier[Index][SpawnZ]; // Get the Z-position for the spawnlocation
Angle = ASpawnLocationsCourier[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation
format(Msg, 128, "{00FF00}Player {FFFF00}%s{00FF00} joined {FFFF00}Courier class", Name);
}
case ClassAssistance:
{
Index = random(sizeof(ASpawnLocationsAssistance));
x = ASpawnLocationsAssistance[Index][SpawnX]; // Get the X-position for the spawnlocation
y = ASpawnLocationsAssistance[Index][SpawnY]; // Get the Y-position for the spawnlocation
z = ASpawnLocationsAssistance[Index][SpawnZ]; // Get the Z-position for the spawnlocation
Angle = ASpawnLocationsAssistance[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation
format(Msg, 128, "{00FF00}Player {FFFF00}%s{00FF00} joined {FFFF00}Assistance class", Name);
}
case ClassRoadWorker:
{
Index = random(sizeof(ASpawnLocationsRoadWorker));
x = ASpawnLocationsRoadWorker[Index][SpawnX]; // Get the X-position for the spawnlocation
y = ASpawnLocationsRoadWorker[Index][SpawnY]; // Get the Y-position for the spawnlocation
z = ASpawnLocationsRoadWorker[Index][SpawnZ]; // Get the Z-position for the spawnlocation
Angle = ASpawnLocationsRoadWorker[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation
format(Msg, 128, "{00FF00}Player {FFFF00}%s{00FF00} joined {FFFF00}Roadworker class", Name);
}
}

// Spawn the player with his chosen skin at a random location based on his class
SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), x, y, z, Angle, 0, 0, 0, 0, 0, 0);
// Send the message to all players (who joined which class)
SendClientMessageToAll(0xFFFFFFFF, Msg);

return 1;
}
Reply
#7

Please some one help me
Reply
#8

please
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)