public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(!ispassenger)
{
if(IsDMVCar(vehicleid))
{
if(!LicenseTest[playerid])
{
SendClientMessage(playerid, COLOR_ORANGE, "You are not taking a drivers license test.");
ClearAnimations(playerid,true);
}
else
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* GPS: Finish the test by driving through all of the checkpoints on your GPS.");
SetPlayerCheckpoint(playerid,980.1932,-1407.9902,13.0956,5);
SendClientMessage(playerid, COLOR_RED, "If you exit the car your test will be failed and it will have to be re-done.");
}
}
if(IsDLCar(vehicleid))
{
ClearAnimations(playerid,true);
}
else if(IsFamVehicle(vehicleid) && Fam[vehicleid] != PlayerInfo[playerid][pFam] && !IsACop(playerid))
{
SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to a family.");
ClearAnimations(playerid,true);
print("Family cars loaded successfully.");
}
else if(IsLeoVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 1)
{
SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the LSPD.");
ClearAnimations(playerid,true);
print("Police Cars loaded successfully.");
}
else if(IsLSFMDVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 5)
{
SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the LSFMD.");
ClearAnimations(playerid,true);
print("LSFMD cars loaded successfully.");
}
else if(IsNewsVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 4)
{
SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the News Agency.");
ClearAnimations(playerid,true);
print("News cars loaded successfully.");
}
else if(IsFBIVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 6)
{
SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the FBI.");
ClearAnimations(playerid,true);
print("FBI cars loaded successfully.");
}
else if(IsNGVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 7)
{
SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the NG.");
ClearAnimations(playerid,true);
print("NG cars loaded successfully.");
}
else if(IsTruckerVehicle(vehicleid) && PlayerInfo[playerid][pJob] != JOB_TRUCKER)
{
SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the Truckers.");
ClearAnimations(playerid,true);
print("Trucks cars loaded successfully.");
}
else if(IsGovVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 2)
{
SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the GOV.");
ClearAnimations(playerid,true);
print("Gov cars loaded successfully.");
}
}
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(LicenseTest[playerid])
{
DisablePlayerCheckpoint(playerid);
LicenseTest[playerid] = 0;
CP[playerid] = 0;
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Driving Center: You have left your car, therefore your test has been failed.");
}
if(PlayerInfo[playerid][pFac] == 1 && PlayerInfo[playerid][pFac] == 7 && PlayerInfo[playerid][pFac] == 6)
{
LastCar[playerid] = vehicleid;
}
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_PASSENGER)
{
SetPlayerArmedWeapon(playerid,0);
}
if(newstate == PLAYER_STATE_PASSENGER)
{
if(newstate == PLAYER_STATE_PASSENGER)
{
new gun,tmp;
GetPlayerWeaponData(playerid,4,gun,tmp);
#pragma unused tmp
if(gun)SetPlayerArmedWeapon(playerid,gun);
else SetPlayerArmedWeapon(playerid,0);
}
}
if(newstate == PLAYER_STATE_DRIVER && oldstate != PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(!engine) SendClientMessage(playerid, COLOR_WHITE, "You can start or stop the vehicle's engine using {FF6347}/engine{FFFFFF}.");
//if(!engine) GameTextForPlayer(playerid, "~w~/engine to turn on/off the vehicle engine.", 3500, 3);
if(!PlayerInfo[playerid][pCarLic]) SendClientMessage(playerid, COLOR_LIGHTRED, " You don't have a drivers license, beware of cops.");
//if(IsATowTruck(vehicleid)) SendClientMessage(playerid, COLOR_WHITE, "You can tow a vehicle using {FF6347}/tow{FFFFFF}.");
}
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(!ispassenger)
{
if(IsDMVCar(vehicleid))
{
if(!LicenseTest[playerid])
{
SendClientMessage(playerid, COLOR_ORANGE, "You are not taking a drivers license test.");
RemovePlayerFromVehicle(playerid);
ClearAnimations(playerid,true);
}
else
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* GPS: Finish the test by driving through all of the checkpoints on your GPS.");
SetPlayerCheckpoint(playerid,980.1932,-1407.9902,13.0956,5);
SendClientMessage(playerid, COLOR_RED, "If you exit the car your test will be failed and it will have to be re-done.");
}
}
if(IsDLCar(vehicleid))
{
RemovePlayerFromVehicle(playerid);
ClearAnimations(playerid,true);
}
else if(IsFamVehicle(vehicleid) && Fam[vehicleid] != PlayerInfo[playerid][pFam] && !IsACop(playerid))
{
SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to a family.");
RemovePlayerFromVehicle(playerid);
ClearAnimations(playerid,true);
print("Family cars loaded successfully.");
}
else if(IsLeoVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 1)
{
SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the LSPD.");
RemovePlayerFromVehicle(playerid);
ClearAnimations(playerid,true);
print("Police Cars loaded successfully.");
}
else if(IsLSFMDVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 5)
{
SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the LSFMD.");
RemovePlayerFromVehicle(playerid);
ClearAnimations(playerid,true);
print("LSFMD cars loaded successfully.");
}
else if(IsNewsVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 4)
{
SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the News Agency.");
RemovePlayerFromVehicle(playerid);
ClearAnimations(playerid,true);
print("News cars loaded successfully.");
}
else if(IsFBIVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 6)
{
SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the FBI.");
RemovePlayerFromVehicle(playerid);
ClearAnimations(playerid,true);
print("FBI cars loaded successfully.");
}
else if(IsNGVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 7)
{
SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the NG.");
RemovePlayerFromVehicle(playerid);
ClearAnimations(playerid,true);
print("NG cars loaded successfully.");
}
else if(IsTruckerVehicle(vehicleid) && PlayerInfo[playerid][pJob] != JOB_TRUCKER)
{
SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the Truckers.");
RemovePlayerFromVehicle(playerid);
ClearAnimations(playerid,true);
print("Trucks cars loaded successfully.");
}
else if(IsGovVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 2)
{
SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the GOV.");
RemovePlayerFromVehicle(playerid);
ClearAnimations(playerid,true);
print("Gov cars loaded successfully.");
}
}
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(LicenseTest[playerid])
{
DisablePlayerCheckpoint(playerid);
LicenseTest[playerid] = 0;
CP[playerid] = 0;
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Driving Center: You have left your car, therefore your test has been failed.");
}
if(PlayerInfo[playerid][pFac] == 1 && PlayerInfo[playerid][pFac] == 7 && PlayerInfo[playerid][pFac] == 6)
{
LastCar[playerid] = vehicleid;
}
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_PASSENGER)
{
SetPlayerArmedWeapon(playerid,0);
}
if(newstate == PLAYER_STATE_PASSENGER)
{
if(newstate == PLAYER_STATE_PASSENGER)
{
new gun,tmp;
GetPlayerWeaponData(playerid,4,gun,tmp);
#pragma unused tmp
if(gun)SetPlayerArmedWeapon(playerid,gun);
else SetPlayerArmedWeapon(playerid,0);
}
}
if(newstate == PLAYER_STATE_DRIVER && oldstate != PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(!engine) SendClientMessage(playerid, COLOR_WHITE, "You can start or stop the vehicle's engine using {FF6347}/engine{FFFFFF}.");
//if(!engine) GameTextForPlayer(playerid, "~w~/engine to turn on/off the vehicle engine.", 3500, 3);
if(!PlayerInfo[playerid][pCarLic]) SendClientMessage(playerid, COLOR_LIGHTRED, " You don't have a drivers license, beware of cops.");
//if(IsATowTruck(vehicleid)) SendClientMessage(playerid, COLOR_WHITE, "You can tow a vehicle using {FF6347}/tow{FFFFFF}.");
}
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
LastCar[playerid] = vehicleid;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new gun,tmp,engine,lights,alarm,doors,bonnet,boot,objective;
#pragma unused tmp
if(newstate == PLAYER_STATE_PASSENGER) SetPlayerArmedWeapon(playerid,0);
if(newstate == PLAYER_STATE_PASSENGER) {
if(newstate == PLAYER_STATE_PASSENGER) {
GetPlayerWeaponData(playerid,4,gun,tmp);
if(gun)SetPlayerArmedWeapon(playerid,gun);
else SetPlayerArmedWeapon(playerid,0);
}
}
if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT) {
if(LicenseTest[playerid]) {
DisablePlayerCheckpoint(playerid);
LicenseTest[playerid] = 0;
CP[playerid] = 0;
SetVehicleToRespawn(LastCar[playerid]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Driving Center: You have left your car, therefore your test has been failed.");
}
}
if(newstate == PLAYER_STATE_DRIVER && oldstate != PLAYER_STATE_DRIVER) {
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(!engine) SendClientMessage(playerid, COLOR_WHITE, "You can start or stop the vehicle's engine using {FF6347}/engine{FFFFFF}.");
//if(!engine) GameTextForPlayer(playerid, "~w~/engine to turn on/off the vehicle engine.", 3500, 3);
if(!PlayerInfo[playerid][pCarLic]) SendClientMessage(playerid, COLOR_LIGHTRED, " You don't have a drivers license, beware of cops.");
//if(IsATowTruck(vehicleid)) SendClientMessage(playerid, COLOR_WHITE, "You can tow a vehicle using {FF6347}/tow{FFFFFF}.");
if(IsDMVCar(vehicleid)) {
if(!LicenseTest[playerid]) {
SendClientMessage(playerid, COLOR_ORANGE, "You are not taking a drivers license test.");
ClearAnimations(playerid,true);
}
else {
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* GPS: Finish the test by driving through all of the checkpoints on your GPS.");
SetPlayerCheckpoint(playerid,980.1932,-1407.9902,13.0956,5);
SendClientMessage(playerid, COLOR_RED, "If you exit the car your test will be failed and it will have to be re-done.");
}
}
if(IsDLCar(vehicleid)) ClearAnimations(playerid,true);
else if(IsFamVehicle(vehicleid) && Fam[vehicleid] != PlayerInfo[playerid][pFam] && !IsACop(playerid)) {
SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to a family.");
ClearAnimations(playerid,true);
print("Family cars loaded successfully.");
}
else if(IsLeoVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 1) {
SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the LSPD.");
ClearAnimations(playerid,true);
print("Police Cars loaded successfully.");
}
else if(IsLSFMDVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 5) {
SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the LSFMD.");
ClearAnimations(playerid,true);
print("LSFMD cars loaded successfully.");
}
else if(IsNewsVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 4) {
SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the News Agency.");
ClearAnimations(playerid,true);
print("News cars loaded successfully.");
}
else if(IsFBIVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 6) {
SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the FBI.");
ClearAnimations(playerid,true);
print("FBI cars loaded successfully.");
}
else if(IsNGVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 7) {
SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the NG.");
ClearAnimations(playerid,true);
print("NG cars loaded successfully.");
}
else if(IsTruckerVehicle(vehicleid) && PlayerInfo[playerid][pJob] != JOB_TRUCKER) {
SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the Truckers.");
ClearAnimations(playerid,true);
print("Trucks cars loaded successfully.");
}
else if(IsGovVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 2) {
SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the GOV.");
ClearAnimations(playerid,true);
print("Gov cars loaded successfully.");
}
}
return 1;
}
your issue is that you don't understand the functions. onplayerenterehicle is called when a player enters a vehicle but they are not physically in it yet so it will always mess you up and you cannot remove someone from a vehicle that they are not is so it simply fails. you need to rewrite the code so that most of the work is done under onplayerstatechange.
I'm feeling generous so I did it for ya lol: pawn Код:
|
C:\Users\Davey\Desktop\d-rp.pwn(24096) : error 017: undefined symbol "vehicleid"
C:\Users\Davey\Desktop\d-rp.pwn(24097) : error 017: undefined symbol "vehicleid"
C:\Users\Davey\Desktop\d-rp.pwn(24102) : error 017: undefined symbol "vehicleid"
C:\Users\Davey\Desktop\d-rp.pwn(24113) : error 017: undefined symbol "vehicleid"
C:\Users\Davey\Desktop\d-rp.pwn(24114) : error 017: undefined symbol "vehicleid"
C:\Users\Davey\Desktop\d-rp.pwn(24119) : error 017: undefined symbol "vehicleid"
C:\Users\Davey\Desktop\d-rp.pwn(24124) : error 017: undefined symbol "vehicleid"
C:\Users\Davey\Desktop\d-rp.pwn(24129) : error 017: undefined symbol "vehicleid"
C:\Users\Davey\Desktop\d-rp.pwn(24134) : error 017: undefined symbol "vehicleid"
C:\Users\Davey\Desktop\d-rp.pwn(24139) : error 017: undefined symbol "vehicleid"
C:\Users\Davey\Desktop\d-rp.pwn(24144) : error 017: undefined symbol "vehicleid"
C:\Users\Davey\Desktop\d-rp.pwn(24149) : error 017: undefined symbol "vehicleid"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
12 Errors.
pawn Код:
|
pawn Код:
|
enum // factions
{
FACTION_FBI,
FACTION_GOV,
FACTION_NEWS
...
};
GetVehicleFaction(vehicleid)
if (GetVehicleFaction(vehicleid) == FACTION_GOV)
// do your thing
if(IsDLCar(vehicleid)) ClearAnimations(playerid,true);
Edit: Also, to test your code you could just insert a debug message before/after
pawn Код:
|