15.11.2013, 21:02
no man ,i mean this command
when a RR or A Cop do it ,the car which got impounded spawns somewhere which is the impound lot ,what i want is to change that impound lot
pawn Код:
CMD:impound(playerid, params[]) {
switch(PlayerInfo[playerid][pMember]) {
case 1, 2, 7, 14, 15, 17: {
if(!IsAtImpoundingPoint(playerid))
{
SendClientMessageEx(playerid, COLOR_GREY, "You are not near the impound point, you can't impound!");
return 1;
}
if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)) || arr_Towing[playerid] != INVALID_VEHICLE_ID || arr_Wrecking[playerid] != INVALID_VEHICLE_ID)
{
new towed;
if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid))) towed = GetVehicleTrailer(GetPlayerVehicleID(playerid));
if(arr_Towing[playerid] != INVALID_VEHICLE_ID) towed = arr_Towing[playerid];
if(arr_Wrecking[playerid] != INVALID_VEHICLE_ID) towed = arr_Wrecking[playerid];
new
iVehType,
iVehIndex,
iTargetOwner,
iVehTowed = towed;
if(!GetVehicleModel(iVehTowed)) {
return SendClientMessageEx(playerid, COLOR_GREY, "The vehicle in tow has been desynced and therefore cannot be impounded.");
}
foreach(Player, i) {
iVehIndex = GetPlayerVehicle(i, iVehTowed);
if(iVehIndex != -1) {
iVehType = 1;
iTargetOwner = i;
break;
}
}
if(!iVehType) {
for(new i; i < MAX_FAMILY; ++i) {
iVehIndex = GetGangVehicle(i, iVehTowed);
if(iVehIndex != -1) {
iVehType = 2;
iTargetOwner = i;
break;
}
}
}
switch(iVehType) {
case 0, 2: {
if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
{
SendClientMessageEx(playerid, COLOR_GRAD1, "The impound administration could not find any registration on the vehicle and has returned it.");
DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
}
if(arr_Wrecking[playerid] != INVALID_VEHICLE_ID || arr_Towing[playerid] != INVALID_VEHICLE_ID )
{
SendClientMessageEx(playerid, COLOR_GRAD1,"You have detached the vehicle that you were towing from the flatbed.");
playerveh[playerid] = INVALID_VEHICLE_ID;
KillTimer(TimerATACH[playerid]);
DestroyObject(GetPVarInt(playerid, "WreckingGate"));
DeletePVar(playerid, "WreckingGate");
}
SetVehiclePos(iVehTowed, 0, 0, 0); // Attempted desync fix
SetVehicleToRespawn(iVehTowed);
}
case 1: {
PlayerVehicleInfo[iTargetOwner][iVehIndex][pvImpounded] = 1;
PlayerVehicleInfo[iTargetOwner][iVehIndex][pvId] = INVALID_PLAYER_VEHICLE_ID;
if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
{
DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
}
if(arr_Wrecking[playerid] != INVALID_VEHICLE_ID || arr_Towing[playerid] != INVALID_VEHICLE_ID)
{
playerveh[playerid] = INVALID_VEHICLE_ID;
KillTimer(TimerATACH[playerid]);
DestroyObject(GetPVarInt(playerid, "WreckingGate"));
DeletePVar(playerid, "WreckingGate");
}
SetVehiclePos(iVehTowed, 0, 0, 0); // Attempted desync fix
DestroyVehicle(iVehTowed);
--PlayerCars;
new
szMessage[96];
format(szMessage, sizeof(szMessage),"* You have impounded %s's %s.",GetPlayerNameEx(iTargetOwner), VehicleName[PlayerVehicleInfo[iTargetOwner][iVehIndex][pvModelId] - 400]);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMessage);
format(szMessage, sizeof(szMessage), "Your %s has been impounded. You may release it at the DMV in City Hall.", VehicleName[PlayerVehicleInfo[iTargetOwner][iVehIndex][pvModelId] - 400]);
SendClientMessageEx(iTargetOwner, COLOR_LIGHTBLUE, szMessage);
format(szMessage, sizeof(szMessage), "DISPATCH: %s has impounded %s's %s ($%i unpaid tickets).", GetPlayerNameEx(playerid), GetPlayerNameEx(iTargetOwner), VehicleName[PlayerVehicleInfo[iTargetOwner][iVehIndex][pvModelId] - 400], PlayerVehicleInfo[iTargetOwner][iVehIndex][pvTicket]);
SendRadioMessage(PlayerInfo[playerid][pMember], RADIO, szMessage);
format(szMessage, sizeof(szMessage), "Impound: %s has impounded %s's %s.",GetPlayerNameEx(playerid),GetPlayerNameEx(iTargetOwner),VehicleName[PlayerVehicleInfo[iTargetOwner][iVehIndex][pvModelId] - 400]);
ABroadCast(COLOR_YELLOW, szMessage, 2);
Log("logs/impound.log", szMessage);
}
/*case 2: {
new
szMessage[29 + MAX_PLAYER_NAME];
format(szMessage, sizeof(szMessage),"* You have impounded %s's %s.",FamilyInfo[iTargetOwner][FamilyName], GetVehicleName(iVehTowed));
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMessage);
format(szMessage, sizeof(szMessage), "Your %s has been impounded. You may release it at the DMV in City Hall.", GetVehicleName(iVehTowed));
SendNewFamilyMessage(iTargetOwner, COLOR_LIGHTBLUE, szMessage);
FamilyVehicleInfo[iTargetOwner][iVehIndex][fvImpounded] = 1;
FamilyVehicleInfo[iTargetOwner][iVehIndex][fvId] = INVALID_VEHICLE_ID;
DestroyVehicle(iVehTowed);
}*/
}
arr_Towing[playerid] = INVALID_VEHICLE_ID;
arr_Wrecking[playerid] = INVALID_VEHICLE_ID;
}
}
default: SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use this command.");
}
return 1;
}