01.03.2012, 01:57
(
Последний раз редактировалось Jagofr; 10.03.2012 в 01:58.
)
NOTE TO ALL: I ain't no MASTER Scripter but I ain't no beginner either. I know what I put in my scripts, and if you don't like the tutorials I make and you just came to critisize rather than to correct or alert of mis-input , Please, Leave now.
Hey! I decided to make a small tutorial on how to make a very, very, very, very simple auto repair code.
Its not a filterscript but to be incorperated in your gamemode/own FS whatever...
All you do at the top of the script add:
What this is, it is a forward to create a public function.
Now at the end of your script add
Corrected by NeTuddMeg
This is what is called when this public function happens.
Now how does this function activate? A timer!
Under OnGameModeInit() add:
This is the timer that calls our function!
It is a 1sec timer. It's in milliseconds you can change time to whatever you please.
Thats it! When you're done it should look something like this.
I just had this snippet in my GM so I decided to share it. It is simpler than downloading a mega complexed Auto-Repair FS. It works 100%
I hope this helps! +Rep if this was useful and not a repost of someone else's tutorial.. :S
(I'm sorry if this is a repost. I didn't decide to look because I made this on my own so...)
(Simpler way Pending.........)
Hey! I decided to make a small tutorial on how to make a very, very, very, very simple auto repair code.
Its not a filterscript but to be incorperated in your gamemode/own FS whatever...
All you do at the top of the script add:
pawn Код:
forward Rep(); //You can change Rep to anything you like
Now at the end of your script add
pawn Код:
public Rep() //Change "Rep" to whatever you named at forward. This is important
{
for(new i = 0; i < MAX_PLAYERS; i++)
if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i)) RepairVehicle(GetPlayerVehicleID(i));
}
This is what is called when this public function happens.
Now how does this function activate? A timer!
Under OnGameModeInit() add:
pawn Код:
SetTimer("Rep",1000,true); //Change "Rep" to whatever you named at forward. This is important.
It is a 1sec timer. It's in milliseconds you can change time to whatever you please.
Thats it! When you're done it should look something like this.
pawn Код:
#include <a_samp>
forward Rep(playerid,vehicleid);
public OnGameModeInit()
{
SetTimer("Rep",1000,true);
}
public Rep(playerid,vehicleid)
{
vehicleid = GetPlayerVehicleID(playerid);
RepairVehicle(vehicleid);
}
I hope this helps! +Rep if this was useful and not a repost of someone else's tutorial.. :S
(I'm sorry if this is a repost. I didn't decide to look because I made this on my own so...)
(Simpler way Pending.........)