lock cars for certin teams
#1

Ok, I want to lock a car for a certin team,

The car is for the Los Santos Metro PD ( copcarla ( carid 596 ). I have this.

Код:
LockLSPDCars(playerid)
	{
	  SetVehicleParamsForPlayer(1, playerid, 0, 1);
	  SetVehicleParamsForPlayer(2, playerid, 0, 1);
	  SetVehicleParamsForPlayer(3, playerid, 0, 1);
	  SetVehicleParamsForPlayer(4, playerid, 0, 1);
	  SetVehicleParamsForPlayer(5, playerid, 0, 1);
	  SetVehicleParamsForPlayer(6, playerid, 0, 1);
	  SetVehicleParamsForPlayer(7, playerid, 0, 1);
	  SetVehicleParamsForPlayer(8, playerid, 0, 1);
	  SetVehicleParamsForPlayer(9, playerid, 0, 1);
	  SetVehicleParamsForPlayer(10, playerid, 0, 1);
	  SetVehicleParamsForPlayer(11, playerid, 0, 1);
	  SetVehicleParamsForPlayer(12, playerid, 0, 1);
	  SetVehicleParamsForPlayer(13, playerid, 0, 1);
		SetVehicleParamsForPlayer(14, playerid, 0, 1);
		SetVehicleParamsForPlayer(15, playerid, 0, 1);
	 	SetVehicleParamsForPlayer(16, playerid, 0, 1);
	  SetVehicleParamsForPlayer(17, playerid, 0, 1);
	  SetVehicleParamsForPlayer(18, playerid, 0, 1);
	  SetVehicleParamsForPlayer(19, playerid, 0, 1);
	  SetVehicleParamsForPlayer(20, playerid, 0, 1);
	  SetVehicleParamsForPlayer(21, playerid, 0, 1);
		SetVehicleParamsForPlayer(22, playerid, 0, 1);
		SetVehicleParamsForPlayer(23, playerid, 0, 1);
		SetVehicleParamsForPlayer(24, playerid, 0, 1);
		SetVehicleParamsForPlayer(25, playerid, 0, 1);
		SetVehicleParamsForPlayer(26, playerid, 0, 1);
		SetVehicleParamsForPlayer(27, playerid, 0, 1);
		SetVehicleParamsForPlayer(28, playerid, 0, 1);
	}
Then this is the message tat is sent when someone enter's a n lspd cop car

Код:
	if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 596)
{
  SendClientMessage(playerid, COLOR_YELLOW, "Type - ( LS Exempt ) ");
  SendClientMessage(playerid, COLOR_GREY, "Reg.: Los Santos Metro Police Department");
}
How ever the vehicles are still not locked. I even added.

Код:
	}else{
 	  TogglePlayerControllable(playerid,1);
		gteam[playerid] = Team_Civ;
		SetPlayerTeam(playerid,Team_Civ);
		SetPlayerArmour(playerid,0);
		SetPlayerHealth(playerid,100);
	 	SetPlayerRandomSpawn(playerid);
    	 	//SpawnPlayerAtHouse(playerid, 1);
	  SetPlayerColor(playerid,COLOR_GREY);
	  SetPlayerVirtualWorld(playerid,0);
        LockLSPDCars;
Reply
#2

Ever wondered about removing a player from the vehicle if he isnt in the specified team? RemovePlayerFromVehicle?
Reply
#3

yes, I had this working,


Код:
{
if(newstate == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
new modelid = GetVehicleModel(vehicleid);

switch(modelid)
{
case 596,523,528,427,601,477,497:
{
if(playerid, Team_LSPD)
{
} else {
SendClientMessage(playerid, COLOR_GREY," You are not authorized to use that vehicle.");
RemovePlayerFromVehicle(playerid);
}
}
}
}
return 1;
}
But now it dosnt work
Reply
#4

pawn Код:
forward LSPDCar(carid);

public LSPDCar(carid)
{
    if(Add your cars here!) // for example: if(carid >= 1) && (carid <= 10)) this is the order you added
    {
        return 1;
    }
    return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if (IsACopCar(vehicleid) && !ispassenger)
    {
        if(gTeam[playerid] == Team_LSPD)
        {
            SendClientMessage(playerid,COLOR_GREY,"Reg.: Los Santos Metro Police Department");
        }
      else
        {
        RemovePlayerFromVehicle(playerid);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)