Some Vehicleids for only a specific team -
XCarBOn - 11.01.2011
It's just a little question:
I want to make some vehicleids only entreeable for a specific team. I know how this works but I don't get it, how I can define more than one vehicleid
Here's an example:
pawn Код:
new vid = GetPlayerVehicleID(playerid);
if(vid == 416 || vid == 433 || vid == 523 || vid == 427 || vid == 490 || vid == 528 || vid == 407 || vid == 544 || vid == 596 || vid == 597 || vid == 598 || vid == 599 || vid == 432 || vid == 601 || vid == 520 || vid == 548 || vid == 425 || vid == 497 || vid == 563 || vid == 447 || vid == 430)
Won't work.. I tried a lot but nothing work!
Please help.
Thanks,
XCarBOn
AW: Some Vehicleids for only a specific team -
Kmitska - 11.01.2011
Hey, try this:
Vehicle id is not the same as Model
if(GetVehicleModel(vehicleid) == 416 || GetVehicleModel(vehicleid) == 433)
Re: Some Vehicleids for only a specific team -
KaleOtter - 11.01.2011
Well send me all of it because this isn't wrong.
You also use
Код:
new vid;
switch(GetVehicleModel(vid)) // if you want the vehicle model, else ony use "vid".
{
case model1,model2,model3............... :
{
}
}
Re: Some Vehicleids for only a specific team -
_rAped - 11.01.2011
How do you detect a players team (variables, callbacks)?
Re: Some Vehicleids for only a specific team -
KaleOtter - 11.01.2011
GetPlayerTeam(playerid);
AW: Some Vehicleids for only a specific team -
Kmitska - 11.01.2011
what do you want?
u could do it like this:
new vehicle;
vehicle = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehicle) == 416)
{
}
Re: Some Vehicleids for only a specific team -
XCarBOn - 11.01.2011
Okay here's is the rexst of the code:
pawn Код:
IsPolCar(playerid)
{
new vid = GetPlayerVehicleID(playerid);
if(vid == 416 || vid == 433 || vid == 523 || vid == 427 || vid == 490 || vid == 528 || vid == 407 || vid == 544 || vid == 596 || vid == 597 || vid == 598 || vid == 599 || vid == 432 || vid == 601 || vid == 520 || vid == 548 || vid == 425 || vid == 497 || vid == 563 || vid == 447 || vid == 430)
{
return 1;
}
return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(IsPolCar(vehicleid))
{
if(UserStats[playerid][Fraktion] == 1)
{}else {ClearAnimations(playerid); SendClientMessage(playerid, COLOR_RED, "Abgeschlossen..");}
} // I know i can replace the else with if(UserStats[playerid][Fraktion] != 1), but this was my first prototype..
if(tC(vehicleid))
{
if(UserStats[playerid][Fraktion] == 2)
{}else {ClearAnimations(playerid); SendClientMessage(playerid, COLOR_RED, "Abgeschlossen..");}
}
return 1;
}
The second one work.. And I want to make every police car (E.g. every cop car - Vehicleid 596) only entreeable for one faction (The language is German, Fraktion = Faction, Abgeschlossen = Locked..)
Re: Some Vehicleids for only a specific team -
XCarBOn - 11.01.2011
I also tried another possibility:
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new vid = GetPlayerVehicleID(playerid);
if(vid == 416 || vid == 433 || vid == 523 || vid == 427 || vid == 490 || vid == 528 || vid == 407 || vid == 544 || vid == 596 || vid == 597 || vid == 598 || vid == 599 || vid == 432 || vid == 601 || vid == 520 || vid == 548 || vid == 425 || vid == 497 || vid == 563 || vid == 447 || vid == 430)
{
if(UserStats[playerid][Fraktion] != 1)
{
ClearAnimations(playerid); SendClientMessage(playerid, COLOR_RED, "Zum Schutz sind diese Fahrzeuge nur fьr Beamte zugдnglich!");
}
}
SendClientMessage(playerid, COLOR_WHITE, "Du muss das {FF0000}Auto {FFFFFF}sowie die {FF0000}Lichter {FFFFFF}manuell starten!");
SendClientMessage(playerid, COLOR_WHITE, "{FF0000}/Motor {FFFFFF}und {FF0000}/Licht");
}
return 1;
}
Doesn't work, too.
Re: Some Vehicleids for only a specific team -
KaleOtter - 11.01.2011
This works:
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
switch(GetVehicleModel(vehicleid))
{
case 416,433,523,427,490,528,407,544,596,597,598,599,432,601,520,548,425,497,563,447,430:
{
if(UserStats[playerid][Fraktion] != 1)
{
ClearAnimations(playerid); SendClientMessage(playerid, COLOR_RED, "Zum Schutz sind diese Fahrzeuge nur fьr Beamte zugдnglich!");
}
}
}
SendClientMessage(playerid, COLOR_WHITE, "Du muss das {FF0000}Auto {FFFFFF}sowie die {FF0000}Lichter {FFFFFF}manuell starten!");
SendClientMessage(playerid, COLOR_WHITE, "{FF0000}/Motor {FFFFFF}und {FF0000}/Licht");
}
return 1;
}