Team vehicles help
#3

Quote:
Originally Posted by Zmith
Посмотреть сообщение
Update;

Okay, I found the error but I am still not sure how to fix it.

If I join "GANG_US" I cannot enter the last vehicle (I removed most vehicles so the above wasn't cluttered) added to "OnGameModeInit" defined "Veh[USveh]".

Example;
Код:
public OnGameModeInit()
{

	AddStaticVehicle(404,-240.3871,2609.1855,62.4385,178.8446,109,100); // ALL_CAN_ENTER
	AddStaticVehicle(408,-276.2446,2655.8201,63.1989,270.1121,26,26); // ALL_CAN_ENTER
	AddStaticVehicle(424,-215.7718,2777.6672,62.2502,269.3476,2,2); // ALL_CAN_ENTER
		

	Veh[Taliveh] = AddStaticVehicle(568,-1565.5852,2638.3340,55.6556,89.3129,1,1); // ALL_CAN_ENTER
	Veh[Taliveh] = AddStaticVehicle(470,-1563.2689,2694.5530,55.7585,179.6360,1,1); // ALL_CAN_ENTER
	Veh[Taliveh] = AddStaticVehicle(469,-1276.0333,2490.6409,86.9348,151.4670,1,1); // TALI_CANNOT_ENTER

	Veh[PMCveh] = AddStaticVehicle(473,-660.8072,875.4515,-0.2219,226.3900,33,33); // ALL_CAN_ENTER
	Veh[PMCveh] = AddStaticVehicle(468,-686.3440,973.6500,11.8031,29.6308,33,33); // ALL_CAN_ENTER
	Veh[PMCveh] = AddStaticVehicle(554,-681.0616,967.7052,12.2172,90.8313,33,33); //PMC_CANNOT_ENTER
		
	Veh[USveh] = AddStaticVehicle(523,146.8226,1930.8507,18.7541,90.4055,81,81); // ALL_CAN_ENTER
	Veh[USveh] = AddStaticVehicle(500,181.7266,1925.9727,18.0581,179.9284,81,81); // ALL_CAN_ENTER
	Veh[USveh] = AddStaticVehicle(470,176.9072,1925.9727,18.0926,179.9285,81,81); // US_CANNOT_ENTER


	Veh[UKveh] = AddStaticVehicle(445,-1561.7638,387.1261,7.0625,90.1433,0,0); // ALL_CAN_ENTER
	Veh[UKveh] = AddStaticVehicle(425,-1608.2104,286.0438,7.7102,180.6974,1,1); // ALL_CAN_ENTER
	Veh[UKveh] = AddStaticVehicle(430,-1653.0719,253.9239,-0.0595,91.4524,0,0); // UK_CANNOT_ENTER

		
	return 1;
}
Could you help me out?
This is because your checking if the player is in the correct team and if they are in the correct team you are kicking them from vehicle. So your actually doing the reverse of what you want.

OnPlayerStateChange
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == 2)
    {
        new VehCheck = GetPlayerVehicleID(playerid);
        if(VehCheck == Veh[USveh] )
        {
            if(gTeam[playerid] != GANG_US)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_RED, "{ff6347}Error: You don't have access to this vehicle!");
                return 1;
            }
        }

        if(VehCheck == Veh[Taliveh] )
        {
            if(gTeam[playerid] != GANG_T)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_RED, "{ff6347}Error: You don't have access to this vehicle!");
                return 1;
            }
        }

        if(VehCheck == Veh[PMCveh] )
        {
            if(gTeam[playerid] != GANG_PMC)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_RED, "{ff6347}Error: You don't have access to this vehicle!");
                return 1;
            }
        }

        if(VehCheck == Veh[UKveh] )
        {
            if(gTeam[playerid] != GANG_UK)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_RED, "{ff6347}Error: You don't have access to this vehicle!");
                return 1;
            }
        }
    }

    return 1;
}
What did I do? All I did was add a exclamation mark instead of two equals signs, in programming this mean the oppersite of equals so to do '!=' I am saying if 'blah' is not 'blah' then execute.
Reply


Messages In This Thread
Team vehicles help - by Zmith - 20.03.2017, 01:39
Re: Team vehicles help - by Zmith - 20.03.2017, 01:59
Re: Team vehicles help - by azzerking - 20.03.2017, 02:45
Re: Team vehicles help - by Zmith - 20.03.2017, 03:54
Re: Team vehicles help - by Sew_Sumi - 20.03.2017, 04:34

Forum Jump:


Users browsing this thread: 1 Guest(s)