restricted faction cars help
#1

Everyone can go in every faction car, but i don't know whats worng, can someone help me please, the only car you can't enter is the licenses car

+rep if you helped me!

pawn Код:
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;
}
Reply
#2

Try this :

pawn Код:
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;
}
You have to use RemovePlayerFromVehicle when a player goes into a Faction cart
Reply
#3

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 Код:
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;
}
remove everything you originally posted from your gm and replace with this.
Reply
#4

Quote:
Originally Posted by CJay9209
Посмотреть сообщение
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 Код:
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;
}
remove everything you originally posted from your gm and replace with this.
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.
how to fix it again XD
Reply
#5

Quote:
Originally Posted by lulo356
Посмотреть сообщение
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.
how to fix it again XD
Errors are fixed forgot the new vehicleid = GetPlayerVehicleID(playerid);
Reply
#6

Problem about the faction cars is still NOT solved, you can still enter every faction car.
Reply
#7

Someone....
Reply
#8

use only
ClearAnimations(playerid);

and try
Reply
#9

Quote:
Originally Posted by lulo356
Посмотреть сообщение
pawn Код:
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.");
}
This might be a little off topic but if I may give you a tip:
Do yourself a favor and don't use seperate functions for every faction. Also don't use literal numbers for the factions but rather use defines or an enum like you did with the jobs.
pawn Код:
enum // factions
{
    FACTION_FBI,
    FACTION_GOV,
    FACTION_NEWS
    ...
};
So that way you can use only one function like
Код:
GetVehicleFaction(vehicleid)
which returns the faction so you can do something like this:
pawn Код:
if (GetVehicleFaction(vehicleid) == FACTION_GOV)
    // do your thing
I hope this helps and might even resolve your problem.


Edit: Also, to test your code you could just insert a debug message before/after
pawn Код:
if(IsDLCar(vehicleid)) ClearAnimations(playerid,true);
to see where you get stuck.
Reply
#10

Quote:
Originally Posted by Madd92
Посмотреть сообщение
Edit: Also, to test your code you could just insert a debug message before/after
pawn Код:
if(IsDLCar(vehicleid)) ClearAnimations(playerid,true);
to see where you get stuck.
I have to quote myself here... do that and if you can't figure it out, you will have to show us your IsLeoVehicle etc. functions.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)