Help Fix vehicle
#1

HI!

Can someone tell me how to make if vehicle get 990 health it will avtomaticly repair.
Reply
#2

In OnPlayerUpdate
pawn Код:
if(IsPlayerInAnyVehicle(playerid))
{
    new Float:h; //health
    new veh; //vehicle
    veh = GetPlayerVehicleID(playerid)
    GetVehicleHealth(veh,h);
    if(h <=990) RepairVehicle(veh);
}
Reply
#3

Код:
Line-13:error 001: expected token: ";", but found "-identifier-"

Line 13:

PHP код:
GetVehicleHealth(veh,h); 
Code:

PHP код:
public OnPlayerUpdate(playerid)
{
if(
IsPlayerInAnyVehicle(playerid))
{
    new 
Float:h//health
    
new veh//vehicle
    
veh GetPlayerVehicleID(playerid)
    
GetVehicleHealth(veh,h);
    if(
<=990RepairVehicle(veh);
}
return 
1;

Reply
#4

You'll need a semi colon after the previous line then (12)
Edit: Oh, and use [pawn] tags, not php
Reply
#5

1- semi colon what

2-I now but php is better
Reply
#6

public OnPlayerUpdate(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
new Float:h; //health
new veh; //vehicle
veh = GetPlayerVehicleID(playerid)
GetVehicleHealth(veh,h);
if(h <=990) RepairVehicle(veh);
}
return 1;

//

can you see on public OnPlayerUpdate(playerid)

health and vehicle

Or Health +
Or Vehicle -
Reply
#7

pawn Код:
public OnPlayerUpdate(playerid)
{
        if(IsPlayerInAnyVehicle(playerid))
        {
            new Float:h; //health
            new veh; //vehicle
            veh = GetPlayerVehicleID(playerid);
            GetVehicleHealth(veh,h);
            if(h <=990) RepairVehicle(veh);
        }
        return 1;
}
There was a semicolon ( ; ) missing, you need to use them to end functions.
Reply
#8

Quote:
Originally Posted by kalanerik99
Посмотреть сообщение
Код:
Line-13:error 001: expected token: ";", but found "-identifier-"

Line 13:

PHP код:
GetVehicleHealth(veh,h); 
Code:

PHP код:
public OnPlayerUpdate(playerid)
{
if(
IsPlayerInAnyVehicle(playerid))
{
    new 
Float:h//health
    
new veh//vehicle
    
veh GetPlayerVehicleID(playerid)
    
GetVehicleHealth(veh,h);
    if(
<=990RepairVehicle(veh);
}
return 
1;

Bug in this link veh = GetPlayerVehicleID(playerid) not GetVehicleHealth(veh,h);

GetPlayerVehicleID(playerid); <=== See ;
Reply
#9

Sorry, missed that one semicolon. Apart from that, the code should work though
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)