Tiny bit of help here..
#1

Hey, i was making something for houses like decoration so i added vehicles to my house. Now, when i set the params the LOCK it don't lock for some reason? Sorry im very bad at Vehicle params :/

Heres my code:
pawn Код:
stock LoadHouseVehicles()
{
    new Vehicle1, Vehicle2, Vehicle3, Vehicle4;
    Vehicle1 = AddStaticVehicle(411,304.5750,307.1935,998.8726,180.6237,2,2); // Lorenc's decoration for mansion
    Vehicle2 = AddStaticVehicle(471,304.5936,301.8831,998.6301,51.6367,3,2); // Lorenc's decoration for mansion
    Vehicle3 = AddStaticVehicle(481,301.1681,311.1415,1002.8215,267.7467,5,5); // Lorenc's decoration for mansion
    Vehicle4 = AddStaticVehicle(510,301.2008,310.0543,1002.9124,264.3163,5,5); // Lorenc's decoration for mansion

    LinkVehicleToInterior(Vehicle1, 4);
    LinkVehicleToInterior(Vehicle2, 4);
    LinkVehicleToInterior(Vehicle3, 4);
    LinkVehicleToInterior(Vehicle4, 4);

    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        SetVehicleParamsForPlayer(Vehicle1, i, 0, 1);
        SetVehicleParamsForPlayer(Vehicle2, i, 0, 1);
        SetVehicleParamsForPlayer(Vehicle3, i, 0, 1);
        SetVehicleParamsForPlayer(Vehicle4, i, 0, 1);
    }
}
Do i use CreateVehicle? need moar info ask pls.
Reply
#2

Do not SetVeh params on GameModeInit

OnPlayerSpawn Set params

because Server can't lock a car for player who isn't online, so you join the server, but car isn't locked, that why is call SetVehicleParamsForPlayer FOR PLAYER.
Reply
#3

DAMN double post

Do not SetVeh params on GameModeInit

OnPlayerSpawn Set params

because Server can't lock a car for player who isn't online, so you join the server, but car isn't locked, that why is call SetVehicleParamsForPlayer FOR PLAYER.

I suggest you on top of script add
pawn Код:
new CarLocked[MAX_VEHICLES];
pawn Код:
stock LoadHouseVehicles()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        SetVehicleParamsForPlayer(Vehicle1, i, 0, 1); CarLocked[vehicle1] = 1;
        SetVehicleParamsForPlayer(Vehicle2, i, 0, 1); CarLocked[vehicle2] = 1;
        SetVehicleParamsForPlayer(Vehicle3, i, 0, 1); CarLocked[vehicle3] = 1;
        SetVehicleParamsForPlayer(Vehicle4, i, 0, 1); CarLocked[vehicle4] = 1;
    }
}
pawn Код:
OnPlayerSpawn

    for(new i = 0; i < MAX_VEHICLES; i++)
    {
        if(CarLocked[i] == 1)
        {
            SetVehicleParamsForPlayer(i, playerid, 0, 1);
        }
    }
Reply
#4

Quote:
Originally Posted by ikey07
Посмотреть сообщение
Do not SetVeh params on GameModeInit

OnPlayerSpawn Set params

because Server can't lock a car for player who isn't online, so you join the server, but car isn't locked, that why is call SetVehicleParamsForPlayer FOR PLAYER.
That still dont work...

EDIT: You didnt even tell me where i should put my function, onplayerspawn dont work soz
Reply
#5

Use createvehicle, AddstaticVeh is basicly to be made only in GameModeInIt.
Reply
#6

https://sampwiki.blast.hk/wiki/OnVehicleStreamIn
Reply
#7

Quote:
Originally Posted by Jefff
Посмотреть сообщение
Need an example please. Thanks
Reply
#8

Quote:
Originally Posted by The Toni
Посмотреть сообщение
Use createvehicle, AddstaticVeh is basicly to be made only in GameModeInIt.
Ding, Ding, Ding...


But Vehicle params you must set when player is online, else it wont take effect.

Anyway @ author try to use the way from my first post, just now under

OnPlayerUpdate put that for(....

so the each one second, server will check which car is locked, which player is online, and what need to do.
You cannot SetVeh params on gamemodeinit.

from LoadHouseVehicles() remove these params sets
Reply
#9

Quote:
Originally Posted by ikey07
Посмотреть сообщение
Ding, Ding, Ding...


But Vehicle params you must set when player is online, else it wont take effect.

Anyway @ author try to use the way from my first post, just now under

OnPlayerUpdate put that for(....

so the each one second, server will check which car is locked, which player is online, and what need to do.
You cannot SetVeh params on gamemodeinit.

from LoadHouseVehicles() remove these params sets
That worked :P Thanks but dont copy and paste wat u wrote on ur old posts like "You cannot SetVeh params on gamemodeinit." It so confuses me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)