Problem playerid
#1

Hello, this public timer doesn't give me any warning or error.

Just that text appear for all people on server.

pawn Code:
Fuel = SetTimer("FuelTimer",50000,false);
pawn Code:
public FuelTimer()
{
    for(new i, g_m = GetMaxPlayers(); i < g_m; i++) if(IsPlayerConnected(i))
    {
    SetVehicleHealth(mycar7, 150.0);
    GameTextForPlayer(i,"CAR WITHOUT FUEL", 5000, 3);
    SendClientMessage(i,COLOR_LIGHTBLUE,"NO FUEL FOR THIS CAR");
    }
    return 1;
}
How to make it only for the player?
Reply
#2

You need a statement to check whether the person is in a vehicle with low fuel, else it wouldn't work out.
Reply
#3

How to make that? please
Reply
#4

pawn Code:
new vID = GetPlayerVehicleID(playerid);
new gVehicleFuel[MAX_VEHICLES] = 100;

public FuelTimer()
{
    for(new i, g_m = GetMaxPlayers(); i < g_m; i++) if(IsPlayerConnected(i))
    {
        if(gVehicleFuel[vID] <= 0) {
            SetVehicleHealth(mycar7, 150.0);
            GameTextForPlayer(i,"CAR WITHOUT FUEL", 5000, 3);
            SendClientMessage(i,COLOR_LIGHTBLUE,"NO FUEL FOR THIS CAR");
        }
    }
    return 1;
}
Example: Wouldn't work though!
Reply
#5

Crash
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)