as start the car?
#1

shut down:
pawn Код:
for(new i=0;i<MAX_PLAYERS;i++) {
        if (isrefuelling[i]) continue;
        new vid = GetPlayerVehicleID(i);
        if (GetPlayerVehicleSeat(i) == 0) {
            fuel[vid] = fuel[vid] -1;
            if (fuel[vid]<1)
            {
                fuel[vid] = 0;
                SetVehicleParamsEx(vid,0,0,0,0,1,1,0); //change this to watever you like
                GameTextForPlayer(i,"~b~Fuel~y~ Ende~p~d",5000,4); //show text
            }
        }
        new string[125];format(string,sizeof string,"Fuel: ~r~%i~g~",fuel[vid]);
        TextDrawSetString(td_fuel[i],string);

    }
and start the car?? +rep
Reply
#2

Use SetVehicleParamsEx to toggle engine, lights and stuff.
https://sampwiki.blast.hk/wiki/SetVehicleParamsEx
Reply
#3

Look at your code, very poorly established.

Why isn't there any id's connection check. It will probabily slow down the speed.
pawn Код:
for(new i; i < MAX_PLAYERS; i++)
{
       if(IsPlayerConnected(i))
       {
       }
}
Just a tip, you can do
pawn Код:
fuel[vid] -= 1;
to reduce the value by any amount.

After the fuel limit is smaller than 1 (< 1), why havent you set isrefuelling[i] to false? This can cause problem.
pawn Код:
isrefuelling[i] = false;
Just use this to stop the engine when the vehicle start refueling.
pawn Код:
SetVehicleParamsEx(vid, 0, 0, 0, 0, 0, 0, 0);
Refer to the link provided by CalvinC.

The string size, I think 18 is enough.
pawn Код:
new string[18];
For future, use foreach for making loops life easy. And please use PlayerTextDraws for these kind of purposes.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)