Team Only Vehicle
#1

Well guys, i wanted to make a car which is for BLUE team only

i did:
Код:
 new BlueCar;
Then UnderGameModeInIt

Код:
 BlueCar = AddstaticVehicle(blabla bla );
Then under OnPlayerEnterVehicle what do i do, is it something like this:
Код:
carBlue = GetPlayerVehicleID

 if(carBlue == BlueCar)
 {
 if(gTeam[playerid] == TEAM_BLUE)
So i want the player to be allowed to drive the car else the player gets kicked from the car. So how do i do it Please Help.
Reply
#2

Use RemovePlayerFromVehicle(playerid) when player is not in that team. And I suggest using it OnPlayerStateChange
Reply
#3

Код:
new blueCar;
blueCar = CreateVehicleID(bla....)

if(... == blueCar){
  if(!allowBlueCar[playerid]){
    GetPlayerPos(x,y,z
    SetPlayerPos(x,y,z+2
Reply
#4

Quote:
Originally Posted by yezizhu
Код:
new blueCar;
blueCar = CreateVehicleID(bla....)

if(... == blueCar){
  if(!allowBlueCar[playerid]){
    GetPlayerPos(x,y,z
    SetPlayerPos(x,y,z+2
WTF?! anyways i tried mademan but can someone give a GOOD and SIMPLE example
Reply
#5

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    carBlue = GetPlayerVehicleID(playerid);
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(carBlue == BlueCar && gTeam[playerid] != TEAM_BLUE)
        {
            RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}
Reply
#6

Polite,please

create vec
Код:
new blueCar;
//OnGameModeInit
blueCar = CreateVehicle
throw player
Код:
new Float:px,Float:py,Float:pz;
GetPlayerPos(playerid,px,py,pz);
SetPlayerPos(playerid,px,py,pz);
check
Код:
public OnPlayerStateChange(playerid,oldstate,newstate){
  if(newstate == PLAYER_STATE_DRIVER){
    if(GetPlayerVehicleID(playerid) == blueCar){
  
  }
  return true;
}
Reply
#7

Quote:
Originally Posted by MadeMan
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    carBlue = GetPlayerVehicleID(playerid);
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(carBlue == BlueCar && gTeam[playerid] != TEAM_BLUE)
        {
            RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}
Yes thanks , But if i put this under OnPlayerEnterVehicle will it make a difference?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)