SA-MP Forums Archive
[HELP] Auto Repair HELPPPPPPPPPPPPPPPPPPPPP - 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: [HELP] Auto Repair HELPPPPPPPPPPPPPPPPPPPPP (/showthread.php?tid=66132)



[HELP] Auto Repair HELPPPPPPPPPPPPPPPPPPPPP - Hot - 19.02.2009

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);
}
  }
}



Re: [HELP] Auto Repair - Karlip - 19.02.2009

Got a timer to make it work?


Re: [HELP] Auto Repair - walrus - 19.02.2009

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


Re: [HELP] Auto Repair - Hot - 19.02.2009

I don't know how to put a timer


Re: [HELP] Auto Repair - Grim_ - 19.02.2009

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



Re: [HELP] Auto Repair - Redirect Left - 19.02.2009

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.


Re: [HELP] Auto Repair - yom - 19.02.2009

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.


Re: [HELP] Auto Repair - Grim_ - 19.02.2009

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.


Re: [HELP] Auto Repair HELPPPPPPPPPPPPPPPPPPPPP - Mikep - 20.02.2009

Don't forget to return 1; kids.


Re: [HELP] Auto Repair HELPPPPPPPPPPPPPPPPPPPPP - tehcudguy - 20.02.2009

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