Team Vehicle Error
#1

Okay so i have been trying to setup some team vehicles for my VIP system and i have come across some problems.

After following a tut with slight changes the team vehicles worked for the first vehicle i added but every other vehicle i enter that is set under the team doesnt seem to work, anyone here care to help out?

Pastebin Link

http://pastebin.com/e6ArEaWM

I have also had that code like this

Quote:

new CarCheck = GetPlayerVehicleID(playerid);
if(CarCheck == Cars[VIPVEHICLES] || CarCheck == Car[VIPVEHICLES] || ..................)
{
if(RPLLogged[playerid] != 2)
{
RemovePlayerFromVehicle(playerid);

SendClientMessage(playerid, COLOR_RED,
"This Vehicle is for level 2 V.I.P Members only");
return 1;
}

But i had same result so i tried it the pastebin link way last but >< can anyone see anything im missing?
Thanks - Barney
Reply
#2

You must use something like that
Код:
if(CarCheck == Cars[VIPVEHICLES1] || CarCheck == Car[VIPVEHICLES2] || ..................)
Reply
#3

Yeah i know i have already tried using this and it gave me the same result, maybe i made an error? ill try again i guess lol

Okay i tested it with

Quote:

if(CarCheck == Cars[VIPVEHICLES] || CarCheck == Cars[VIPVEHICLES1] || CarCheck == Cars[VIPVEHICLES2] ||
CarCheck == Cars[VIPVEHICLES3] || CarCheck == Cars[VIPVEHICLES4] || CarCheck == Cars[VIPVEHICLES5] ||
CarCheck == Cars[VIPVEHICLES6] || CarCheck == Cars[VIPVEHICLES7] || CarCheck == Cars[VIPVEHICLES8] ||
CarCheck == Cars[VIPVEHICLES9] || CarCheck == Cars[VIPVEHICLES10] || CarCheck == Cars[VIPVEHICLES11] ||
CarCheck == Cars[VIPVEHICLES12] || CarCheck == Cars[VIPVEHICLES13] || CarCheck == Cars[VIPVEHICLES14] ||
CarCheck == Cars[VIPVEHICLES15] || CarCheck == Cars[VIPVEHICLES16] || CarCheck == Cars[VIPVEHICLES17] )

Same result only works for the first vehicle on the list
Reply
#4

You arent assigning the ids of the vehicles to your Cars array, you are assigning the return of SetVehicleNumberPlate which is always 1 on success
Reply
#5

Hmm okay thanks Nero_3D thats done it shame about having to remove the vehiclenumberplate guess ill find another way thanks again
Reply
#6

This would be one way, one of the best

Its quite easy the first vip vehicle gets a First_ in front of it and the last a Last_ in front of it, all other vip vehicles must be created between without any other to let the code work correctly
pawn Код:
#include <a_samp>

stock v_vip_first, v_vip_last;
#define First_CreateVIPVehicle(%0) SetVehicleNumberPlate((v_vip_first = CreateVehicle(%0, -1, -1, -1)), "V.I.P")
#define CreateVIPVehicle(%0) SetVehicleNumberPlate(CreateVehicle(%0, -1, -1, -1), "V.I.P")
#define Last_CreateVIPVehicle(%0) SetVehicleNumberPlate((v_vip_last = CreateVehicle(%0, -1, -1, -1)), "V.I.P")
#define IsVIPVehicle(%0) (v_vip_first <= (%0) <= v_vip_last) // IsVIPVehicle(vehicleid)

public OnFilterScriptInit()
{
    First_CreateVIPVehicle(415, -1687.4291, 1020.2954, 17.3572, 90.5694);
    CreateVIPVehicle(415, -1687.3451, 995.5764 ,17.3574, 89.4433);
    CreateVIPVehicle(415, -1720.5601, 999.7566 ,17.3575, 89.9307);
    CreateVIPVehicle(415, -1736.2394, 1011.8725 ,17.3573, 268.9875);
    CreateVIPVehicle(415, -1736.4794, 1049.1646 ,17.3570, 270.3551);
    CreateVIPVehicle(587, -1704.9294, 1058.4615 ,17.3126, 179.9306);
    CreateVIPVehicle(587, -1693.3130, 977.8688 ,17.3132, 0.9185);
    CreateVIPVehicle(587, -1720.7479, 1007.9931 ,17.3125, 90.6050);
    CreateVIPVehicle(451, -1721.2965, 1024.4523 ,17.2918, 89.3517);
    CreateVIPVehicle(451, -1736.3378, 1057.1055 ,17.2916, 270.4988);
    CreateVIPVehicle(451, -1688.1578, 1049.1813 ,17.2914, 89.7993);
    CreateVIPVehicle(451, -1703.3026, 1007.8652 ,17.2933, 270.2077);
    CreateVIPVehicle(477, -1687.7467, 1036.7361 ,17.3403, 88.6032);
    CreateVIPVehicle(565, -1702.7471, 1028.4735 ,17.2098, 269.7582);
    CreateVIPVehicle(411, -1736.1897, 1036.5925 ,17.3130, 270.6841);
    CreateVIPVehicle(411, -1720.9688, 1011.9447 ,17.3130, 88.8832);
    CreateVIPVehicle(521, -1736.5042, 1020.2866 ,17.1566, 268.1967);
    Last_CreateVIPVehicle(521, -1687.6051, 1008.0736 ,17.1579, 86.0123);
}

new RPLLogged[MAX_PLAYERS];
#define COLOR_RED 0xFF0000FF

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == 2)
    {
        if(RPLLogged[playerid] != 2)
        {
            newstate = GetPlayerVehicleID(playerid);
            if(IsVIPVehicle(newstate))
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_RED, "This Vehicle is for level 2 V.I.P Members only");
                return 1;
            }
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)