18.12.2011, 17:39
Hello SA-MP scripters. I need some help with the private vehicle code I made. I've been seriously trying to figure it out for 2 days but no result. Here is my code:
PROBLEM: If I am team saints, I can enter the saints cars successfully with the message "You passed the Saints Exam!". If I am another class it removes me from the car exactly like it was intended. BUT! If with another class I enter ANY OTHER car spawned it ejects me as if it were a saints car. I can't figure it out. Thanks for reading and helping me
pawn Код:
enum TeamCars
{
saints1,
saints2,
saints3,
saints4,
saints5,
saints6,
saints7,
saints8,
saints9,
saints10
}
new Cars[TeamCars];
//-------VEHICLES SAINTS-------
Cars[saints1] = SetVehicleNumberPlate(CreateVehicle(560,-2644.8789,1376.7103,6.9458,181.3955,22,22,120),"Saints"); // Saints Sultan 1
Cars[saints2] = SetVehicleNumberPlate(CreateVehicle(560,-2638.9302,1376.3307,6.9202,180.5883,22,22,120),"Saints"); // Saints Sultan 1
Cars[saints3] = SetVehicleNumberPlate(CreateVehicle(560,-2632.6096,1376.6050,6.9095,180.1853,22,22,120),"Saints"); // Saints Sultan
Cars[saints4] = SetVehicleNumberPlate(CreateVehicle(560,-2626.3423,1377.5211,6.9178,178.9595,22,22,120),"Saints"); // Saints Sultan
Cars[saints5] = SetVehicleNumberPlate(CreateVehicle(560,-2620.1167,1377.8539,6.9195,180.6810,22,22,120),"Saints"); // Saints Sultan
Cars[saints6] = SetVehicleNumberPlate(CreateVehicle(451,-2644.5520,1362.3519,6.9440,269.8624,22,22,120),"Saints"); // Saints Turismo
Cars[saints7] = SetVehicleNumberPlate(CreateVehicle(522,-2645.0708,1350.9330,6.9445,271.4766,22,22,120),"Saints"); // Saints NRG 1
Cars[saints8] = SetVehicleNumberPlate(CreateVehicle(522,-2646.3582,1347.0519,6.9502,270.3860,22,22,120),"Saints"); // Saints NRG 2
Cars[saints9] = SetVehicleNumberPlate(CreateVehicle(520,-2640.5837,1418.0747,23.8984,199.6787,22,22,120),"Saints"); // Saints Hydra
Cars[saints10] = SetVehicleNumberPlate(CreateVehicle(487,-2657.3650,1400.7468,23.8984,293.9929,22,22,120),"Saints"); // Saints Heli
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == 2)
{
new CarCheck = GetPlayerVehicleID(playerid);
if(CarCheck == Cars[saints1] || Cars[saints2] || Cars[saints3] || Cars[saints4] || Cars[saints5] || Cars[saints6] || Cars[saints7] || Cars[saints8] || Cars[saints9] || Cars[saints10] )
{
if(pTeam[playerid] != team_saints)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED, "You Don't have the keys for this car!");
return 1;
}
else if(pTeam[playerid] == team_saints){SendClientMessage(playerid, COLOR_YELLOW, "You passed the Saints Exam!");}
}
return 1;
}
//------------------------------------------------------------------------------
return 1;
}