Team Vehicles Non-Damage
#1

Guys, I've read this tutorial, but it order to achieve what I want, I might have to redo my whole vehicle system or request class section. (https://sampforum.blast.hk/showthread.php?tid=160810)

Surely, there must be another way to make team vehicles receive non damage from team mates? But it has to be a smart system too, cause etc. if an enemy hijacks a team vehicle and a team members shoots at the stolen car, it won't receive damage, so it should check for the driver I think?

I'll post bits of my code below, hopefully you guys can help me make the team vehicles take non damage from team members.

Код:
static gTeam[MAX_PLAYERS];
new gTeam[MAX_PLAYERS];
new gPlayerClass[MAX_PLAYERS];
I have this on top of my script. Aight moving on.....

Код:
AddPlayerClass(105, 2519.1033,-1678.6353,14.6157,87.0213, 24, 150, 32, 600, 25, 250); //Grove Street
	AddPlayerClass(106, 2512.2603,-1651.3379,13.9391,132.4550, 22, 150, 32, 500, 30, 500); 
	AddPlayerClass(107, 2459.5808,-1689.7971,13.5426,359.6238, 22, 150, 32, 500, 27, 250); 

        AddPlayerClass(280, 1549.7544,-1669.8805,13.5638,87.6390, 24, 150, 29, 600, 25, 250);//Cops
	AddPlayerClass(285, 1551.6106,-1675.4189,15.9244,89.5190, 22, 150, 28, 500, 31, 500); 
	AddPlayerClass(286, 1549.6788,-1680.9287,13.5561,91.4223, 22, 150, 29, 500, 27, 250);
I have this at OnGameModeInIt. As the first team is Grove street, and the 2nd team is COPS.

Код:
AddStaticVehicle(534,2504.8987,-1679.4121,13.1855,318.9716,86,86); //Grove Remington
	AddStaticVehicle(567,2485.8904,-1653.4761,13.2677,90.7244,86,86); //Grove Savanna
	AddStaticVehicle(567,2473.7012,-1694.4086,13.2224,359.9055,86,86); //Grove Turismo
	AddStaticVehicle(461,2469.3279,-1670.5245,12.8883,189.5787,86,86); //Grove Bike
	AddStaticVehicle(475,2489.4473,-1683.6460,13.2212,269.4198,86,86); //Grove Sabre
	AddStaticVehicle(487,2528.3030,-1677.6744,20.1069,90.1688,86,86); //Grove Maverick
	AddStaticVehicle(492,2508.5586,-1663.8768,13.3470,24.2311,86,86); //Grove Majestic
	AddStaticVehicle(542,2455.6951,-1653.9175,13.0976,89.6216,86,86); //Grove Clover
	AddStaticVehicle(542,2452.0757,-1663.8684,13.1271,91.0194,86,86); //Grove Clover 2
	AddStaticVehicle(559,2505.9709,-1694.6323,13.2128,0.9567,86,88); // jester car
    AddStaticVehicle(461,2471.1682,-1676.7649,12.9134,210.9538,86,86); // pcj bike
    AddStaticVehicle(576,2469.1851,-1653.5850,13.0123,90.0709,86,86); // grove car
    AddStaticVehicle(492,2443.2319,-1638.5491,13.2151,180.1151,86,0); // groove glendale
Some grove street vehicles, ok?

Код:
SetPlayerTeam(playerid, classid);
switch (classid)
	{
		case 0,1,2://Grove
		{
			GameTextForPlayer(playerid, "~g~Grove Street", 2500, 6);
			SetPlayerInterior(playerid,0);
			SetPlayerPos(playerid, 2495.072753, -1666.073608, 13.343750);
            SetPlayerFacingAngle(playerid, 143.819030);
            SetPlayerCameraLookAt(playerid, 2495.072753, -1666.073608, 13.343750);
            SetPlayerCameraPos(playerid, 2495.072753 + (5 * floatsin(-143.819030, degrees)), -1666.073608 + (5 * floatcos(-143.819030, degrees)), 13.343750);
			SetPlayerColor(playerid,0x33AA33AA);
			SetPlayerTeam(playerid, 0);
            GetPlayerTeam(playerid);

case 3, 4, 5:
		{
		    GameTextForPlayer(playerid, "~b~Los Santos Police", 2500, 6);
			SetPlayerInterior(playerid,0);
			SetPlayerPos(playerid,1521.9072,-1675.5242,13.5469);
			SetPlayerFacingAngle(playerid,400);
			SetPlayerCameraPos(playerid,1519.7406,-1671.2792,13.5469);
			SetPlayerCameraLookAt(playerid,1521.9072,-1675.5242,13.5469);
			SetPlayerColor(playerid,0x0000FF96);
			SetPlayerTeam(playerid, 2);
            GetPlayerTeam(playerid);
		}
This is located at OnPLayerRequestClass. Sorry if the code is messed up, although you'll get the idea.


So, how could I add the variables for team vehicles and at least without changing the code above. The tutorial is whole different thing, and what I've done is totally different but I prefer my way cause I know it well.


Another minor issue I have, is how do I set a player clock, like I mean let the World Run a clock where time is always moving, just like in Singleplayer. I actually tried this with, TogglePlayerClock(playerid, 1); at OnPlayerConnect but the problem is, whenever I die and respawn the time is just getting reset to 12:00 (default I think). So how do I overcome this?

For whoever who helps me, regardless of how much they do, they will be +REPed generously. Thanks, in advance.
Reply


Messages In This Thread
Team Vehicles Non-Damage - by Sting. - 18.12.2017, 15:26
Re: Team Vehicles Non-Damage - by RogueDrifter - 18.12.2017, 20:31
Re: Team Vehicles Non-Damage - by Sew_Sumi - 18.12.2017, 21:51
Re: Team Vehicles Non-Damage - by Logok987 - 19.12.2017, 13:23

Forum Jump:


Users browsing this thread: 1 Guest(s)