22.07.2012, 07:20
Hey guys I'v got a problem with the onPlayerEnterVehicle section of the gamemode.
What iv got is:
You can see what it's supposed to do, but what im trying to figure out is why it is not doing so?
Obviously if you are not a trucker or skipper and you try enter a trucker or skipper vehicle it shouldnt let you in. It doesnt work though, the only park of the code that works is the top dmv vehicle bit.
Thanks for reading guys, apreciate all the help i can get.
What iv got is:
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)//click enter on vehicle
{
if(!ispassenger)
{
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;
}
Obviously if you are not a trucker or skipper and you try enter a trucker or skipper vehicle it shouldnt let you in. It doesnt work though, the only park of the code that works is the top dmv vehicle bit.
Thanks for reading guys, apreciate all the help i can get.