RepairVehicle doesn't work
#1

Hey Guys,

I noticed, that the 0.3 function RepairVehicle doesn't work on my server.
Is there a problem in my script or with the vehicle streamer?

Код:
if(strcmp(cmd, "/fixveh", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	    
			if(PlayerInfo[playerid][pAdmin] >= 1)
			{
				if(IsPlayerInAnyVehicle(playerid))
				{
				  SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0);
				  RepairVehicle(playerid);
				}
  				return 1;
			}
		}
		return 1;
	}
Reply
#2

Quote:
Originally Posted by Stas92
Код:
RepairVehicle(playerid);
RepairVehicle function requires a vehicleid parameter, not playerid.
Reply
#3

It dosent work like that,
In the future check the wiki = https://sampwiki.blast.hk/wiki/RepairVehicle

pawn Код:
if(strcmp(cmd, "/fixveh", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
       
            if(PlayerInfo[playerid][pAdmin] >= 1)
            {
                if(IsPlayerInAnyVehicle(playerid))
                {
                  SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0);
                  RepairVehicle(GetPlayerVehicleID(playerid));
                }
                return 1;
            }
        }
        return 1;
    }
Reply
#4

the problem is that you used " RepairVehicle(playerid); "
it soppose to be : "RepairVehicle(vehicleid);" I think

Also SetVehicleHealth is not needed before RepairVehicle, that might bug the code.
Reply
#5

pawn Код:
if(!strcmp(cmd, "/fixveh", true))
{
  if(PlayerInfo[playerid][pAdmin] >= 1)
  {
   RepairVehicle(GetPlayerVehicleID(playerid));
   return 1;
  }
}
Reply
#6

Код:
if(!strcmp(cmd, "/fixveh", true))
{
	    
	if(PlayerInfo[playerid][pAdmin] < 1)return 1;
	if(IsPlayerInAnyVehicle(playerid))RepairVehicle(GetPlayerVehicleID(playerid));
	return 1;
}
Reply
#7

You're right. I am stupid -.-
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)