SA-MP Forums Archive
Help - 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: Help (/showthread.php?tid=574119)



Help - BlackEvils - 13.05.2015

Why thats code doesn't work ?

new vehicle;
vehicle = GetPlayerVehicleID(playerid);
if(vehicle == 560)
{
SendClientMessage(playerid,COLORE_ROSSO,"ERROR:You can't repair that vehicle.");
}
else
{
if (IsPlayerInAnyVehicle(playerid))
{
new VehicleID = GetPlayerVehicleID(playerid);
PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
RepairVehicle(VehicleID);
GameTextForPlayer(playerid,"~w~~n~~n~~n~~n~~n~~n~V ehicle ~g~Repaired!",3000,3);
return SetVehicleHealth(VehicleID, 1000);
}
}
}
return 1;
}


Re: Help - Konstantinos - 13.05.2015

You need to check the model ID and not the vehicle ID.

PHP код:
new vehicle GetPlayerVehicleID(playerid);
if(
GetVehicleModel(vehicle) == 560SendClientMessage(playerid,COLORE_ROSSO,"ERROR:You can't repair that vehicle.");
else
{
    if (
vehicle// if not 0, player is in vehicle
    
{
        
PlayerPlaySound(playerid11330.00.00.0);
        
RepairVehicle(vehicle);
        
GameTextForPlayer(playerid,"~w~~n~~n~~n~~n~~n~~n~V ehicle ~g~Repaired!",3000,3);
        
SetVehicleHealth(vehicle1000);
    }




Re: Help - BlackEvils - 13.05.2015

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
You need to check the model ID and not the vehicle ID.

PHP код:
new vehicle GetPlayerVehicleID(playerid);
if(
GetVehicleModel(vehicle) == 560SendClientMessage(playerid,COLORE_ROSSO,"ERROR:You can't repair that vehicle.");
else
{
    if (
vehicle// if not 0, player is in vehicle
    
{
        
PlayerPlaySound(playerid11330.00.00.0);
        
RepairVehicle(vehicle);
        
GameTextForPlayer(playerid,"~w~~n~~n~~n~~n~~n~~n~V ehicle ~g~Repaired!",3000,3);
        
SetVehicleHealth(vehicle1000);
    }

thx you work !