SA-MP Forums Archive
SetVehicleParamsForPlayer bug... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SetVehicleParamsForPlayer bug... (/showthread.php?tid=155339)



SetVehicleParamsForPlayer bug... - Ben147 - 18.06.2010

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..


Re: SetVehicleParamsForPlayer bug... - Kar - 18.06.2010

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


Re: SetVehicleParamsForPlayer bug... - Antonio [G-RP] - 18.06.2010

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 ))



Re: SetVehicleParamsForPlayer bug... - ihatetn931 - 18.06.2010

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;



Re: SetVehicleParamsForPlayer bug... - Antonio [G-RP] - 18.06.2010

Wow, I was basicly right, cool :P


Re: SetVehicleParamsForPlayer bug... - Ben147 - 18.06.2010

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!


Re: SetVehicleParamsForPlayer bug... - Mike Garber - 18.06.2010

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.


Re: SetVehicleParamsForPlayer bug... - Conroy - 18.06.2010

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


Re: SetVehicleParamsForPlayer bug... - Antonio [G-RP] - 18.06.2010

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


Re: SetVehicleParamsForPlayer bug... - Conroy - 18.06.2010

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.