Reserved car
#1

hi, today i want to make a reserved cars for a TEAM :

pawn Код:
Steven[1] = AddStaticVehicleEx(411,1868.5621,1989.3055,13.5119,180.7125,0,0,30000); // infernus 1
    Steven[2] = AddStaticVehicleEx(411,1872.0961,1989.4083,13.5119,179.7480,0,0,30000); // infernus 2
    Steven[3] = AddStaticVehicleEx(411,1875.7762,1989.5687,13.5119,179.9972,0,0,30000); // infernus 3
    Steven[4] = AddStaticVehicleEx(411,1879.4128,1989.4852,13.5119,180.7163,0,0,30000); // infernus 4
    Steven[5] = AddStaticVehicleEx(411,1882.9601,1989.4960,13.5119,180.4340,0,0,30000); // infernus 5
    Steven[6] = AddStaticVehicleEx(506,1886.4751,1989.2449,13.4893,179.3505,0,0,30000); // Super GT 1
    Steven[7] = AddStaticVehicleEx(506,1890.0415,1989.2548,13.4891,179.8961,0,0,30000); // Super GT 2
    Steven[8] = AddStaticVehicleEx(506,1893.5865,1989.3324,13.4891,180.5785,0,0,30000); // Super GT 3
    Steven[9] = AddStaticVehicleEx(603,1897.2170,1989.5029,13.6234,180.0863,1,0,30000); // Phoenix 1
    Steven[10] = AddStaticVehicleEx(603,1900.7216,1989.4404,13.6228,179.9936,1,0,30000); // Phoenix 2
    Steven[11] = AddStaticVehicleEx(475,1907.9241,1933.3624,13.5887,180.4065,0,0,30000); // Sabre 1
    Steven[12] = AddStaticVehicleEx(494,1904.8640,1933.2744,13.6800,180.4638,0,0,30000); // Hotring 1
    Steven[13] = AddStaticVehicleEx(451,1868.5598,1966.5045,13.4920,0.0871,0,0,30000); // Turismo 1
    Steven[14] = AddStaticVehicleEx(451,1872.0426,1966.4852,13.4918,359.7988,0,0,30000); // Turismo 2
    Steven[15] = AddStaticVehicleEx(415,1875.8241,1966.2932,13.5566,357.6921,0,0,30000); // Cheetah 1
    Steven[16] = AddStaticVehicleEx(415,1879.3198,1966.2122,13.5561,357.6372,0,0,30000); // Cheetah 2
    Steven[17] = AddStaticVehicleEx(587,1882.7712,1966.4265,13.5137,0.1047,0,0,30000); // Euros 1
    Steven[18] = AddStaticVehicleEx(587,1886.4435,1966.4004,13.5117,0.2254,0,0,30000); // Euros 2
    Steven[19] = AddStaticVehicleEx(434,1901.8115,1933.6578,13.7494,181.0884,0,0,30000); // Hotknife 1
    Steven[20] = AddStaticVehicleEx(571,1898.4742,1932.5615,13.0686,359.3598,0,0,30000); // Kart 1
    Steven[21] = AddStaticVehicleEx(571,1895.6714,1932.5552,13.0687,358.5550,0,0,30000); // Kart 2
    Steven[22] = AddStaticVehicleEx(463,1890.4736,1965.2111,13.3251,358.2950,0,0,30000); // Freeway 1
    Steven[23] = AddStaticVehicleEx(463,1893.6488,1965.2261,13.3249,359.4409,0,0,30000); // Freeway 2
    Steven[24] = AddStaticVehicleEx(463,1897.3081,1965.4023,13.3252,357.9375,0,0,30000); // Freeway 3
    Steven[25] = AddStaticVehicleEx(463,1900.8470,1965.1479,13.3251,356.9601,0,0,30000); // Freeway 4
    Steven[26] = AddStaticVehicleEx(471,1892.5817,1932.6361,13.2658,356.6921,0,1,30000); // Quad 1
    Steven[27] = AddStaticVehicleEx(471,1889.5093,1932.6454,13.2661,359.7975,0,1,30000); // Quad 2
    Steven[28] = AddStaticVehicleEx(409,1855.5044,1998.8965,13.5848,180.5302,0,1,30000); // Stretch 1
    Steven[29] = AddStaticVehicleEx(409,1855.5278,1987.0555,13.5848,179.7491,0,1,30000); // Stretch 2
    Steven[30] = AddStaticVehicleEx(409,1855.4364,1975.7500,13.5848,359.6606,0,1,30000); // Stretch 3
    Steven[31] = AddStaticVehicleEx(522,1868.4280,1989.3242,7.1720,179.6025,0,1,30000); // NRG-500 1
    Steven[32] = AddStaticVehicleEx(522,1872.1930,1989.2683,7.1656,180.8606,0,1,30000); // NRG-500 2
    Steven[33] = AddStaticVehicleEx(522,1875.7706,1989.4865,7.1661,179.7000,0,1,30000); // NRG-500 3
    Steven[34] = AddStaticVehicleEx(522,1879.6306,1989.5394,7.1649,182.3711,0,1,30000); // NRG-500 4
    Steven[35] = AddStaticVehicleEx(521,1882.7335,1989.7627,7.1594,178.2640,0,1,30000); // FCR-900 1
    Steven[36] = AddStaticVehicleEx(521,1886.4050,1989.9397,7.1648,178.7149,0,1,30000); // FCR-900 2
    Steven[37] = AddStaticVehicleEx(468,1889.6233,1990.1316,7.2629,179.6506,0,1,30000); // Sanchez 1
    Steven[38] = AddStaticVehicleEx(468,1893.5334,1990.1766,7.2637,177.6483,0,1,30000); // Sanchez 2
    Steven[39] = AddStaticVehicleEx(541,1897.2803,1989.3392,7.2196,179.8498,0,1,30000); // Bullet 1
    Steven[40] = AddStaticVehicleEx(541,1901.1266,1989.3165,7.2195,179.6003,0,1,30000); // Bullet 2
    Steven[41] = AddStaticVehicleEx(525,1897.3634,2023.8721,7.4709,74.1835,1,0,30000); // Tow Truck 1
    Steven[42] = AddStaticVehicleEx(525,1889.1279,2026.1887,7.4774,73.5538,1,0,30000); // Tow Truck 2
    Steven[43] = AddStaticVehicleEx(487,1894.5361,1855.4196,27.6377,221.3191,0,1,30000); // Maverick 1
    Steven[44] = AddStaticVehicleEx(487,1965.4038,1916.4393,131.1078,5.2563,0,1,30000); // Maverick 2
    Steven[45] = AddStaticVehicleEx(425,1945.1050,1784.4509,19.4764,94.5575,43,0,30000); // Hunter 1
    Steven[46] = AddStaticVehicleEx(425,1926.9789,1784.6176,19.4758,89.0779,43,0,30000); // Hunter 2
    Steven[47] = AddStaticVehicleEx(469,1948.0114,1760.5115,18.9148,270.1940,1,3,30000); // Sparrow 1
    Steven[48] = AddStaticVehicleEx(447,1933.2593,1760.3375,18.9175,271.5291,75,2,30000); // Seasparrow 1
    Steven[49] = AddStaticVehicleEx(497,2054.5571,1846.8440,27.6361,269.1698,0,1,30000); // Police Maverick 1
    Steven[50] = AddStaticVehicleEx(520,1975.2539,1749.0120,19.6571,270.9040,0,0 ,30000); // Hydra 1
    Steven[51] = AddStaticVehicleEx(520,1997.0013,1749.4561,19.6571,270.9715,0,0,30000); // Hydra 2
    Steven[52] = AddStaticVehicleEx(406,1910.0643,1768.8787,20.4430,359.0325,1,1,30000); // Dumper 1
this is the cars...
now this is the callback "OnPlayerStateChange"

pawn Код:
new vehicleid = GetPlayerVehicleID(playerid);
            if(vehicleid == Steven[1] || Steven[2] || Steven[3] || Steven[4] || Steven[5] || Steven[6] || Steven[7] || Steven[8] || Steven[9] || Steven[10] || Steven[11] || Steven[12] || Steven[13] || Steven[14] || Steven[15] || Steven[16] || Steven[17] || Steven[18] || Steven[19] || Steven[20] || Steven[21]
            || Steven[22] || Steven[23] || Steven[24] || Steven[25] || Steven[26] || Steven[27] || Steven[28] || Steven[29] || Steven[30] || Steven[31] || Steven[32] || Steven[33] || Steven[34] || Steven[35] || Steven[36] || Steven[37] || Steven[38] || Steven[39] || Steven[40] || Steven[41] || Steven[42]
            || Steven[43] || Steven[44] || Steven[45] || Steven[46] || Steven[47] || Steven[48] || Steven[49] || Steven[50] || Steven[51] || Steven[52])
            {
               if(APlayerData[playerid][Team] == TEAM_BALLAS)
               {
                   SendClientMessage(playerid, TEAM_BALLAS_COLOR, "[TEAMS] {FF0000}Welcome to Ballas Team");
                   return 1;
               }
               else SendClientMessage(playerid, 0xFFFFFFFF, "[TEAMS] {FF0000}This vehicle is reserverved for Ballas TEAM"), RemovePlayerFromVehicle(playerid);
            }
the problem is when i take anycar i got the error message : "[TEAMS] {FF0000}This vehicle is reserved for Ballas TEAM"

what's wrong ? O_o

thx for helping.
Reply
#2

Fait comme зa (Do like this is to fast )

PHP код:
forward StevenCar(carid);
public 
StevenCar(carid)
{
    for(new 
0sizeof(Steven); i++)
    {
        if(
carid == Steven[i])    return 1;
    }
    return 
0;

PHP код:
new vehicleid GetPlayerVehicleID(playerid);
if(
StevenCar(vehicleid))
{
    if(
APlayerData[playerid][Team] == TEAM_BALLAS)
    {
        
SendClientMessage(playeridTEAM_BALLAS_COLOR"[TEAMS] {FF0000}Welcome to Ballas Team");
    }
    else
    {
        
SendClientMessage(playerid0xFFFFFFFF"[TEAMS] {FF0000}This vehicle is reserverved for Ballas TEAM"),
        
RemovePlayerFromVehicle(playerid);
    } 
Reply
#3

EDIT: late answer anyway ;/
Reply
#4

Okay thx i will try this ( merci j'essai )
Reply
#5

First of all, why are you complicating things?
pawn Код:
stock IsBallasCar(vehicleid)
{
    for(new i = 0; i<53; i++)
    {
        if(vehicleid == Steven[i])
        {
            break;
            return 1;
        }
    }
    return 0;
}
// OnPlayerVehicle or OnPlayerStateChange
if(IsBallasCar(GetPlayerVehicleID(playerid)) && APlayerData[playerid][Team] == TEAM_BALLAS)
{
   // code
}
else
{
    // code
}
EDIT: Yeah, I posted it too late.
Reply
#6

Thx for all , i have use StreetRP solution and it's work fine.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)