28.11.2014, 14:56
Bueno lo que pasa esque cuando uso este servicio, el vehiculo no se borra, se clona (Aveces), pero casi siempre funciona, cuando lo uso una vez es para que se lo lleve la grua, cuando lo uso por segunda vez, es para que lo lleve al estacionamiento.
pawn Код:
case CARSPAWN:
{
if (response == 1)
{
if(PlayerVehicleInfo[playerid][listitem][pvImpounded] == 1) return SendClientMessageEx(playerid,COLOR_WHITE,"El auto que intenta spawnear estб embargado.");
if(PlayerVehicleInfo[playerid][listitem][pvImpounded] >= 2) PlayerVehicleInfo[playerid][listitem][pvImpounded] = 0;
if(PlayerVehicleInfo[playerid][listitem][pvModelId] != 0 && PlayerVehicleInfo[playerid][listitem][pvImpounded] == 0 && PlayerVehicleInfo[playerid][listitem][pvSpawned]== 0)
{
if(carsforplayer[playerid] == 7) return SendClientMessageEx(playerid,COLOR_WHITE,"Solo puedes tener 5 autos.");
PlayerCars++;
carsforplayer[playerid]++;
new carcreated = CreateVehicle(PlayerVehicleInfo[playerid][listitem][pvModelId], PlayerVehicleInfo[playerid][listitem][pvPosX], PlayerVehicleInfo[playerid][listitem][pvPosY], PlayerVehicleInfo[playerid][listitem][pvPosZ], PlayerVehicleInfo[playerid][listitem][pvPosAngle],PlayerVehicleInfo[playerid][listitem][pvColor1], PlayerVehicleInfo[playerid][listitem][pvColor2], -1);
PlayerVehicleInfo[playerid][listitem][pvId] = carcreated;
VehicleFuel[carcreated] = PlayerVehicleInfo[playerid][listitem][pvFuel];
SetVehicleHealth(carcreated, PlayerVehicleInfo[playerid][listitem][pvHealth]);
SetVehicleVirtualWorld(carcreated, PlayerVehicleInfo[playerid][listitem][pvVW]);
PlayerVehicleInfo[playerid][listitem][pvSpawned] = 1;
GivePlayerCash(playerid, -2500);
SendClientMessageEx(playerid,COLOR_WHITE,"Una grъa llevo tu vehiculo a tu estacionamiento, para encontrarlo usa {6E9AFF}/localizar");
SendClientMessageEx(playerid,COLOR_WHITE,"El coste de este servicio, te ha costado {00F400}2500${FFFFFF}, Ўvuelve cuando quieras!");
if(PlayerVehicleInfo[playerid][listitem][pvLocked] == 1)
LockPlayerVehicle(playerid, PlayerVehicleInfo[playerid][listitem][pvId], PlayerVehicleInfo[playerid][listitem][pvLock]);
LoadPlayerVehicleMods(playerid, listitem);
return 1;
}
else if(PlayerVehicleInfo[playerid][listitem][pvSpawned] == 1)
{
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
printf(" Unloading %s's vehicles.", playername);
new Float:health;
GetVehicleHealth(PlayerVehicleInfo[playerid][listitem][pvId], health);
if(IsVehicleBusy(PlayerVehicleInfo[playerid][listitem][pvId])) return SendClientMessageEx(playerid, COLOR_GREY, "Tu vehiculo esta siendo utilizado, no se lo puede llevar la grъa.");
if(PlayerVehicleInfo[playerid][listitem][pvImpounded] >= 2) PlayerVehicleInfo[playerid][listitem][pvImpounded] = 0;
if(PlayerVehicleInfo[playerid][listitem][pvId] != INVALID_PLAYER_VEHICLE_ID && PlayerVehicleInfo[playerid][listitem][pvImpounded] == 0 && PlayerVehicleInfo[playerid][listitem][pvSpawned]== 1)
{
PlayerCars--;
carsforplayer[playerid]--;
if(LockStatus[PlayerVehicleInfo[playerid][listitem][pvId]] != 0) LockStatus[PlayerVehicleInfo[playerid][listitem][pvId]] = 0;
UpdatePlayerVehicleMods(playerid, listitem);
DestroyVehicle(PlayerVehicleInfo[playerid][listitem][pvId]);
VehicleFuel[PlayerVehicleInfo[playerid][listitem][pvId]] = 200;
PlayerVehicleInfo[playerid][listitem][pvId] = INVALID_PLAYER_VEHICLE_ID;
PlayerVehicleInfo[playerid][listitem][pvSpawned] = 0;
SendClientMessageEx(playerid,COLOR_ORANGE,"......::::Informaciуn Grъa::::.....");
SendClientMessageEx(playerid,COLOR_WHITE,"Pediste el servicio, una grua se llevo tu auto estraviado.");
SendClientMessageEx(playerid,COLOR_WHITE,"Para pedir que te lo lleven a tu estacionamiento, usa {6E9AFF}/Servicio grua");
SendClientMessageEx(playerid,COLOR_WHITE,"El coste del servicio de grъa, es de {00F400}2500${FFFFFF}, para todo tipo de autos.");
if(PlayerVehicleInfo[playerid][listitem][pvAllowedPlayerId] != INVALID_PLAYER_ID)
{
Info[PlayerVehicleInfo[playerid][listitem][pvAllowedPlayerId]][pVehicleKeys] = INVALID_PLAYER_VEHICLE_ID;
Info[PlayerVehicleInfo[playerid][listitem][pvAllowedPlayerId]][pVehicleKeysFrom] = INVALID_PLAYER_ID;
PlayerVehicleInfo[playerid][listitem][pvAllowedPlayerId] = INVALID_PLAYER_ID;
}
}
}
}