06.08.2013, 19:45
(
Последний раз редактировалось Psymetrix; 06.08.2013 в 19:47.
Причина: Forgot label tag.
)
Don't use vehicle IDs directly. Create a new array to hold the vehicle IDs then check if the vehicle ID is in the array.
pawn Код:
// Top of script
// Array sizes MUST match
new gAnsipaVehicle[3]; // Holds 3 vehicles (0 - 2)
new Text3D:gAnsipaVehicleLabel[3]; // Holds 3 labels(0 - 2)
// OnGameModeInit/OnFilterScriptInit
gAnsipaVehicle[0] = AddStaticVehicle(...);
gAnsipaVehicle[1] = AddStaticVehicle(...);
gAnsipaVehicle[2] = AddStaticVehicle(...);
// loop through and attach a label to all vehicle IDs stored in the array
for (new i; i < sizeof(gAnsipaVehicle); i++)
{
gAnsipaVehicleLabel[i] = Create3DTextLabel(...);
Attach3DTextLabelToVehicle(gAnsipaVehicleLabel[i], gAnsipaVehicle[i]);
}
// New IsAnsipaCar function
bool:IsAnsipaVehicle(vehicleid)
{
for (new i; i < sizeof(gAnsipaVehicle); i++)
{
if (vehicleid == gAnsipaVehicle[i])
{
return true;
}
}
false;
}