21.02.2009, 09:55
This command is used when admin wants to sell Car Ownership car and for that he needs the car ID.
But the problem is that it only works for car that is ID 0. When I change the loop to
Than it works for car id 1
For car id 2 and so on....
_________________________________________________
This CarInfo[c][cID] is used in here under OnGameModeInIt
Basicly it works perfectly for car id 0 but not for the other so the problem is in loop I think...
Any ideas what is the problem?
Tnx
pawn Код:
if(strcmp(cmd, "/getcarid", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
for(new c = 0; c < sizeof(CarInfo); c++)
{
new Float:x,Float:y,Float:z;
new carid = CarInfo[c][cID]; //the car ID in AddStaticVehicle
GetVehiclePos(carid, x, y, z);
if(PlayerToPoint(3, playerid, x, y, z))
{
format(string, sizeof(string), "Car ID: %d", c);
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_RED, "You are not near any Car Ownership vehicle.");
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Only admins with Adm Level 4 can use this command.");
return 1;
}
}
return 1;
}
pawn Код:
for(new c = 1; c < sizeof(CarInfo); c++)
pawn Код:
for(new c = 2; c < sizeof(CarInfo); c++)
_________________________________________________
This CarInfo[c][cID] is used in here under OnGameModeInIt
pawn Код:
for(new c = 0; c < sizeof(CarInfo); c++)
{
CarInfo[c][cID] = AddStaticVehicleEx(CarInfo[c][cModel], CarInfo[c][cLocationx], CarInfo[c][cLocationy], CarInfo[c][cLocationz], CarInfo[c][cAngle], CarInfo[c][cColor1], CarInfo[c][cColor2], -1);
}
Any ideas what is the problem?
Tnx