Admin Vehicle
#1

i am using lux admin how can i create vehicles for admins only..
i made a try..

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
  new PlayerName[24];
  GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
  new vehicleid = GetPlayerVehicleID(playerid);

  if(newstate == PLAYER_STATE_DRIVER)
  {
   if(vehicleid == AdminCar1)
   {
     if(IsPlayerAdminLevel(playerid,1))
     {
		  RemovePlayerFromVehicle(playerid);
  		  SendClientMessage(playerid, 0x33AA33AA, "I'm sorry, but this car has been reserved for Admins");
     }
       return 1;
   }

}
  
  {
   if(vehicleid == AdminCar2)
   {
     if(IsPlayerAdminLevel(playerid,2))
     {
	  	RemovePlayerFromVehicle(playerid);
  		SendClientMessage(playerid, 0x33AA33AA, "I'm sorry, but this car has been reserved for Admins");
     }
       return 1;
   }
}
  {
   if(vehicleid == AdminCar3)
   {
     if(IsPlayerAdminLevel(playerid,3))
     {
       RemovePlayerFromVehicle(playerid);
  	   SendClientMessage(playerid, 0x33AA33AA, "I'm sorry, but this car has been reserved for Admins");
		
     }
       return 1;
   }

}
  {
   if(vehicleid == AdminCar4)
   {
     if(IsPlayerAdminLevel(playerid,4))
     {
	  	RemovePlayerFromVehicle(playerid);
 		SendClientMessage(playerid, 0x33AA33AA, "I'm sorry, but this car has been reserved for Admins");
     }
       return 1;
   }
}

  return 1;
}
#endif
Reply
#2

Try with OnPlayerEnterVehicle
Reply
#3

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new PlayerName[24];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    new vehicleid = GetPlayerVehicleID(playerid);
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(vehicleid == AdminCar1)
        {
            if(IsPlayerAdminLevel(playerid,1))
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, 0x33AA33AA, "I'm sorry, but this car has been reserved for Admins");
            }
        }
    }
    else if(vehicleid == AdminCar2)
    {
        if(IsPlayerAdminLevel(playerid,2))
        {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, 0x33AA33AA, "I'm sorry, but this car has been reserved for Admins");
        }
    }
    else if(vehicleid == AdminCar3)
    {
        if(IsPlayerAdminLevel(playerid,3))
        {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, 0x33AA33AA, "I'm sorry, but this car has been reserved for Admins");
        }
    }
    else if(vehicleid == AdminCar4)
    {
        if(IsPlayerAdminLevel(playerid,4))
        {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, 0x33AA33AA, "I'm sorry, but this car has been reserved for Admins");
        }
    }
    return 1;
}
Use that

To the guy who said Use OnPlayerEnterVehicle that is a bad idea as people can still steal the cars and if there is a normal car next to the admin car it will think he is going into the admin car and call that.
Reply
#4

Can use:

pawn Код:
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X,Y,Z);
SetPlayerPos(playerid, X,Y,Z);
Without

pawn Код:
RemovePlayerFromVehicle(playerid);
Reply
#5

that will use more memory than RemovePlayerFromVehicle believe it or not, so RemovePlayerFromVehicle is better.
Reply
#6

Quote:
Originally Posted by [WF]Demon
Посмотреть сообщение
that will use more memory than RemovePlayerFromVehicle believe it or not, so RemovePlayerFromVehicle is better.
Still Isnt Working No Message Appear
Reply
#7

Quote:
Originally Posted by Jagat
Посмотреть сообщение
Still Isnt Working No Message Appear
Help ME please
Reply
#8

Quote:
Originally Posted by [WF]Demon
Посмотреть сообщение
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new PlayerName[24];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    new vehicleid = GetPlayerVehicleID(playerid);
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(vehicleid == AdminCar1)
        {
            if(IsPlayerAdminLevel(playerid,1))
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, 0x33AA33AA, "I'm sorry, but this car has been reserved for Admins");
            }
        }
    }
    else if(vehicleid == AdminCar2)
    {
        if(IsPlayerAdminLevel(playerid,2))
        {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, 0x33AA33AA, "I'm sorry, but this car has been reserved for Admins");
        }
    }
    else if(vehicleid == AdminCar3)
    {
        if(IsPlayerAdminLevel(playerid,3))
        {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, 0x33AA33AA, "I'm sorry, but this car has been reserved for Admins");
        }
    }
    else if(vehicleid == AdminCar4)
    {
        if(IsPlayerAdminLevel(playerid,4))
        {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, 0x33AA33AA, "I'm sorry, but this car has been reserved for Admins");
        }
    }
    return 1;
}
Use that

To the guy who said Use OnPlayerEnterVehicle that is a bad idea as people can still steal the cars and if there is a normal car next to the admin car it will think he is going into the admin car and call that.
Help Me
Reply
#9

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
  new PlayerName[24];
  GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
  new vehicleid = GetPlayerVehicleID(playerid);

  if(newstate == PLAYER_STATE_DRIVER)
  {
   if(vehicleid == AdminCar1)
   {
     if(!IsPlayerAdminLevel(playerid,1))
     {
          RemovePlayerFromVehicle(playerid);
          SendClientMessage(playerid, 0x33AA33AA, "I'm sorry, but this car has been reserved for Admins");
     }
       return 1;
   }

}
 
  {
   if(vehicleid == AdminCar2)
   {
     if(!IsPlayerAdminLevel(playerid,2))
     {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, 0x33AA33AA, "I'm sorry, but this car has been reserved for Admins");
     }
       return 1;
   }
}
  {
   if(vehicleid == AdminCar3)
   {
     if(!IsPlayerAdminLevel(playerid,3))
     {
       RemovePlayerFromVehicle(playerid);
       SendClientMessage(playerid, 0x33AA33AA, "I'm sorry, but this car has been reserved for Admins");
       
     }
       return 1;
   }

}
  {
   if(vehicleid == AdminCar4)
   {
     if(!IsPlayerAdminLevel(playerid,4))
     {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, 0x33AA33AA, "I'm sorry, but this car has been reserved for Admins");
     }
       return 1;
   }
}

  return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)