Hello again in this beautiful day just.. Again have a prob with entering cars..
#1

So hello I have trying now to make everything work with my gang system.. But something is wrong with checking on witch team car is.. so yeah now I'm thinking where can be the problem to solve it... Maybe somebody can help me out
Код:
new gTeam[MAX_PLAYERS];
#define Varios 0
#define Ballas 1
#define GS 2
#define Vagos 3
#define Police 4
#define Security 5
enum TeamCars
{
	t1,
	t2,
	t3,
	t4,
	t5,
	t6,
	t7,
	t8,
	t9,
	t10,
	t11,
	t12,
	t13,
	t14,
	t15,
	t16,
	t17,
	t18,
	t19,
	t20,
};
new Cars[TeamCars];
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	if(newstate == 2)
    {
      	new CarCheck = GetPlayerVehicleID(playerid);
    	if(CarCheck == Cars[t1] || CarCheck == Cars[t2] || CarCheck == Cars[t3] || CarCheck == Cars[t4] || CarCheck == Cars[t5])
        {
            if(gTeam[playerid] != 1 || gTeam[playerid] != 2 || gTeam[playerid] != 3)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_Ballas, "You Don't have the keys for this car.");
            	return 1;
            }
            else if(gTeam[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_Ballas, "You have the keys for this car.");
            	return 1;
            }
        }
        else if(CarCheck == Cars[t6] || CarCheck == Cars[t7] || CarCheck == Cars[t8] || CarCheck == Cars[t9] || CarCheck == Cars[t10])
        {
            if(gTeam[playerid] != 0 || gTeam[playerid] != 2 || gTeam[playerid] != 3)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_Ballas, "You Don't have the keys for this car.");
            	return 1;
            }
            else if(gTeam[playerid] == 1)
            {
                SendClientMessage(playerid, COLOR_Ballas, "You have the keys for this car.");
            	return 1;
            }
        }
        else if(CarCheck == Cars[t11] || CarCheck == Cars[t12] || CarCheck == Cars[t13] || CarCheck == Cars[t14] || CarCheck == Cars[t15])
        {
            if(gTeam[playerid] != 0 || gTeam[playerid] != 1 || gTeam[playerid] != 2)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_Ballas, "You Don't have the keys for this car.");
            	return 1;
            }
            else if(gTeam[playerid] == 3)
            {
                SendClientMessage(playerid, COLOR_Ballas, "You have the keys for this car.");
            	return 1;
            }
   		}
   		else if(CarCheck == Cars[t16] || CarCheck == Cars[t17] || CarCheck == Cars[t18] || CarCheck == Cars[t19] || CarCheck == Cars[t20])
        {
            if(gTeam[playerid] != 0 || gTeam[playerid] != 1 || gTeam[playerid] != 3)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_Ballas, "You Don't have the keys for this car.");
            	return 1;
            }
            else if(gTeam[playerid] == 2)
            {
                SendClientMessage(playerid, COLOR_Ballas, "You have the keys for this car.");
            	return 1;
            }
   		}
      	return 1;
    }
	return 1;
}
Код:
	//Cars
	//Varios
	Cars[t1] = AddStaticVehicleEx(534,2822.60009766,2235.39990234,10.60000038,0.00000000,7,1,15); //Remington
	Cars[t2] = AddStaticVehicleEx(535,2822.80004883,2227.19995117,10.69999981,0.00000000,7,1,15); //Slamvan
	Cars[t3] = AddStaticVehicleEx(536,2822.39990234,2244.60009766,10.69999981,0.00000000,7,1,15); //Blade
	Cars[t4] = AddStaticVehicleEx(567,2822.39990234,2252.60009766,10.80000019,0.00000000,7,1,15); //Savanna
	Cars[t5] = AddStaticVehicleEx(471,2800.00000000,2227.30004883,10.39999962,270.00000000,1,7,15); //Quad
	//Ballas
	Cars[t6] = AddStaticVehicleEx(507,1921.00000000,2598.10009766,10.50000000,358.00000000,121,121,15); //Elegant
	Cars[t7] = AddStaticVehicleEx(516,1824.50000000,2637.10009766,10.69999981,358.00000000,121,121,15); //Nebula
	Cars[t8] = AddStaticVehicleEx(566,1844.50000000,2639.10009766,10.69999981,0.00000000,121,121,15); //Tahoma
	Cars[t9] = AddStaticVehicleEx(579,1876.80004883,2593.00000000,10.89999962,2.00000000,121,121,15); //Huntley
	Cars[t10] = AddStaticVehicleEx(581,1838.09997559,2639.60009766,10.50000000,165.99993896,121,121,15); //BF-400
	//GroveStreet
	Cars[t11] = AddStaticVehicleEx(581,1026.30004883,1903.40002441,11.19999981,0.00000000,2,1,15); //BF-400
	Cars[t12] = AddStaticVehicleEx(482,1031.80004883,1913.09997559,11.69999981,268.00000000,103,1,15); //Burrito
	Cars[t13] = AddStaticVehicleEx(600,1033.19995117,1919.90002441,11.30000019,270.00000000,2,1,15); //Picador
	Cars[t14] = AddStaticVehicleEx(560,1027.19995117,1868.19995117,11.30000019,88.00000000,2,1,15); //Sultan
	Cars[t15] = AddStaticVehicleEx(533,983.00000000,1894.00000000,11.30000019,268.00000000,2,1,15); //Feltzer
	//Vagos
	Cars[t16] = AddStaticVehicleEx(467,1919.59997559,708.20001221,10.69999981,0.00000000,6,6,15); //Oceanic
	Cars[t17] = AddStaticVehicleEx(400,1925.80004883,707.59997559,11.00000000,0.00000000,6,6,15); //Landstalker
	Cars[t18] = AddStaticVehicleEx(468,1897.30004883,723.09997559,10.60000038,0.00000000,6,6,15); //Sanchez
	Cars[t19] = AddStaticVehicleEx(413,1916.50000000,698.59997559,11.00000000,0.00000000,6,1,15); //Pony
	Cars[t20] = AddStaticVehicleEx(474,1935.59997559,707.90002441,10.69999981,0.00000000,6,1,15); //Hermes
There is no error no nothing just when I enter the car it shows message: "You have the keys for this car."

Don't matter witch gang I use and I tried to enter a every car just same thing....
Maybe somebody can help me.. Thanks for your time and your help.. If somehow I can help you back just say
Reply
#2

Change

pawn Код:
||
To

pawn Код:
&&
Reply
#3

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == 2)
    {
        new CarCheck = GetPlayerVehicleID(playerid);
        if(CarCheck == Cars[t1] || CarCheck == Cars[t2] || CarCheck == Cars[t3] || CarCheck == Cars[t4] || CarCheck == Cars[t5])
        {
            if(gTeam[playerid] != 0)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_Ballas, "You Don't have the keys for this car.");
                return 1;
            }
            else if(gTeam[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_Ballas, "You have the keys for this car.");
                return 1;
            }
        }
        else if(CarCheck == Cars[t6] || CarCheck == Cars[t7] || CarCheck == Cars[t8] || CarCheck == Cars[t9] || CarCheck == Cars[t10])
        {
            if(gTeam[playerid] != 1)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_Ballas, "You Don't have the keys for this car.");
                return 1;
            }
            else if(gTeam[playerid] == 1)
            {
                SendClientMessage(playerid, COLOR_Ballas, "You have the keys for this car.");
                return 1;
            }
        }
        else if(CarCheck == Cars[t11] || CarCheck == Cars[t12] || CarCheck == Cars[t13] || CarCheck == Cars[t14] || CarCheck == Cars[t15])
        {
            if(gTeam[playerid] != 3)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_Ballas, "You Don't have the keys for this car.");
                return 1;
            }
            else if(gTeam[playerid] == 3)
            {
                SendClientMessage(playerid, COLOR_Ballas, "You have the keys for this car.");
                return 1;
            }
        }
        else if(CarCheck == Cars[t16] || CarCheck == Cars[t17] || CarCheck == Cars[t18] || CarCheck == Cars[t19] || CarCheck == Cars[t20])
        {
            if(gTeam[playerid] != 2)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_Ballas, "You Don't have the keys for this car.");
                return 1;
            }
            else if(gTeam[playerid] == 2)
            {
                SendClientMessage(playerid, COLOR_Ballas, "You have the keys for this car.");
                return 1;
            }
        }
        return 1;
    }
    return 1;
}
EDIT: @coole210 Incorrect. if(gTeam[playerid] != 0 || gTeam[playerid] != 2 || gTeam[playerid] != 3) and if(gTeam[playerid] == 1) are calling the same function, because 1 does not equal 0, 2 or 3. So you simply change it to if(gTeam[playerid] != 1).
Reply
#4

Now I can enter to any car.. and message is not showing up...!
Reply
#5

EDIT: @coole210 Incorrect. if(gTeam[playerid] != 0 || gTeam[playerid] != 2 || gTeam[playerid] != 3) and if(gTeam[playerid] == 1) are calling the same function, because 1 does not equal 0, 2 or 3. So you simply change it to if(gTeam[playerid] != 1).[/QUOTE]
Cant enter the cars....


Sorry about double post..
Reply
#6

Quote:
Originally Posted by clarencecuzz
Посмотреть сообщение
EDIT: @coole210 Incorrect.
No. Maybe I'm not using the best method, as you stated, but I'm not incorrect.

pawn Код:
if(gTeam[playerid] != 1 && gTeam[playerid] != 2 && gTeam[playerid] != 3)
Translation: IF gTeam does not equal 1 AND it does not equal 2 AND it does not equal 3, then remove from the vehicle.

The problem with the code is, IF they are one of those gTeam's, they won't recieve a message because it only sends a message if they're gTeam is 1 in the else if. The best option would be to change else if to just else.
Reply
#7

Yeah it is working just the problem is now.. I can enter in every gang car..... How to fix that problem..
Reply
#8

Sorry for bump *Bump*... Just the problem is still on.. I know you can only bump after 24 h just yeah... The problem is.. I can enter in every gang car.. Is it possible when: Only person from one gang can enter only to his own gang car?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)