Tutorial Lock Cars
#1

hello friend i add this car
PHP код:
AddStaticVehicle(411,535.9333,-1299.3344,17.5634,99.7864,0,56); 
in my RP server in car showroom when i create but i have to lock this car and when somebody try to get this car i want the car is locked and nobody can get it
Reply
#2

Place this above main()
pawn Код:
new Cars[MAX_VEHICLES];
And place this under OnGameModeInit()
pawn Код:
Cars[0] = AddStaticVehicle(411,535.9333,-1299.3344,17.5634,99.7864,0,56);

for(new i=1; i<MAX_VEHICLES; i++)
{
    SetVehicleParamsEx(Cars[i], 0,0,0,0,0,0,0);
}
Reply
#3

little for newbie i dont understand ?
Reply
#4

Press Control+F and type main().

Put this "new Cars[MAX_VEHICLES];" above main(). (without the " " though.)
Like this.
pawn Код:
new Cars[MAX_VEHICLES];

main()
{
    //some code
}
Press Control+F again and type OnGameModeInit(). Then put the rest of the code in it.
Like this.
pawn Код:
public OnGameModeInit()
{

    Cars[0] = AddStaticVehicle(411,535.9333,-1299.3344,17.5634,99.7864,0,56);

    for(new i=1; i<MAX_VEHICLES; i++)
    {
        SetVehicleParamsEx(Cars[i], 0,0,0,0,0,0,0);
    }
   
    return 1;
}
Reply
#5

ok and when i have to add new car what i have to do ?
Reply
#6

Do this;
pawn Код:
Cars[number] = AddStaticVehicle(411,535.9333,-1299.3344,17.5634,99.7864,0,56);
See below code;
pawn Код:
public OnGameModeInit()
{

    Cars[0] = AddStaticVehicle(411,535.9333,-1299.3344,17.5634,99.7864,0,56);
    Cars[1] = AddStaticVehicle(411,535.9333,-1299.3344,17.5634,99.7864,0,56);
    Cars[2] = AddStaticVehicle(411,535.9333,-1299.3344,17.5634,99.7864,0,56);
    Cars[3]= AddStaticVehicle(411,535.9333,-1299.3344,17.5634,99.7864,0,56);

    for(new i=1; i<MAX_VEHICLES; i++)
    {
        SetVehicleParamsEx(Cars[i], 0,0,0,0,0,0,0);
    }
   
    return 1;
}
Reply
#7

ok tnx 1000000000000000000000000000000xxxxxxxxxxxxx )))))
Reply
#8

No problem
Reply
#9

ok but what happend now ?
Reply
#10

Did you forget to put this code above main()?
pawn Код:
new Cars[MAX_VEHICLES];
Ops; my bad.

pawn Код:
public OnGameModeInit()
{

    Cars[0] = CreateVehicle(411,535.9333,-1299.3344,17.5634,99.7864,0,56, 60);
    Cars[1] = CreateVehicle(411,535.9333,-1299.3344,17.5634,99.7864,0,56, 60);
    Cars[2] = CreateVehicle(411,535.9333,-1299.3344,17.5634,99.7864,0,56, 60);
    Cars[3]= CreateVehicle(411,535.9333,-1299.3344,17.5634,99.7864,0,56, 60);

    for(new i=0; i<MAX_VEHICLES; i++)
    {
        SetVehicleParamsEx(Cars[i], 0,0,0,0,0,0,0);
    }
   
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)