[HELP] Auto Repair HELPPPPPPPPPPPPPPPPPPPPP
#1

Mine dosen't work. I just put it on my gamemode.

Код:
public AutoRepair(playerid)
{
  if (IsPlayerInAnyVehicle(playerid))
  {
    new Float:health;
new vehicleid = GetPlayerVehicleID(playerid);
    GetVehicleHealth(vehicleid, health);
if (health < 250)
    {
      SetVehicleHealth(vehicleid,1000);
  GameTextForPlayer(playerid,"~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~Your vehicle has automatically been repaired!",1000,3);
}
  }
}
Reply
#2

Got a timer to make it work?
Reply
#3

Why not to disable car burn & explode. I dont know how... But....
Reply
#4

I don't know how to put a timer
Reply
#5

Quote:
Originally Posted by Hot
I don't know how to put a timer
//Under OnGamemodeInit
pawn Код:
SetTimer("AutoRepair", 1000, 1); // this sets a timer for 1 second
Reply
#6

Quote:
Originally Posted by [RPr
Icy_Cold ]
Quote:
Originally Posted by Hot
I don't know how to put a timer
//Under OnGamemodeInit
pawn Код:
SetTimer("AutoRepair", 1000, 1); // this sets a timer for 1 second
Wouldn't work, his function doesn't have a loop to do all players, he needs a SetTimerEx.
Reply
#7

Quote:
Originally Posted by [RP
Jolteon ]
Wouldn't work, his function doesn't have a loop to do all players, he needs a SetTimerEx.
..or a loop, which is far more recommended than running many timers.
Reply
#8

Quote:
Originally Posted by [RP
Jolteon ]
Quote:
Originally Posted by [RPr
Icy_Cold ]
Quote:
Originally Posted by Hot
I don't know how to put a timer
//Under OnGamemodeInit
pawn Код:
SetTimer("AutoRepair", 1000, 1); // this sets a timer for 1 second
Wouldn't work, his function doesn't have a loop to do all players, he needs a SetTimerEx.
whoops, yea my bad, didn't catch that.
Reply
#9

Don't forget to return 1; kids.
Reply
#10

Add this under "OnPlayerConnect"
pawn Код:
SetTimerEx("AutoRepair",100,true,"d",playerid);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)