Posts: 2,175
Threads: 235
Joined: Sep 2009
Reputation:
0
RepairVehicle(yourcustomcarid[i])
and a loop check all your custom cars...
i think you can make a timer and not player update
Posts: 58
Threads: 0
Joined: Apr 2011
Reputation:
0
There's no need to use OnPlayerUpdate for this as it is called 30 - 60 times each second. A better way to do it would be to create a 500 ms timer. Also I would strongly recommend against spamming the "AUTO FIX" game text.
Posts: 484
Threads: 49
Joined: Feb 2011
@aRoach Why are you calling Function 500 times in second :/
pawn Код:
// At the top of your Script
new tCar[ 3 ]; // 3 = Number of Vehicles
// At OnGameModeInit
tCar[ 0 ] = CreateVehicle( ... );
tCar[ 1 ] = CreateVehicle( ... );
tCar[ 2 ] = CreateVehicle( ... );
SetTimer("Auto_Repair", 1000, 1);
// Down in your Script
forward Auto_Repair( playerid );
public Auto_Repair( playerid )
{
foreach(Player,i)
{
if(IsPlayerInAnyVehicle(playerid))
{
new Float: HP; GetVehicleHealth( GetPlayerVehicleID( playerid ), HP );
if( HP < 1000 ) RepairVehicle( GetPlayerVehicleID( playerid ) );
}
}
return 1;
}
Posts: 288
Threads: 2
Joined: Sep 2009
pawn Код:
// At the top of your Script
new tCar[ 3 ]; // 3 = Number of Vehicles
// At OnGameModeInit
tCar[ 0 ] = CreateVehicle( ... );
tCar[ 1 ] = CreateVehicle( ... );
tCar[ 2 ] = CreateVehicle( ... );
SetTimer( "Auto_Repair", 1000, 1 );
// Down in your Script
forward Auto_Repair( );
public Auto_Repair( )
{
for( new v = 0; v < sizeof tCar; v ++ )
{
static Float: HP; GetVehicleHealth( tCar[ i ], HP );
if( HP < 999 ) RepairVehicle( tCar[ i ] );
}
return 1;
}
Posts: 484
Threads: 49
Joined: Feb 2011
@Farsek LoL? That wouldn't work :/ Undefined symbol i?

Symbol v is never used? And your public is not checking that is there somebody in car....