SA-MP Forums Archive
/repair not working - 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: /repair not working (/showthread.php?tid=435022)



/repair not working - CrystalMethod - 05.05.2013

Alrighty, in the need of help again.
Код:
if(strcmp("/repair", cmdtext, true, 10) == 0)
	{
	    SetVehicleHealth(playerid,100);
	    SendClientMessage(playerid, WHITE, "Your vehicle has been repaired!");
	    return 1;
	}
This isn't repairing my vehicle. I imagine it's an easy fix, but I'm stumped.
Any help?


Re: /repair not working - Gamer_007 - 05.05.2013

pawn Код:
SetVehicleHealth(GetPlayerVehicleID(playerid),100);
Enjoy!


Re: /repair not working - Giroud12 - 05.05.2013

pawn Код:
if(strcmp("/repair", cmdtext, true, 10) == 0)
{
 if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_YELLOW,"You must be inside vehicle to use this command!");
    if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, COLOR_YELLOW,"You do not have enough money to repair your vehicle!");
    RepairVehicle(GetPlayerVehicleID(playerid));
    SendClientMessage(playerid,0xFFFF00AA,"Server: Your Vehicle Has Been Repaired!");
return 1;
}



Re: /repair not working - CrystalMethod - 05.05.2013

Quote:
Originally Posted by Gamer_007
Посмотреть сообщение
pawn Код:
SetVehicleHealth(GetPlayerVehicleID(playerid),100);
Enjoy!
I should have seen that earlier ._.
Anyways, that sets the car on fire then it later explodes. ._.


Re: /repair not working - Don_Cage - 05.05.2013

That is cuz vehicles usaly have 1000 as health so putting it 100 is pretty low


Re: /repair not working - CrystalMethod - 05.05.2013

Alright, that fixes that problem.
One issue left. Once repaired, the damaged parts that fell off the vehicle don't return.


AW: /repair not working - ulbi1990 - 05.05.2013

https://sampwiki.blast.hk/wiki/RepairVehicle Should fix your last problem.


Re: /repair not working - Areax - 05.05.2013

PHP код:
CMD:fix(playeridparams[])
{
    new 
string[160];
    if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playeridCOLOR_RED"ERROR: You are not in a vehicle!");
    
RepairVehicle(GetPlayerVehicleID(playerid));
    
GameTextForPlayer(playerid"~g~Fixed!",3000,3);
    
format(stringsizeof(string), "[INFO]: %s Has Fixed His Vehicle."GetName(playerid));
    
SendClientMessageToAll(COLOR_YELLOWstring);
    return 
1;

Edit: To late


Re: /repair not working - zSuYaNw - 05.05.2013

pawn Код:
if(!strcmp("/repair", cmdtext, true))
    {
        if(!IsPlayerInAnyVehicle(playerid))
            return SendClientMessage(playerid, COLOR_YELLOW,"You must be inside vehicle to use this command!");
           
        if(GetPlayerMoney(playerid) < 100)
            return SendClientMessage(playerid, COLOR_YELLOW,"You do not have enough money to repair your vehicle!");
           
        RepairVehicle(GetPlayerVehicleID(playerid));
       
        SendClientMessage(playerid,0xFFFF00AA,"Server: Your Vehicle Has Been Repaired!");
        return 1;
    }



Re: /repair not working - CrystalMethod - 05.05.2013

Many thanks! Problem solved!