Define car for a team...
#1

Hey guys, how do i define a CreateVehicle car only for 1 tream?

For example, i want it only for PlayerInfo[playerid][Fmember] == 1

Thanks
Reply
#2

pawn Код:
new vTeam[MAX_VEHICLES];
pawn Код:
vTeam[vehicleid] = team;
edit:
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
  if(newstate == PLAYER_STATE_DRIVER)
  {
    if(PlayerInfo[playerid][Job] != vTeam[GetPlayerVehicleID])
    {
      RemovePlayerFromVehicle(playerid);
    }
  }
  return 1;
}
Reply
#3

And how do i get the car id? I just see the model

By the way i want: For example a car only for cops, and cops params are:

PlayerInfo[playerid][Fmember] == 1;
Reply
#4

at the top of you script:
new CarID;
and then before a vehicle (before AddStaticVehicle(Ex) / CreateVehicle)
CarID = AddStaticVehicle/CreateVehice/W/E..........;
vTeam[CarID] = team...;

and for your question:
pawn Код:
if(vTeam[GetPlayerVehicleID(playerid)] == 1)
{
  if(PlayerInfo[playerid][Fmember] == 1)
  {
    SendClientMessage(playerid, 0x999999AA, "You may use it");
  }else{
    RemovePlayerFromVehicle(playerid);
  }
}
(example only - the team for police would be "1" in this case)
Reply
#5

Thanks very much!
Reply
#6

no problem
Reply
#7

Код:
C:\Users\Ricardo\Desktop\Mini-DM\Mini-DM\Freedoom\gamemodes\CountryRp.pwn(690) : warning 225: unreachable code
C:\Users\Ricardo\Desktop\Mini-DM\Mini-DM\Freedoom\gamemodes\CountryRp.pwn(690) : error 017: undefined symbol "vTeam"
C:\Users\Ricardo\Desktop\Mini-DM\Mini-DM\Freedoom\gamemodes\CountryRp.pwn(690) : error 001: expected token: ";", but found "]"
C:\Users\Ricardo\Desktop\Mini-DM\Mini-DM\Freedoom\gamemodes\CountryRp.pwn(690) : error 029: invalid expression, assumed zero
C:\Users\Ricardo\Desktop\Mini-DM\Mini-DM\Freedoom\gamemodes\CountryRp.pwn(690) : fatal error 107: too many error messages on one line
Reply
#8

looks as if you forgot the "new vTeam[MAX_VEHICLES];" add the beginning..
Reply
#9

Give me warmning:
Код:
C:\Users\Ricardo\Desktop\Mini-DM\Mini-DM\Freedoom\filterscripts\adminric.pwn(59) : warning 204: symbol is assigned a value that is never used: "CarID"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
On code:
pawn Код:
new CarID;
new vTeam[MAX_VEHICLES];
pawn Код:
public OnFilterScriptInit()
{

    CreateVehicle(560, 1240.217529, 341.725494, 19.183359, 66.207656, -1, -1, -1);
    CreateVehicle(561, 1263.795532, 331.397857, 19.290910, 67.655212, -1, -1, -1);
    CreateVehicle(411, 1305.766479, 298.365447, 19.190263, 154.575271, -1, -1, -1);
    CreateVehicle(415, 1299.621826, 285.120208, 19.274879, 154.695083, -1, -1, -1);
    CreateVehicle(418, 1268.499755, 263.945739, 19.584465, 67.985160, -1, -1, -1);
    CreateVehicle(420, 1250.919189, 244.501373, 19.333589, 66.327262, -1, -1, -1);
    CreateVehicle(420, 1253.738281, 248.020782, 19.333448, 70.827362, -1, -1, -1);
    CreateVehicle(420, 1256.075561, 251.738479, 19.334672, 66.450363, -1, -1, -1);
    CreateVehicle(420, 1243.943603, 251.864166, 19.331092, 155.433074, -1, -1, -1);
    CreateVehicle(420, 1257.776855, 254.776428, 19.334075, 65.036903, -1, -1, -1);
    CarID = CreateVehicle(598, 1207.541503, 190.506179, 20.127351, 337.865234, -1, -1, -1);
    CarID = CreateVehicle(598, 1209.308959, 185.955490, 20.241701, 324.595306, -1, -1, -1);
    CarID = CreateVehicle(598, 1221.854248, 193.111709, 19.297145, 245.526199, -1, -1, -1);
    CarID = CreateVehicle(598, 1232.632324, 187.499801, 19.362943, 245.570510, -1, -1, -1);
    CarID = CreateVehicle(598, 1242.020385, 183.182601, 19.364870, 244.622009, -1, -1, -1);
    CarID = CreateVehicle(598, 1248.772460, 173.832977, 19.325132, 337.487915, -1, -1, -1);
    return 1;
}
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(vTeam[GetPlayerVehicleID(playerid)] == 1)
{
  if(PlayerInfo[playerid][Fmember] == 1)
  {
    SendClientMessage(playerid, 0x999999AA, "You may use it");
  }else{
    RemovePlayerFromVehicle(playerid);
  }
}
}
it don0t work in game, just dont do nothing when i enter cop cars....
Reply
#10

pawn Код:
public OnFilterScriptInit()
{

    CreateVehicle(560, 1240.217529, 341.725494, 19.183359, 66.207656, -1, -1, -1);
    CreateVehicle(561, 1263.795532, 331.397857, 19.290910, 67.655212, -1, -1, -1);
    CreateVehicle(411, 1305.766479, 298.365447, 19.190263, 154.575271, -1, -1, -1);
    CreateVehicle(415, 1299.621826, 285.120208, 19.274879, 154.695083, -1, -1, -1);
    CreateVehicle(418, 1268.499755, 263.945739, 19.584465, 67.985160, -1, -1, -1);
    CreateVehicle(420, 1250.919189, 244.501373, 19.333589, 66.327262, -1, -1, -1);
    CreateVehicle(420, 1253.738281, 248.020782, 19.333448, 70.827362, -1, -1, -1);
    CreateVehicle(420, 1256.075561, 251.738479, 19.334672, 66.450363, -1, -1, -1);
    CreateVehicle(420, 1243.943603, 251.864166, 19.331092, 155.433074, -1, -1, -1);
    CreateVehicle(420, 1257.776855, 254.776428, 19.334075, 65.036903, -1, -1, -1);
    CarID = CreateVehicle(598, 1207.541503, 190.506179, 20.127351, 337.865234, -1, -1, -1);
    vTeam[CarID] = 1;
    CarID = CreateVehicle(598, 1209.308959, 185.955490, 20.241701, 324.595306, -1, -1, -1);
    vTeam[CarID] = 1;
    CarID = CreateVehicle(598, 1221.854248, 193.111709, 19.297145, 245.526199, -1, -1, -1);
    vTeam[CarID] = 1;
    CarID = CreateVehicle(598, 1232.632324, 187.499801, 19.362943, 245.570510, -1, -1, -1);
    vTeam[CarID] = 1;
    CarID = CreateVehicle(598, 1242.020385, 183.182601, 19.364870, 244.622009, -1, -1, -1);
    vTeam[CarID] = 1;
    CarID = CreateVehicle(598, 1248.772460, 173.832977, 19.325132, 337.487915, -1, -1, -1);
    vTeam[CarID] = 1;
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)