18.11.2011, 18:00
(
Последний раз редактировалось KoczkaHUN; 18.11.2011 в 19:56.
Причина: added support for vehicle components
)
pawn Код:
stock SetVehicleNumberPlateEx(vehicleid, numberplate[])
{
static
iLoopIdx,
iReturnValue,
iDamageStatus[4],
iComponents[14],
Float: fPos[3],
Float: fAngle,
Float: fVelocity[3],
Float: fHealth
;
if ( !GetVehicleModel(vehicleid) )
return 0;
if ( strlen(numberplate) > 32 )
numberplate[32] = 0;
GetVehiclePos(vehicleid, fPos[0], fPos[1], fPos[2]);
GetVehicleZAngle(vehicleid, fAngle);
GetVehicleVelocity(vehicleid, fVelocity[0], fVelocity[1], fVelocity[2]);
GetVehicleHealth(vehicleid, fHealth);
GetVehicleDamageStatus(vehicleid, iDamageStatus[0], iDamageStatus[1], iDamageStatus[2], iDamageStatus[3]);
for ( iLoopIdx = 0; iLoopIdx < 14; iLoopIdx++ )
{
iComponents[iLoopIdx] = GetVehicleComponentInSlot(vehicleid, iLoopIdx);
}
new bPlayerData[MAX_PLAYERS] = { -1, ... };
for ( iLoopIdx = 0; iLoopIdx < 500; iLoopIdx++ )
{
if ( IsPlayerInVehicle(iLoopIdx, vehicleid) )
{
bPlayerData[iLoopIdx] = GetPlayerVehicleSeat(iLoopIdx);
RemovePlayerFromVehicle(iLoopIdx);
SetPlayerPos(iLoopIdx, fPos[0], fPos[1], fPos[2]); // if RPFV would not work
}
}
iReturnValue = SetVehicleNumberPlate(vehicleid, numberplate);
SetVehicleToRespawn(vehicleid);
for ( iLoopIdx = 0; iLoopIdx < 500; iLoopIdx++ )
{
if ( bPlayerData[iLoopIdx] != -1 )
{
PutPlayerInVehicle(iLoopIdx, vehicleid, bPlayerData[iLoopIdx]);
}
}
SetVehiclePos(vehicleid, fPos[0], fPos[1], fPos[2]);
SetVehicleZAngle(vehicleid, fAngle);
SetVehicleVelocity(vehicleid, fVelocity[0], fVelocity[1], fVelocity[2]);
SetVehicleHealth(vehicleid, fHealth);
UpdateVehicleDamageStatus(vehicleid, iDamageStatus[0], iDamageStatus[1], iDamageStatus[2], iDamageStatus[3]);
for ( iLoopIdx = 0; iLoopIdx < 14; iLoopIdx++ )
{
if (iComponents[iLoopIdx] > 999) AddVehicleComponent(vehicleid, iComponents[iLoopIdx]);
}
return iReturnValue;
}