/repair not working
#1

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

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

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;
}
Reply
#4

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

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

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

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

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

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;
    }
Reply
#10

Many thanks! Problem solved!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)