SA-MP Forums Archive
mechanical car body fix - 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: mechanical car body fix (/showthread.php?tid=320251)



mechanical car body fix - viddo - 22.02.2012

Okay, so i wanted the mechanic job to be more rply so i made /repair to repair the engine only but i want another cmd like /bodyrepair to repair the body WITHOUT repairing the engine, any ideas?


The engine /repair

Код:
	if(strcmp(cmd, "/repair", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
		    if(PlayerInfo[playerid][pJob] != 7)
		    {
		        SendClientMessage(playerid, COLOR_GREY, "   You are not a Car Mechanic!");
		        return 1;
		    }
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /repair [playerid/PartOfName] [price]");
				return 1;
			}
			new playa;
			new money;
			playa = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			money = strval(tmp);
			if(money < 1 || money > 99999) { SendClientMessage(playerid, COLOR_GREY, "   Price not lower then 1, or above 99999!"); return 1; }
			if(IsPlayerConnected(playa))
			{
			    if(playa != INVALID_PLAYER_ID)
			    {
			        if(ProxDetectorS(8.0, playerid, playa)&& IsPlayerInAnyVehicle(playa))
					{
					    if(playa == playerid) { SendClientMessage(playerid, COLOR_GREY, "   Can't do that!"); return 1; }
				    	GetPlayerName(playa, giveplayer, sizeof(giveplayer));

					    format(string, sizeof(string), "* You offerd %s to fix his car for $%d .",giveplayer,money);
						SendClientMessage(playerid, COLOR_WHITE, string);
						format(string, sizeof(string), "* Car Mechanic %s wants to repair your car for $%d, (type /accept repair) to accept.",sendername,money);
						SendClientMessage(playa, COLOR_WHITE, string);
						RepairOffer[playa] = playerid;
						RepairPrice[playa] = money;
					}
					else
					{
					    SendClientMessage(playerid, COLOR_GREY, "   That player is not near you / not in a car.");
					}
				}
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GREY, "   That player is offline.");
			}
		}
		return 1;
	}



Re: mechanical car body fix - emokidx - 22.02.2012

pawn Код:
new Float:h, vid = GetPlayerVehicleID(playerid);
    GetVehicleHealth(vid, h);
    RepairVehicle(vid);
    SetVehicleHealth(vid, h);
i guess..


Re: mechanical car body fix - Wizz123 - 22.02.2012

if(strcmp(cmd, "/repairvehicle", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pLevel] < 3)
{

}
if(IsPlayerInAnyVehicle(playerid))
{
RepairVehicle(GetPlayerVehicleID(playerid));
//SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0);
SendClientMessage(playerid, COLOR_GREY, " You've repaired the body of the vehicle !");
}
}
return 1;
}


Re: mechanical car body fix - viddo - 22.02.2012

@ wIZZ123 this repairs the body + the engine i want it to fix the body only


Re: mechanical car body fix - Campbell- - 22.02.2012

Well, the body will be repaired once you set the vehicle health to 1.000. So you need to create a request if engine_repaired is true or false. Like that you can always check if the engine is repaired or not and like that you'll be able to seperate the engine from the body. However, you will need to include this request if the engine is repaired or not whenever you would like to eigher repair the engine or start the engine.