SA-MP Forums Archive
locking vehicle - 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)
+--- Thread: locking vehicle (/showthread.php?tid=388744)



locking vehicle - Mustafa6155 - 30.10.2012

How lock an vehcile
like
Код:
Getplayerscore 300
can enter this vehicle
no commands lik /lock or /unlock
just locking it please help and where to put it??


Re: locking vehicle - czel - 30.10.2012

Use public OnPlayerEnterVehicle

Check what the vehicle ID is and then if the player score isn't high enough, kick them out of the vehicle or don't let them enter it at all.


Re: locking vehicle - [HK]Ryder[AN] - 30.10.2012

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new score = GetPlayerScore(playerid);
    if(score < 300)
    {
         SetVehicleParamsForPlayer(vehicle,playerid,0,1);
    }
    else
    {
         //Do Nothin
    }
    return 1;
}
Try this.
Untested


Re: locking vehicle - Mustafa6155 - 30.10.2012

i think it didnt work??
Quote:

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new score = GetPlayerScore(playerid);
if(score < 250)
{
SetVehicleParamsForPlayer(432,playerid,0,1);
}
else
{
SendClientMessage(-1, COLOR_RED,"You Need 300 Score for Enter The Rhino!");
}
if(score < 980)
{
SetVehicleParamsForPlayer(520,playerid,0,1);
}
else
{
SendClientMessage(-1, COLOR_RED,"You Need 980 Score for Enter The Hydra!");
}
if(score < 7500)
{
SetVehicleParamsForPlayer(425,playerid,0,1);
}
else
{
SendClientMessage(-1, COLOR_RED,"You Need 750 Score for Enter The Hunter!");
}
if(score < 120)
{
SetVehicleParamsForPlayer(447,playerid,0,1);
}
else
{
SendClientMessage(-1, COLOR_RED,"You Need 120 Score for Enter The SeaSparrow!");
}
return 1;
}

this is what i use from you but only one thing no errors i can also enter the vehicle


Re: locking vehicle - Eric - 30.10.2012

That won't work. You're locking it after they've entered the vehicle. Put it under OnVehicleStreamIn.
Try this.

pawn Код:
public OnVehicleStreamIn(vehicleid, forplayerid) {
    new score = GetPlayerScore(forplayerid);
    if(score < 250) {
        SetVehicleParamsForPlayer(432, forplayerid, 0, 1);
    }
    if(score < 980) {
        SetVehicleParamsForPlayer(520, forplayerid, 0, 1);
    }
    if(score < 7500) {
        SetVehicleParamsForPlayer(425, forplayerid, 0, 1);
    }
    if(score < 120) {
        SetVehicleParamsForPlayer(447, forplayerid, 0, 1);
    }
}