SetVehicleParamsForPlayer bug...
#1

I maded a lock command with SetVehicleParamsForPlayer
but i have a little bug with it

after i lock the vehicle the vehicle is locked but i go far away from the vehicle and then i back the vehicle is unlocked i dont know why..
Reply
#2

cus ur the one who locked the car maybe.. when u reenter the car its gets unlocked>?

get someone to test with u whats ur server ip
Reply
#3

Kar, gtfo, you know nothing.

Quote:
Originally Posted by Ben147
I maded a lock command with SetVehicleParamsForPlayer
but i have a little bug with it

after i lock the vehicle the vehicle is locked but i go far away from the vehicle and then i back the vehicle is unlocked i dont know why..
It's because in 0.3a it changes, something about Streaming the vehicle (OnVehicleStreamIn)
I THINK you need to re-add that under OnVehicleStreamIn ..

pawn Code:
if(Locked[carid] == 1)
{
   SetVehicleParamsForPlayer(playerid, 0, 1);
   return 1;
}
or something like that, not sure.

(( this is an example ))
Reply
#4

Put this at the top of your scirpt
pawn Code:
new VehLocked[MAX_PLAYERS];
Then this somewhere in your scirpt

pawn Code:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
 
    if(VehLocked[vehicleid] == 1)
    {
     
        {
            SetVehicleParamsForPlayer(vehicleid,forplayerid, 0, 1);
        }
    } else {
   
        {
            SetVehicleParamsForPlayer(vehicleid,forplayerid, 0, 0);
        }
    }
    return 1;
}
Put this in your /lock command
pawn Code:
VehLocked[vehicleid] = 1;
Reply
#5

Wow, I was basicly right, cool :P
Reply
#6

Quote:
Originally Posted by [SL~RP
ihatetn931 ]
Put this at the top of your scirpt
pawn Code:
new VehLocked[MAX_PLAYERS];
Then this somewhere in your scirpt

pawn Code:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
 
    if(VehLocked[vehicleid] == 1)
    {
     
        {
            SetVehicleParamsForPlayer(vehicleid,forplayerid, 0, 1);
        }
    } else {
   
        {
            SetVehicleParamsForPlayer(vehicleid,forplayerid, 0, 0);
        }
    }
    return 1;
}
Put this in your /lock command
pawn Code:
VehLocked[vehicleid] = 1;
new VehLocked[MAX_VEHICLES];

not players... i will check it now Thanks you!
Reply
#7

The problem with that code is that it will lock for ALL players, even the one who locked It.
This will cause the person to not being able to re-enter the vehicle if he leaves It.

You will have to make a variable that connects the player to the vehicle.
Reply
#8

Quote:
Originally Posted by ♂ Antonio [G-RP
]
Wow, I was basicly right, cool :P
So you guessed? gtfo, you know nothing. xD
Reply
#9

Quote:
Originally Posted by Conroy
Quote:
Originally Posted by ♂ Antonio [G-RP
]
Wow, I was basicly right, cool :P
So you guessed? gtfo, you know nothing. xD
I made an educated guess, based on what I already knew
Reply
#10

I know, I know, I was joking around about what you said to Kar.

Anyway, on topic: Once the vehicle is streamed in the vehicle params are reset.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)