07.08.2016, 00:01
Hi guys,
So i made a system to put some cars in any cargobob but it doesnt find any near cargobobs and im right next to one. Can anyone check whats going wrong?
So i made a system to put some cars in any cargobob but it doesnt find any near cargobobs and im right next to one. Can anyone check whats going wrong?
PHP Code:
if(strcmp(cmd, "/porcarroheli", true) == 0)
{
if(IsPlayerConnected(playerid))
{
for(new i=0;i<MAX_VEHICLES;i++)
{
if(DynamicCars[i][CarModel] == 548)
{
new Float:CX,Float:CY,Float:CZ;
GetVehiclePos(i, CX,CY,CZ);
new string2[128];
format(string2,sizeof(string2), "%d", i);
SendClientMessage(playerid, COLOR_GREEN, string2);
if(PlayerToPoint(15.0,playerid, CX, CY, CZ))
{
if(PlayerInfo[playerid][pChave1] == i || PlayerInfo[playerid][pChave2] == i || PlayerInfo[playerid][pChave3] == i || PlayerInfo[playerid][pChave4] == i || PlayerInfo[playerid][pChave5] == i || PlayerInfo[playerid][pChave6] == i)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(IsValidModel(GetVehicleModel(GetPlayerVehicleID(playerid))))
{
if(DynamicCars[i][cTransporte] == 0)
{
DynamicCars[i][cTransporte] = GetPlayerVehicleID(playerid);
new car = GetPlayerVehicleID(playerid);
DynamicCars[car][CarX] = 0;
DynamicCars[car][CarY] = 0;
DynamicCars[car][CarZ] = 0;
DynamicCars[car][CarAngle] = 0;
DynamicCars[car][Interior] = 0;
DynamicCars[car][World] = 0;
DestroyVehicle(car);
CreateVehicle(DynamicCars[car][CarModel],DynamicCars[car][CarX],DynamicCars[car][CarY],DynamicCars[car][CarZ],DynamicCars[car][CarAngle],DynamicCars[car][CarColor1],DynamicCars[car][CarColor2], -1);
SaveDynamicCars();
SendClientMessage(playerid, COLOR_GREEN, "[Info] Colocaste um veiculo no helicoptero! Para o removeres entra no helicoptero e faz /tirarcarroheli.");
}
else
{
SendClientMessage(playerid, COLOR_RED, "Erro: Este helicoptero ja contem um veiculo! Remove-o primeiro para colocares outro!");
return 1;
}
}
else
{
SendClientMessage(playerid,COLOR_RED, "Erro: Nao podes colocar este veiculo no helicoptero!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Erro: Nao estas em nenhum veiculo!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Erro: Este helicoptero nao te pertence!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Erro: Nao te encontras perto de nenhum helicoptero!");
return 1;
}
}
}
return 1;
}
}