[Tutorial] [TuT] Making a real 'God car'
#1

I've seen the attempts, and I'm not sure whether they are what I am going to attempt to do today, but here it goes. Basicly, the function of this 'god car' is to be a car that never
gets damaged. And by that, I mean as in vehicle HP, not looks


Step 1:

At the top of the script, where you keep defines, and forwards, place these lines:
pawn Код:
forward GodCarFix();
new IsGodCar[MAX_VEHICLES];

// the 2 defines below are if you DONT already have them, do NOT add them if you already have them
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_RED 0xAA3333AA
Step 2:

You need to make a command to make the vehicle a god car. Under 'OnPlayerCommandText' add this:
pawn Код:
if(strcmp(cmd, "/setgodcar", true) == 0)
{
if(IsPlayerAdmin(playerid))
{
new string[256];
carid = GetPlayerVehicleID(playerid);
IsGodCar[carid] = 1;
format(string, sizeof(string), "You have made vehicle id %d a god car!", carid);
SendClientMessage(playerid, COLOR_YELLOW, string);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_RED, "You must be an RCON admin to use this command!");
}
return 1;
}
Step 3:

Under 'OnGameModeInit' you need to create a loop that fixes the vehicle (hence, 'God Car')
pawn Код:
SetTimer("GodCarFix", 1000, 1);
Let me break this down. The timer is running a loop, or a function called "GodCarFix", and the 1000 means that its every 1 second, because it is in milliseconds. The '1' at the end shows that it is repeating.

Step 4:

Finally you need to add the function that atcually fixes the car. You can add this anywhere OUTSIDE another function, but it is easiest to just add it at the end of the script..
pawn Код:
public GodCarFix()
{
for(new v=0;v<MAX_VEHICLES;v++)
{
if(IsGodCar[v] == 1)
{
SetVehicleHealth(v, 1000);
}
}
return 1;
}
And thats basicly it! If you have any questions, feel free to reply, or add my msn at fpsgamerz@hotmail.com

Reply


Messages In This Thread
[TuT] Making a real 'God car' - by Antonio [G-RP] - 03.06.2010, 23:42
Re: [TuT] Making a real 'God car' - by mprofitt - 03.06.2010, 23:55
Re: [TuT] Making a real 'God car' - by Antonio [G-RP] - 03.06.2010, 23:56
Re: [TuT] Making a real 'God car' - by [HiC]TheKiller - 04.06.2010, 02:17
Re: [TuT] Making a real 'God car' - by Antonio [G-RP] - 04.06.2010, 02:37
Re: [TuT] Making a real 'God car' - by MWF2 - 04.06.2010, 02:55
Re: [TuT] Making a real 'God car' - by Joe Staff - 04.06.2010, 03:15
Re: [TuT] Making a real 'God car' - by Antonio [G-RP] - 04.06.2010, 03:42
Re: [TuT] Making a real 'God car' - by cessil - 04.06.2010, 04:24
Re: [TuT] Making a real 'God car' - by Antonio [G-RP] - 04.06.2010, 04:29
Re: [TuT] Making a real 'God car' - by Ozwell_Spencer - 04.06.2010, 21:31
Re: [TuT] Making a real 'God car' - by Antonio [G-RP] - 04.06.2010, 21:33
Re: [TuT] Making a real 'God car' - by Ozwell_Spencer - 04.06.2010, 22:08
Re: [TuT] Making a real 'God car' - by Ozwell_Spencer - 04.06.2010, 22:26
Re: [TuT] Making a real 'God car' - by Antonio [G-RP] - 04.06.2010, 22:44
Re: [TuT] Making a real 'God car' - by Ozwell_Spencer - 04.06.2010, 22:52
Re: [TuT] Making a real 'God car' - by Antonio [G-RP] - 04.06.2010, 22:59
Re: [TuT] Making a real 'God car' - by Ozwell_Spencer - 04.06.2010, 23:02
Re: [TuT] Making a real 'God car' - by Ozwell_Spencer - 04.06.2010, 23:04
Re: [TuT] Making a real 'God car' - by Antonio [G-RP] - 04.06.2010, 23:06
Re: [TuT] Making a real 'God car' - by Ozwell_Spencer - 04.06.2010, 23:24
Re: [TuT] Making a real 'God car' - by Antonio [G-RP] - 04.06.2010, 23:34
Re: [TuT] Making a real 'God car' - by Ozwell_Spencer - 05.06.2010, 03:39
Re: [TuT] Making a real 'God car' - by Antonio [G-RP] - 05.06.2010, 03:56
Re: [TuT] Making a real 'God car' - by Joe_ - 05.06.2010, 09:41
Re: [TuT] Making a real 'God car' - by Owenlishious - 17.06.2010, 02:19
Re: [TuT] Making a real 'God car' - by r3k1lLz_ - 31.08.2010, 07:29

Forum Jump:


Users browsing this thread: 4 Guest(s)