not the right hp
#1

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?
Reply
#2

wrong
Reply
#3

You have to get the health of the vehicle, not the trailer.
Reply
#4

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
Reply
#5

PHP код:
CMD:towcar(playeridparams[])
{
    if(
gLogged[playerid] == 0) return SendClientMessage(playeridCOLOR_ERROR"Tu nu esti logat si nu poti sa folosesti aceasta comanda!");
    if(
PlayerInfo[playerid][pMember] + PlayerInfo[playerid][pLeader] != 6) return SendClientMessage(playeridCOLOR_ERROR"Nu faci parte din Tow Truck Company.");
    {
        new 
vid GetPlayerVehicleID(playerid);
        if(
GetPlayerState(playerid) != && !IsATCCCar(vid)) return SendClientMessage(playeridCOLOR_ERROR"You are not driver of a Tow Truck.");
        if(
GetVehicleModel(vid) != 525) return SendClientMessage(playeridCOLOR_ERROR"You are not driver of a Tow Truck.");

        if(
IsTowing[playerid] == 1) return SendClientMessage(playeridCOLOR_ERROR"You already towing a vehicle.");
         if(
PlayerInfo[playerid][pTowPoints] == 0) return SendClientMessage(playeridCOLOR_ERROR"You cannot tow any car till PayDay.");
        if(
IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
        {
            new 
veh GetPlayerVehicleID(playerid);
            
GetVehicleHealthvehhealth );
            if(
health 900.0)
            {
                
format(gStringsizeof(gString), "Acel vehicul prezinta mai putin de 10%s daune, nu il poti tracta!""%%");
                
SendClientMessage(playeridCOLOR_ERRORgString );
                return 
1;
            }
            
PlayerInfo[playerid][pTowPoints] --;
            
Update(playeridpTowPointsx);
            
CP[playerid] = 90;
            
UseFind[playerid] = 0;
            
IsTowing[playerid] = 1;
            
SetPlayerCheckpoint(playerid2409.8416,-1425.7860,23.98265.0);
            
SendClientMessage(playeridCOLOR_SYN2"Go to the checkpoint and destroy the car.");
            
CP_Timer[playerid] = gettime();
        }
        else 
SendClientMessage(playeridCOLOR_ERROR"You dont have a vehicle attached.");
    }
    return 
1;

Reply
#6

i tryed this mode still wont work , that script is getting my health car not the attached one
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)