22.07.2012, 07:24
Delete everyhting from OnPlayerEnterVehicle,and add it to OnPlayerStateChange:
pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
if(newstate==PLAYER_STATE_DRIVER)
{
if(IsDMVCar(vehicleid))
{
if(!LicenseTest[playerid])
{
new Float:pos[3];
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
SendClientMessage(playerid, COLOR_ORANGE, "You are not taking a drivers license test.");
}
else
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* GPS: Finish the test by driving through all of the checkpoints on your GPS.");
SetPlayerCheckpoint(playerid,2040.7101,-1930.1340,13.4667,5);
SendClientMessage(playerid, COLOR_RED, "If you exit the car your test will be failed and it will have to be re-done.");
}
}
else if(IsFamVehicle(vehicleid) && Fam[vehicleid] != PlayerInfo[playerid][pFam] && !IsACop(playerid))
{
new Float:pos[3];
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
SendClientMessage(playerid, COLOR_ORANGE, " This vehicle is restricted to a family.");
}
else if(IsLeoVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 1)
{
new Float:pos[3];
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
SendClientMessage(playerid, COLOR_ORANGE, " This vehicle is restricted to the SAPD faction.");
}
else if(IsGovVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 2)
{
new Float:pos[3];
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
SendClientMessage(playerid, COLOR_ORANGE, " This vehicle is restricted to the GOV faction.");
}
else if(IsNewsVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 4)
{
new Float:pos[3];
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
SendClientMessage(playerid, COLOR_ORANGE, " This vehicle is restricted to the News Agency faction.");
}
else if(IsTruckerVehicle(vehicleid) && PlayerInfo[playerid][pJob] != JOB_TRUCKER)
{
new Float:pos[3];
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
SendClientMessage(playerid, COLOR_ORANGE, " This vehicle is restricted to Truckers.");
}
else if(IsSkipperVehicle(vehicleid) && PlayerInfo[playerid][pJob] != JOB_SKIPPER)
{
new Float:pos[3];
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
SendClientMessage(playerid, COLOR_ORANGE, " This vehicle is restricted to Skippers.");
}
}
return 1;
}