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



Fix Car - mortallx - 30.03.2009

Someone can give me the script who fix automaticly car when is broken?
srry for my english


Re: Fix Car - NtCat - 30.03.2009

OnGameModeInit
Код:
SetTimer("CheckBrokenCars",1000,true);
Код:
forward CheckBrokenCars();
public CheckBrokenCars()
{
  for(new i;i<MAX_PLAYERS;i++) // i am not absolutely sure about this cycle for controlling all players, i donґt have pawno here, so I canґt control it, so i want someone else to do it ;)
  {
     if(IsPlayerConnected && IsPlayerInAnyVehicle)
     {
        new car = GetPlayerVehicleID(i);
        if(GetVehicleHealth(car) < 1000) SetVehicleHealth(car,1000.0);
     }
  }
}
It should be right. If you donґt understand to something, just write. Note: It just repair engine of car, so it wonґt explode or something, but you canґt repair carґs body, just in PayґnґSpray/ModShop.


Yours sincerely
NtCat


Re: Fix Car - mortallx - 30.03.2009

thxxxx
Can you say me how can add more objects please ?



Re: Fix Car - mortallx - 30.03.2009

some errors D:\Games\GTASAN~1\GTASAN~1\GAMEMO~1\TEST.pwn(230) : warning 217: loose indentation
D:\Games\GTASAN~1\GTASAN~1\GAMEMO~1\TEST.pwn(230) : error 029: invalid expression, assumed zero
D:\Games\GTASAN~1\GTASAN~1\GAMEMO~1\TEST.pwn(230) : error 017: undefined symbol "CheckBrokenCars"
D:\Games\GTASAN~1\GTASAN~1\GAMEMO~1\TEST.pwn(231) : error 029: invalid expression, assumed zero
D:\Games\GTASAN~1\GTASAN~1\GAMEMO~1\TEST.pwn(231) : error 017: undefined symbol "CheckBrokenCars"
D:\Games\GTASAN~1\GTASAN~1\GAMEMO~1\TEST.pwn(235) : error 076: syntax error in the expression, or invalid function call
D:\Games\GTASAN~1\GTASAN~1\GAMEMO~1\TEST.pwn(23 : warning 202: number of arguments does not match definition
D:\Games\GTASAN~1\GTASAN~1\GAMEMO~1\TEST.pwn(243) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


Re: Fix Car - worxds - 30.03.2009

Change line:

if(IsPlayerConnected && IsPlayerInAnyVehicle)
to

if(IsPlayerConnected(playerid) && IsPlayerInAnyVehicle(playerid))


Re: Fix Car - mortallx - 30.03.2009

with this code i have 15 errors


Re: Fix Car - 1337pr0 - 30.03.2009

OnGameModeInit
Код:
SetTimer("CheckBrokenCars",1000,true);
Код:
forward CheckBrokenCars();
public CheckBrokenCars()
{
  for(new i; i<MAX_PLAYERS; i++)
  {
     if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
     {
        new car = GetPlayerVehicleID(i), Float:carhp;
        GetVehicleHealth(car, carhp);
        if(carhp < 1000) SetVehicleHealth(car,1000);
     }
  }
}



Re: Fix Car - mortallx - 30.03.2009

lol 26 errors


Re: Fix Car - ICECOLDKILLAK8 - 30.03.2009

pawn Код:
// Top of script
forward CheckBrokenCars();

// OnGameModeInit
SetTimer("CheckBrokenCars",1000,true);

// Somewhere in your script
public CheckBrokenCars()
{
   for(new i; i<MAX_PLAYERS; i++)
   {
     if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
     {
        new car = GetPlayerVehicleID(i), Float:carhp;
        GetVehicleHealth(car, carhp);
        if(carhp < 1000)
        {
          SetVehicleHealth(car,1000);
        }
     }
   }
}



Re: Fix Car - mortallx - 30.03.2009

that's work thankx
but i get this now error 017: undefined symbol "CheckBrokenCars