SA-MP Forums Archive
Doing my Headin Textdraw Speedo (Fuel System) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Doing my Headin Textdraw Speedo (Fuel System) (/showthread.php?tid=330401)



Doing my Headin Textdraw Speedo (Fuel System) - NoZ - 01.04.2012

Alright,

So ive got no idea wtf is going on..
this is my first ever attempt with textdraws and filterscripts.
so yes, im not good - but im tryying to learn myself, anyways...

now, im not entirley sure why on fucking earth this gay arse Petrol: 100 thingo comes up.
(sorry but im that fustrated).

Код:
public sPetrol()
{
    for(new i=0;i<gMVehicles;i++)
		{
        if (IsCarRefueling[i]) continue; //stop when a player is already refuelling
        new VehicleIdentificationNumber = GetPlayerVehicleID(i); //getting vehicle ID
        if (GetPlayerVehicleSeat(i) == 0)
			{
            Petrol[VehicleIdentificationNumber] = Petrol[VehicleIdentificationNumber] -1; //lowering fuel value
            if (Petrol[VehicleIdentificationNumber]<1) //if fuel is empty
            {
                Petrol[VehicleIdentificationNumber] = 0; //setting fuel to 0 (else the timer will set it to -1 -2 -3 etc before removing player)
                RemovePlayerFromVehicle(i); //remove player out of vehicle
                GameTextForPlayer(i,"~r~You are out of ~w~fuel~r~!",5000,4); //show text
            }
        }
       
        new string[125];format(string,sizeof string,"Petrol:%i",Petrol[VehicleIdentificationNumber]); //preparing string with next fuel value //The Petrol:%i Here acutally is this 'Petrol: 100' out of place on the textdraw?

        TextDrawSetString(gPetrol[i],string); //updating textdraw
    }
    return 1;
}


public Refueling_Timer(playerid)
{
    new VehicleIdentificationNumber = GetPlayerVehicleID(playerid);
    Petrol[VehicleIdentificationNumber] = Petrol[VehicleIdentificationNumber] = 100;
    IsCarRefueling[playerid] = 0;
	TextDrawSetString(gPetrol[playerid],"Petrol:100");
    TogglePlayerControllable(playerid,1);
}
Now the white textdraw that is out of place displaying 'Petrol: 100',
this is where A: I Dont know where the flying fuck it gets its co-ords from.
B: I Have no co-ords set to their.
ive screwed around with this for about 6 hours on & off.
but i just can't figure it out, can anybody help me?

if you need more code shown just ask.



Cheers,


Re: Doing my Headin Textdraw Speedo (Fuel System) - NoZ - 01.04.2012

Bump REALLY NEED HELP


Re: Doing my Headin Textdraw Speedo (Fuel System) - Avi57 - 01.04.2012

Try This:
Код:
public sPetrol()
{
    for(new i=0;i<gMVehicles;i++)
		{
        if (IsCarRefueling[i]) continue; //stop when a player is already refuelling
        new VehicleIdentificationNumber = GetPlayerVehicleID(i); //getting vehicle ID
        if (GetPlayerVehicleSeat(i) == 0)
			{
            Petrol[VehicleIdentificationNumber] = Petrol[VehicleIdentificationNumber] -1; //lowering fuel value
            if (Petrol[VehicleIdentificationNumber]<1) //if fuel is empty
            {
                Petrol[VehicleIdentificationNumber] = 0; //setting fuel to 0 (else the timer will set it to -1 -2 -3 etc before removing player)
                RemovePlayerFromVehicle(i); //remove player out of vehicle
                GameTextForPlayer(i,"~r~You are out of ~w~fuel~r~!",5000,4); //show text
            }
        }
       
        new string[125];format(string,sizeof string,"Petrol:%i",Petrol[VehicleIdentificationNumber]); //preparing string with next fuel value //The Petrol:%i Here acutally is this 'Petrol: 100' out of place on the textdraw?

        TextDrawSetString(gPetrol[i],string); //updating textdraw
    }
    return 1;
}


public Refueling_Timer(playerid)
{
    new VehicleIdentificationNumber = GetPlayerVehicleID(playerid);
    Petrol[VehicleIdentificationNumber] = Petrol[VehicleIdentificationNumber] = 100;
    IsCarRefueling[playerid] = 0;
    TogglePlayerControllable(playerid,1);
}



Re: Doing my Headin Textdraw Speedo (Fuel System) - NoZ - 01.04.2012

Still no Luck, but thanks alot.
STILL Doing exactly the same thing grr


Re: Doing my Headin Textdraw Speedo (Fuel System) - Avi57 - 01.04.2012

what about this, Try it.
Код:
public sPetrol()
{
    for(new i=0;i<gMVehicles;i++)
		{
        if (IsCarRefueling[i]) continue; //stop when a player is already refuelling
        new VehicleIdentificationNumber = GetPlayerVehicleID(i); //getting vehicle ID
        if (GetPlayerVehicleSeat(i) == 0)
			{
            Petrol[VehicleIdentificationNumber] = Petrol[VehicleIdentificationNumber] -1; //lowering fuel value
            if (Petrol[VehicleIdentificationNumber]<1) //if fuel is empty
            {
                Petrol[VehicleIdentificationNumber] = 0; //setting fuel to 0 (else the timer will set it to -1 -2 -3 etc before removing player)
                RemovePlayerFromVehicle(i); //remove player out of vehicle
                GameTextForPlayer(i,"~r~You are out of ~w~fuel~r~!",5000,4); //show text
            }
        }
       
        new string[125];format(string,sizeof string,"Petrol:%i",Petrol[VehicleIdentificationNumber]); //preparing string with next fuel value //The Petrol:%i Here acutally is this 'Petrol: 100' out of place on the textdraw?

        TextDrawSetString(gPetrol[i],string); //updating textdraw
    }
    return 1;
}


public Refueling_Timer(playerid)
{
    new VehicleIdentificationNumber = GetPlayerVehicleID(playerid);
    Petrol[VehicleIdentificationNumber] = Petrol[VehicleIdentificationNumber] = ;
    IsCarRefueling[playerid] = 0;
    TogglePlayerControllable(playerid,1);
}



Re: Doing my Headin Textdraw Speedo (Fuel System) - NoZ - 01.04.2012

Petrol[VehicleIdentificationNumber] = ; (Assumed zero) or whatever the error is, so...

got no idea ay.