not the right hp - 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:  not the right hp (
/showthread.php?tid=619284)
 
not the right hp - 
StR_MaRy -  16.10.2016
hey guys i have this cmd and i can /towcar only if the health of that car is under 900 but is not working i can't tow still if the car has under 900 hp , the car i want to tow have 500 hp and still i get the message like "this car do not have 10% or less to tow it"
Код HTML:
CMD:towcar(playerid, params[])
{
	if(gLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_ERROR, "Tu nu esti logat si nu poti sa folosesti aceasta comanda!");
	if(PlayerInfo[playerid][pMember] + PlayerInfo[playerid][pLeader] != 6) return SendClientMessage(playerid, COLOR_ERROR, "Nu faci parte din Tow Truck Company.");
	{
		new vid = GetPlayerVehicleID(playerid);
		if(GetPlayerState(playerid) != 2 && !IsATCCCar(vid)) return SendClientMessage(playerid, COLOR_ERROR, "You are not driver of a Tow Truck.");
		if(GetVehicleModel(vid) != 525) return SendClientMessage(playerid, COLOR_ERROR, "You are not driver of a Tow Truck.");
		if(IsTowing[playerid] == 1) return SendClientMessage(playerid, COLOR_ERROR, "You already towing a vehicle.");
	 	if(PlayerInfo[playerid][pTowPoints] == 0) return SendClientMessage(playerid, COLOR_ERROR, "You cannot tow any car till PayDay.");
		if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
		{
			new Float:health;
			new towedcar = GetVehicleTrailer(GetPlayerVehicleID(playerid));
			GetVehicleHealth( towedcar, health );
			if(health > 900.0)
			{
				format(gString, sizeof(gString), "Acel vehicul prezinta mai putin de 10%s daune, nu il poti tracta!", "%%");
			    SendClientMessage(playerid, COLOR_ERROR, gString );
			    return 1;
			}
		    PlayerInfo[playerid][pTowPoints] --;
			Update(playerid, pTowPointsx);
			CP[playerid] = 90;
			UseFind[playerid] = 0;
			IsTowing[playerid] = 1;
			SetPlayerCheckpoint(playerid, 2409.8416,-1425.7860,23.9826, 5.0);
			SendClientMessage(playerid, COLOR_SYN2, "Go to the checkpoint and destroy the car.");
			CP_Timer[playerid] = gettime();
		}
		else SendClientMessage(playerid, COLOR_ERROR, "You dont have a vehicle attached.");
	}
	return 1;
}
 why?
Re: not the right hp - 
qUneT -  16.10.2016
wrong
Re: not the right hp - 
SickAttack -  16.10.2016
You have to get the health of the vehicle, not the trailer.
Re: not the right hp - 
StR_MaRy -  16.10.2016
but i have a towcar i mean i use click to get the vehicle that i want to TOW so i need to get my trailer vehicle that means the car i want to TOW if i am not right pls give me right code... if you can
Re: not the right hp - 
Bondz -  16.10.2016
PHP код:
CMD:towcar(playerid, params[])
{
    if(gLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_ERROR, "Tu nu esti logat si nu poti sa folosesti aceasta comanda!");
    if(PlayerInfo[playerid][pMember] + PlayerInfo[playerid][pLeader] != 6) return SendClientMessage(playerid, COLOR_ERROR, "Nu faci parte din Tow Truck Company.");
    {
        new vid = GetPlayerVehicleID(playerid);
        if(GetPlayerState(playerid) != 2 && !IsATCCCar(vid)) return SendClientMessage(playerid, COLOR_ERROR, "You are not driver of a Tow Truck.");
        if(GetVehicleModel(vid) != 525) return SendClientMessage(playerid, COLOR_ERROR, "You are not driver of a Tow Truck.");
        if(IsTowing[playerid] == 1) return SendClientMessage(playerid, COLOR_ERROR, "You already towing a vehicle.");
         if(PlayerInfo[playerid][pTowPoints] == 0) return SendClientMessage(playerid, COLOR_ERROR, "You cannot tow any car till PayDay.");
        if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
        {
            new veh = GetPlayerVehicleID(playerid);
            GetVehicleHealth( veh, health );
            if(health > 900.0)
            {
                format(gString, sizeof(gString), "Acel vehicul prezinta mai putin de 10%s daune, nu il poti tracta!", "%%");
                SendClientMessage(playerid, COLOR_ERROR, gString );
                return 1;
            }
            PlayerInfo[playerid][pTowPoints] --;
            Update(playerid, pTowPointsx);
            CP[playerid] = 90;
            UseFind[playerid] = 0;
            IsTowing[playerid] = 1;
            SetPlayerCheckpoint(playerid, 2409.8416,-1425.7860,23.9826, 5.0);
            SendClientMessage(playerid, COLOR_SYN2, "Go to the checkpoint and destroy the car.");
            CP_Timer[playerid] = gettime();
        }
        else SendClientMessage(playerid, COLOR_ERROR, "You dont have a vehicle attached.");
    }
    return 1;
} 
 
Re: not the right hp - 
StR_MaRy -  16.10.2016
i tryed this mode still wont work 

 , that script is getting my health car not the attached one