SA-MP Forums Archive
Adding cars for factions - 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: Adding cars for factions (/showthread.php?tid=156027)



Adding cars for factions - ls200 - 20.06.2010

how can i add cars for some of my factions? im using raven's roleplay v2.5 atm


Re: Adding cars for factions - ls200 - 20.06.2010

help please


Re: Adding cars for factions - ls200 - 21.06.2010

Can anyone help me please?


Re: Adding cars for factions - ledzep - 21.06.2010

After a quick look through the script, it looks very much like your run of the mill GF edit, so adding faction cars will not be very simple for a beginner.

Since I guess you do not want to count hundreds of lines of messy code, we will create a variable to store the new vehicle's vehicleid.

What you have to do is store the vehicleid of the new faction car you want to add in some variable like so:

Код:
OnGameModeInit(){
    ...
	AddStaticVehicleEx(463,694.8008,-470.2188,15.8761,88.6982,114,114,30000); // Freeway 7
	AddStaticVehicleEx(463,694.9393,-473.1948,15.8766,94.6246,114,114,30000); // Freeway 8
	AddStaticVehicleEx(463,708.5647,-467.8399,15.8754,271.5996,114,114,30000); // Freeway 9
	AddStaticVehicleEx(463,708.6929,-470.7145,15.8735,268.4506,114,114,30000); // Freeway 10

    factionCar1 = AddStaticVehicleEx(463,708.6929,-470.7145,15.8735,268.4506,114,114,30000); // New LA Vice car we are adding, yay!
}
and then edit the function that corresponds to which faciton you are adding the car to so they can use it exclusively (we are giving this car to faction 5 [aka LA Vice]).

Код:
public IsAGangCar5(carid)
{
	if((carid >= 17 && carid <= 18) || (carid == 44) || (carid == 134) || (carid == 1359) || (carid == factionCar1) ) // we edited this line
	{
		return 1;
	}
	return 0;
}
Hope that helps.


Re: Adding cars for factions - oOhossamOo - 21.06.2010

Quote:
Originally Posted by ledzep
After a quick look through the script, it looks very much like your run of the mill GF edit, so adding faction cars will not be very simple for a beginner.

Since I guess you do not want to count hundreds of lines of messy code, we will create a variable to store the new vehicle's vehicleid.

What you have to do is store the vehicleid of the new faction car you want to add in some variable like so:

Код:
OnGameModeInit(){
    ...
	AddStaticVehicleEx(463,694.8008,-470.2188,15.8761,88.6982,114,114,30000); // Freeway 7
	AddStaticVehicleEx(463,694.9393,-473.1948,15.8766,94.6246,114,114,30000); // Freeway 8
	AddStaticVehicleEx(463,708.5647,-467.8399,15.8754,271.5996,114,114,30000); // Freeway 9
	AddStaticVehicleEx(463,708.6929,-470.7145,15.8735,268.4506,114,114,30000); // Freeway 10

    factionCar1 = AddStaticVehicleEx(463,708.6929,-470.7145,15.8735,268.4506,114,114,30000); // New LA Vice car we are adding, yay!
}
and then edit the function that corresponds to which faciton you are adding the car to so they can use it exclusively (we are giving this car to faction 5 [aka LA Vice]).

Код:
public IsAGangCar5(carid)
{
	if((carid >= 17 && carid <= 18) || (carid == 44) || (carid == 134) || (carid == 1359) || (carid == factionCar1) ) // we edited this line
	{
		return 1;
	}
	return 0;
}
Hope that helps.
why faction AddStaticVehicleEx ? i always use AddStaticVehicle !
i think your faction will auto tune car!


Re: Adding cars for factions - ledzep - 21.06.2010

I'm just trying to keep the code looking uniform.

I agree. I myself would use CreateVehicle just because I like the option of being able to destroy any car I want.


Re: Adding cars for factions - ls200 - 21.06.2010

Quote:
Originally Posted by ledzep
After a quick look through the script, it looks very much like your run of the mill GF edit, so adding faction cars will not be very simple for a beginner.

Since I guess you do not want to count hundreds of lines of messy code, we will create a variable to store the new vehicle's vehicleid.

What you have to do is store the vehicleid of the new faction car you want to add in some variable like so:

Код:
OnGameModeInit(){
    ...
	AddStaticVehicleEx(463,694.8008,-470.2188,15.8761,88.6982,114,114,30000); // Freeway 7
	AddStaticVehicleEx(463,694.9393,-473.1948,15.8766,94.6246,114,114,30000); // Freeway 8
	AddStaticVehicleEx(463,708.5647,-467.8399,15.8754,271.5996,114,114,30000); // Freeway 9
	AddStaticVehicleEx(463,708.6929,-470.7145,15.8735,268.4506,114,114,30000); // Freeway 10

    factionCar1 = AddStaticVehicleEx(463,708.6929,-470.7145,15.8735,268.4506,114,114,30000); // New LA Vice car we are adding, yay!
}
and then edit the function that corresponds to which faciton you are adding the car to so they can use it exclusively (we are giving this car to faction 5 [aka LA Vice]).

Код:
public IsAGangCar5(carid)
{
	if((carid >= 17 && carid <= 18) || (carid == 44) || (carid == 134) || (carid == 1359) || (carid == factionCar1) ) // we edited this line
	{
		return 1;
	}
	return 0;
}
Hope that helps.
can you explain these numbers: factionCar1 = AddStaticVehicleEx(463,708.6929,-470.7145,15.8735,268.4506,114,114,30000);
463 is model is then the three next is coordinates or?

also
got
some errors
Код:
C:\Documents and Settings\Martin\Skrivebord\gta server ftw\ser 0.3\gamemodes\larp.pwn(5463) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Martin\Skrivebord\gta server ftw\ser 0.3\gamemodes\larp.pwn(5463) : error 017: undefined symbol "factionCar1"
C:\Documents and Settings\Martin\Skrivebord\gta server ftw\ser 0.3\gamemodes\larp.pwn(5463 -- 5465) : error 001: expected token: "}", but found "return"
C:\Documents and Settings\Martin\Skrivebord\gta server ftw\ser 0.3\gamemodes\larp.pwn(5463 -- 5465) : fatal error 107: too many error messages on one line
heres the code i cahnged/added
Код:
public IsAGangCar2(carid)
{
if(carid >= 97 && carid <= 99) || (carid == factionCar1)
	{
		return 1;
	}
	return 0;
}
and
Код:
	    factionCar1 = AddStaticVehicleEx(451,1246.77,-803.84.14,15.8735,268.4506,114,114,30000); // turismo



Re: Adding cars for factions - DJDhan - 21.06.2010

AddStaticVehicleEx @ WIKI


Re: Adding cars for factions - ls200 - 21.06.2010

But i got some errors
Код:
C:\Documents and Settings\Martin\Skrivebord\gta server ftw\ser 0.3\gamemodes\larp.pwn(5463) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Martin\Skrivebord\gta server ftw\ser 0.3\gamemodes\larp.pwn(5463) : error 017: undefined symbol "factionCar1"
C:\Documents and Settings\Martin\Skrivebord\gta server ftw\ser 0.3\gamemodes\larp.pwn(5463 -- 5465) : error 001: expected token: "}", but found "return"
C:\Documents and Settings\Martin\Skrivebord\gta server ftw\ser 0.3\gamemodes\larp.pwn(5463 -- 5465) : fatal error 107: too many error messages on one line
heres the code i cahnged/added
Код:
public IsAGangCar2(carid)
{
if(carid >= 97 && carid <= 99) || (carid == factionCar1)
	{
		return 1;
	}
	return 0;
}
and
Код:
	    factionCar1 = AddStaticVehicleEx(451,1246.77,-803.84.14,15.8735,268.4506,114,114,30000); // turismo



Re: Adding cars for factions - ledzep - 21.06.2010

Somewhere near the top of your script add:

Код:
new factionCar1;
Your brackets didn't match up:

Код:
public IsAGangCar2(carid)
{
    if((carid >= 97 && carid <= 99) || (carid == factionCar1))
	{
		return 1;
	}
	return 0;
}