SA-MP Forums Archive
Where must i put this? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Where must i put this? (/showthread.php?tid=137552)



Where must i put this? - yoan103 - 29.03.2010

So where must i put this for vehicle auto repair?
Код:
new vehicleid = GetPlayerVehicleID(playerid);
new Float:VehHealth;
GetVehicleHealth(vehicleid,VehHealth);
if(VehHealth <= 50) return RepairVehicle(GetPlayerVehicleID(playerid));
PlayerPlaySound(playerid, 1056, 0.0,0.0, 0.0);
SendClientMessage(playerid, COLOR_KRED, "Your vehicle has been fixed");
and also when i type /setcarhealth it shows me "Your vehicle has been fixed" and SERVER:Unknown command WHYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY


Re: Where must i put this? - Naxix - 29.03.2010

Depends, do you want it like a command or how should it work?


Re: Where must i put this? - yoan103 - 29.03.2010

If a player's vehicle is smoking i want it to say in COLOR_KRED your vehicle has been fixed, and ofcourse to fix it


Re: Where must i put this? - Naxix - 29.03.2010

You cut make a timer, to check if the vehcile's health is low:

on top of your script put
Код:
forward vcheck();
OnGameModeInnit:
Код:
   SetTimer("vcheck",500,1);
Bottom of script:
Код:
public vcheck()
{
   if(GetVehicleHealth(vehcileid) < 300)
   {
       new vehicleid = GetPlayerVehicleID(playerid);
       new Float:VehHealth;
       GetVehicleHealth(vehicleid,VehHealth);
       if(VehHealth <= 50) return RepairVehicle(GetPlayerVehicleID(playerid));
       PlayerPlaySound(playerid, 1056, 0.0,0.0, 0.0);
       SendClientMessage(playerid, COLOR_KRED, "Your vehicle has been fixed");
       return 1;
   }
    return 1;
}
And because your cmd says SERVER: Unknow command
is becuase you have "return 0;" under OnPlayerCommand