Police Special Car
#1

I want a normal car like infernus in police faction too. For that what should i do so that in that specific infernus(police faction's) only cops can enter. Like in "police rancher" i had simply defined that if someone who not belongs to cop faction, try to enter in car with "model id of police rancher" then it prevent it from entering. But in case of infernus I can't do that because the model id of police infernus and normal infernus are same!. What should i do?
Reply
#2

PHP код:
new policeInfernus[MAX_VEHICLES];

//in gamemodeinit
policeInfernus[1] = CreateVehicle(...);

//in the check.
if(vehicleid == policeInfernus[1])
... 
Reply
#3

Thanks Meller. It works but not when "new policeInfernus[MAX_VEHICLES];" and using various types as policeInfernus[1] and so on. It stores "0" at place of vehicle id in policeInfernus[1].

When i did this > "new policeInfernus;" and store vehicle id in this, it stores the correct vehicle id. But i think it will be a big task to create these seperate variables for each car. Why "new policeInfernus[MAX_VEHICLES];" is not working?
Reply
#4

Код:
new LEOveh[19];
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	new vehicleid = GetPlayerVehicleID(playerid);

	switch(newstate)
	{
	case PLAYER_STATE_DRIVER:
	    {
     		if(vehicleid >= LEOveh[0] && LEOveh[18] >= vehicleid)
			{
			    if(PlayerInfo[playerid][Faction] != 1)
				{
				    SendClientMessage(playerid, COLOR_WHITE, "You are not a Police Office and do not have the keys for this vehicle");
					RemovePlayerFromVehicle(playerid);
				}
			}
// Add to gamemodeinit
Код:
	LEOveh[0] = CreateVehicle(561,1530.7141,-1644.6859,5.5957,180.2718,0,0,2000); // Stratum
	LEOveh[1] = CreateVehicle(560,1534.6045,-1644.6677,5.5957,180.2718,0,0,2000); // Sultan
	LEOveh[2] = CreateVehicle(560,1538.8458,-1644.6477,5.5957,180.2718,0,0,2000); // Sultan
	LEOveh[3] = CreateVehicle(561,1526.9716,-1644.7039,5.5957,180.2718,0,0,2000); // Stratum
	LEOveh[4] = CreateVehicle(490,1528.9757,-1687.9369,6.0183,269.7481,0,0,2000); // F.B.I Rancher
	LEOveh[5] = CreateVehicle(490,1528.9938,-1683.8076,6.0182,269.7481,0,0,2000); // F.B.I Rancher
	LEOveh[6] = CreateVehicle(596,1544.8733,-1668.2935,5.6122,90.2933,1,0,2000); // L.S.P.D Cruiser
	LEOveh[7] = CreateVehicle(596,1544.8948,-1672.4688,5.6122,90.2933,1,0,2000); // L.S.P.D Cruiser
	LEOveh[8] = CreateVehicle(596,1544.9147,-1676.3838,5.6122,90.2933,1,0,2000); // L.S.P.D Cruiser
	LEOveh[9] = CreateVehicle(596,1544.9349,-1680.3630,5.6122,90.2933,1,0,2000); // L.S.P.D Cruiser
	LEOveh[10] = CreateVehicle(596,1544.9562,-1684.4753,5.6122,90.2933,1,0,2000); // L.S.P.D Cruiser
try adding that then it will kick them if they are not police vehicles but make sure you change the numbers for your own needs
Reply
#5

Quote:
Originally Posted by rishabh
Посмотреть сообщение
Thanks Meller. It works but not when "new policeInfernus[MAX_VEHICLES];" and using various types as policeInfernus[1] and so on. It stores "0" at place of vehicle id in policeInfernus[1].

When i did this > "new policeInfernus;" and store vehicle id in this, it stores the correct vehicle id. But i think it will be a big task to create these seperate variables for each car. Why "new policeInfernus[MAX_VEHICLES];" is not working?
For the first care it's policeInfernus[0], the second policeInfernus[1], etc...
policeInfernus can stop only 1 car, MAX_VEHICLE allow you to stock 2000 cars in a list.
Reply
#6

Quote:

For the first care it's policeInfernus[0], the second policeInfernus[1], etc...

Код HTML:
new policeInfernus[MAX_VEHICLES];

//in gamemodeinit
policeInfernus[0] = CreateVehicle(...);
policeInfernus[1] = CreateVehicle(...);
policeInfernus[2] = CreateVehicle(...);


//in the check.
if(vehicleid == policeInfernus[0],policeInfernus[1],policeInfernus[2])
...  
This too doesn't work, still stores '0' at place of 'vehicleid'.
Reply
#7

That line will not work.

Код:
if(vehicleid == policeInfernus[0]||vehicleid == policeInfernus[1]||vehicleid == policeInfernus[2])
Reply
#8

On doing this too... Its not working. They have stored '0' in it.
Reply
#9

Post up what code you've got currently.

Код:
if(vehicleid >= LEOveh[0] && LEOveh[18] >= vehicleid)
This doesn't work like this
Reply
#10

Yea it does work I use that in my script and it works perfectly for me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)