[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
#2

Quote:
Originally Posted by Antonio (eternalrp.webatu.com)
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

Can you repeat that? I am a little confused. What if I want a clover to be a God car? Can I do that?

I pasted your filter script into the plugins directory and called it GodCar.amx. It doesn't seem to work. Please explain more.
Reply
#3

This isn't a filterscript, its made to add into your GM. You can make any car you want a God Car, all you need to do use the command.
Reply
#4

Identation is your friend .
Reply
#5

I've never indented, nor did I learn. If anybody wishes to teach me the fast way to indent, thanks
Reply
#6

Quote:
Originally Posted by Antonio (eternalrp.webatu.com)
I've never indented, nor did I learn. If anybody wishes to teach me the fast way to indent, thanks
DracoBlue is your friend


http://dracoblue.net/tidy/pawn/
Reply
#7

You can just use OnVehicleDamageStatusUpdate(vehicleid, playerid) instead of a timer

pawn Код:
public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
  if(vehicleid==MyVehicle)RepairVehicle(vehicleid);
  return 1;
}
Reply
#8

Ah I love you joe, you got MSN?
Reply
#9

why have a 2000 array? I doubt you'd make them all god cars, I'd use PVars so that when the player disconnects the car is no longer godly.

also I'd do what joe said, but when the car flips it'll still decrease and it'll eventually blow up, for this I'd put in
Код:
public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
  if(vehicleid==MyVehicle)RepairVehicle(vehicleid);
  new Float:health;
  GetVehicleHealth(vehicleid,health);
  if(floatcmp(300.0,health) == 1)
  {
    new Float:pR;
    GetVehicleZAngle(GetPlayerVehicleID(id), pR);
    SetVehicleZAngle(GetPlayerVehicleID(id), pR);
  }
  return 1;
}
Reply
#10

Ok ok im sorry! My tutorial is shat! lol
Reply
#11

Code:
public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
  if(vehicleid==MyVehicle)RepairVehicle(vehicleid);
  new Float:health;
  GetVehicleHealth(vehicleid,health);
  if(floatcmp(300.0,health) == 1)
  {
    new Float:pR;
    GetVehicleZAngle(GetPlayerVehicleID(id), pR);
    SetVehicleZAngle(GetPlayerVehicleID(id), pR);
  }
  return 1;
}
pawn Code:
C:\DOCUME~1\JANDRE~1\Desktop\GTASA-~1\GAMEMO~1\zombies.pwn(254) : error 017: undefined symbol "MyVehicle"
C:\DOCUME~1\JANDRE~1\Desktop\GTASA-~1\GAMEMO~1\zombies.pwn(260) : error 017: undefined symbol "id"
C:\DOCUME~1\JANDRE~1\Desktop\GTASA-~1\GAMEMO~1\zombies.pwn(261) : error 017: undefined symbol "id"
I get these errors when I use that method.
[/quote]
Reply
#12

change 'MyVehicle' to 'IsGodCar' and the 'id' to 'playerid'
Reply
#13

I am using the original method for ADMINS ONLY, and I keep getting these errors:

pawn Code:
C:\DOCUME~1\JANDRE~1\Desktop\GTASA-~1\GAMEMO~1\zombies.pwn(100) : error 017: undefined symbol "cmd"
C:\DOCUME~1\JANDRE~1\Desktop\GTASA-~1\GAMEMO~1\zombies.pwn(104) : error 017: undefined symbol "carid"
C:\DOCUME~1\JANDRE~1\Desktop\GTASA-~1\GAMEMO~1\zombies.pwn(105) : error 017: undefined symbol "carid"
C:\DOCUME~1\JANDRE~1\Desktop\GTASA-~1\GAMEMO~1\zombies.pwn(106) : error 017: undefined symbol "carid"
C:\DOCUME~1\JANDRE~1\Desktop\GTASA-~1\GAMEMO~1\zombies.pwn(115) : warning 209: function "OnPlayerCommandText" should return a value
Reply
#14

Do you guys know how I can fix that?
Reply
#15

Send me your 'OnPlayerCommandText' on http://pastebin.com .. ill fix it for you.
Reply
#16

http://pastebin.com/bZPbcyv8

That's it, it'd be great if you could help me with it.
Reply
#17

http://pastebin.com/XhsxLfmM

Try that
Reply
#18

How do I copy it without it having the line number when I post it in Pawno?
Reply
#19

Never mind, I got it, but it's still saying:
pawn Code:
C:\DOCUME~1\JANDRE~1\Desktop\GTASA-~1\GAMEMO~1\zombies.pwn(104) : error 017: undefined symbol "carid"
C:\DOCUME~1\JANDRE~1\Desktop\GTASA-~1\GAMEMO~1\zombies.pwn(105) : error 017: undefined symbol "carid"
C:\DOCUME~1\JANDRE~1\Desktop\GTASA-~1\GAMEMO~1\zombies.pwn(106) : error 017: undefined symbol "carid"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase
Reply
#20

My mistake.. THIS compiles

http://pastebin.com/jrdPkTqG
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)