Fix Car
#1

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

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

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

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

Change line:

if(IsPlayerConnected && IsPlayerInAnyVehicle)
to

if(IsPlayerConnected(playerid) && IsPlayerInAnyVehicle(playerid))
Reply
#6

with this code i have 15 errors
Reply
#7

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

lol 26 errors
Reply
#9

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)