31.12.2012, 12:51
Hello everyone,
I was working on the zGaming script. I decided to add new faction (SAFD), okay everything is good.
Added restriction on OnPlayerEnterVehicle and such things, but here's a problem. Whoever try's to enter any faction vehicle, he's free to do so. It should of Remove him from the car, but it's not working :S.
Here's the code :
Anyone have idea why it's not working ? :S
Thanks in advance !
I was working on the zGaming script. I decided to add new faction (SAFD), okay everything is good.
Added restriction on OnPlayerEnterVehicle and such things, but here's a problem. Whoever try's to enter any faction vehicle, he's free to do so. It should of Remove him from the car, but it's not working :S.
Here's the code :
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(!ispassenger)
{
if(IsDMVCar(vehicleid))
{
if(!LicenseTest[playerid])
{
RemovePlayerFromVehicle(playerid);
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))
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_ORANGE, " This vehicle is restricted to a family.");
}
else if(IsLeoVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 1)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_ORANGE, " This vehicle is restricted to the SAPD faction.");
}
else if(IsGovVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 2)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_ORANGE, " This vehicle is restricted to the GOV faction.");
}
else if(IsNewsVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 4)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_ORANGE, " This vehicle is restricted to the News Agency faction.");
}
else if(IsSAFDVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 5)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_ORANGE, " This vehicle is restricted to the SAFD faction.");
}
else if(IsTruckerVehicle(vehicleid) && PlayerInfo[playerid][pJob] != JOB_TRUCKER)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_ORANGE, " This vehicle is restricted to Truckers.");
}
}
return 1;
}
pawn Код:
stock IsGovVehicle(vehicleid)
{
for(new i=0; i<7; i++)
{
if(vehicleid == FacInfo[2][fCars][i]) return 1;
}
return 0;
}
stock IsDMVCar(vehicleid)
{
for(new i=0; i<5; i++)
{
if(vehicleid == DMVCar[i]) return 1;
}
return 0;
}
stock IsNewsVehicle(vehicleid)
{
for(new i=0; i<7; i++)
{
if(vehicleid == FacInfo[4][fCars][i]) return 1;
}
return 0;
}
stock IsLeoVehicle(vehicleid)
{
for(new i=0; i<26; i++)
{
if(vehicleid == FacInfo[1][fCars][i]) return 1;
}
return 0;
}
stock IsSAFDVehicle(vehicleid)
{
for(new i=0; i<8; i++)
{
if(vehicleid == FacInfo[5][fCars][i]) return 1;
}
return 0;
}
stock IsFamVehicle(vehicleid)
{
for(new idx=1; idx<MAX_FAMILIES; idx++)
{
for(new v=0; v<50; v++)
{
if(vehicleid == FamInfo[idx][fVeh][v]) return 1;
}
}
return 0;
}
Thanks in advance !
![Smiley](images/smilies/smile.png)