Godmode for some cars
#1

hey guys i have a mega loop createt but if i drive them it blow up its to big and i want now that 6 of my cars have godmode can someone help me?
Reply
#2

Just do like
pawn Код:
new GodCars[6];

//OnGameModeInit
GodCars[0] = AddStaticVehicle(Blah blahj blah);
GodCars[1] = AddStaticVehicle(Blah blahj blah);
GodCars[2] = AddStaticVehicle(Blah blahj blah);
//etc...

SetVehicleHealth(GodCars[0], 100000);
SetVehicleHealth(GodCars[1], 100000);
SetVehicleHealth(GodCars[2], 100000);
//etc...

//OnVehicleSpawn
if(vehicleid == GodCars[0])
{
  SetVehicleHealth(GodCars[0], 100000);
}
if(vehicleid == GodCars[1])
{
  SetVehicleHealth(GodCars[1], 100000);
}

//etc...
The vehicles will be really hard to blow up. Even if they do it will be reset when they spawn.
Reply
#3

wont work i addet it like this:
Код:
new GodCars[6];
Код:
    GodCars[0] = AddStaticVehicleEx(411,1507.6937,1174.0288,326.1282,359.4708,116,1, 20); // infe lv
	GodCars[1] = AddStaticVehicleEx(411,1504.5143,1174.0742,326.1289,359.1254,112,1, 20); // infe lv 1
	GodCars[2] = AddStaticVehicleEx(411,1501.4204,1174.0099,326.1299,359.5850,106,1, 20); // infe lv
	GodCars[3] = AddStaticVehicleEx(411,1495.9490,1173.9745,326.1282,359.8535,80,1, 20); // infe lv
	GodCars[4] = AddStaticVehicleEx(411,1492.8213,1174.0062,326.1282,359.4546,75,1, 20); // infe lv
	GodCars[5] = AddStaticVehicleEx(411,1489.5162,1173.9971,326.1259,0.3766,12,1, 20); // infe lv
Код:
public OnVehicleSpawn(vehicleid)
{
if(vehicleid == GodCars[0])
{
	SetVehicleHealth(GodCars[0], 100000);
}
if(vehicleid == GodCars[1])
{
	SetVehicleHealth(GodCars[1], 100000);
}
if(vehicleid == GodCars[2])
{
  	SetVehicleHealth(GodCars[2], 100000);
}
if(vehicleid == GodCars[3])
{
  	SetVehicleHealth(GodCars[3], 100000);
}
if(vehicleid == GodCars[4])
{
  	SetVehicleHealth(GodCars[4], 100000);
}
if(vehicleid == GodCars[5])
{
  	SetVehicleHealth(GodCars[5], 100000);
}
}
Reply
#4

When a vehicle is created, it doesn't count as spawn, destroy the car first or do SetVehiclehealth(GodCar[0],1000000); right after its creation.
Reply
#5

nothing, i was wrong
Reply
#6

Quote:
Originally Posted by Seif_
You too.
pawn Код:
public OnVehicleSpawn(vehicleid)
{
    if(vehicleid == GodCars[0] || vehicleid == GodCars[1] || vehicleid == GodCars[2] || vehicleid == GodCars[3] || vehicleid == GodCars[4] || vehicleid == GodCars[5])
        SetVehicleHealth(vehicleid, 100000000);
    return 1;
}
I am loser Anyways, error is in one word
Reply
#7

Quote:
Originally Posted by Schock
wont work i addet it like this:
Код:
new GodCars[6];
Код:
    GodCars[0] = AddStaticVehicleEx(411,1507.6937,1174.0288,326.1282,359.4708,116,1, 20); // infe lv
	GodCars[1] = AddStaticVehicleEx(411,1504.5143,1174.0742,326.1289,359.1254,112,1, 20); // infe lv 1
	GodCars[2] = AddStaticVehicleEx(411,1501.4204,1174.0099,326.1299,359.5850,106,1, 20); // infe lv
	GodCars[3] = AddStaticVehicleEx(411,1495.9490,1173.9745,326.1282,359.8535,80,1, 20); // infe lv
	GodCars[4] = AddStaticVehicleEx(411,1492.8213,1174.0062,326.1282,359.4546,75,1, 20); // infe lv
	GodCars[5] = AddStaticVehicleEx(411,1489.5162,1173.9971,326.1259,0.3766,12,1, 20); // infe lv
Код:
public OnVehicleSpawn(vehicleid)
{
if(vehicleid == GodCars[0])
{
	SetVehicleHealth(GodCars[0], 100000);
}
if(vehicleid == GodCars[1])
{
	SetVehicleHealth(GodCars[1], 100000);
}
if(vehicleid == GodCars[2])
{
  	SetVehicleHealth(GodCars[2], 100000);
}
if(vehicleid == GodCars[3])
{
  	SetVehicleHealth(GodCars[3], 100000);
}
if(vehicleid == GodCars[4])
{
  	SetVehicleHealth(GodCars[4], 100000);
}
if(vehicleid == GodCars[5])
{
  	SetVehicleHealth(GodCars[5], 100000);
}
}
That's why I put the health part under OnGameModeInit.
Reply
#8

it dont work ... can someone post a working part?
Reply
#9

Quote:
Originally Posted by Schock
it dont work ... can someone post a working part?
Then you're doing it wrong.
Reply
#10

Код:
forward IsAGodCars(carid);

new GodCars1(carid);
new GodCars2(carid);

public IsAGodCars(carid)
{
       if(carid == GodCars1 || carid == GodCars2)
  	{
		return 1;
	}
	return 0;
}

Ongamemodeinit:

       GodCars1 = CreateVehicle(411,1507.6937,1174.0288,326.1282,359.4708,116,1, 20,300000); // infe lv
	GodCars2 = CreateVehicle(411,1504.5143,1174.0742,326.1289,359.1254,112,1, 20,300000); // infe lv 1


public OnVehicleSpawn(vehicleid)
{
   if(IsAGodCars(vehicleid))
   {
   	DestroyVehicle(vehicleid);
 		if(vehicleid == GodCars1)
 	  {CreateVehicle(411,1507.6937,1174.0288,326.1282,359.4708,116,1, 20,300000); }
 		else if(vehicleid == GodCars2)
 	  {CreateVehicle(411,1504.5143,1174.0742,326.1289,359.1254,112,1, 20,300000);}
   	SetVehicleHealth(vehicleid, 2000); // Set Car HP 2000
	 }
   return 1;
}
It's work but only after first car death, I try put SetVehicleToRespawn(GodCars1); ongamemodeinit but it's not work
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)