SA-MP Forums Archive
How to lock a 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to lock a vehicle ? (/showthread.php?tid=179133)



How to lock a vehicle ? - Matej_ - 25.09.2010

I need a help making that if someone from TEAM_GREEN wants to enter vehicle id 423 he can't
because it will be locked, so how can i lock vehicle id 423.


Re: How to lock a vehicle ? - Mike_Peterson - 25.09.2010

SetVehicleParamsForPlayer()

https://sampwiki.blast.hk/wiki/Function:...aramsForPlayer


Re: How to lock a vehicle ? - Matej_ - 25.09.2010

Quote:
Originally Posted by Mike_Peterson
Посмотреть сообщение
I tried that long time ago and it doesn't help me at all I just get errors.


Re: How to lock a vehicle ? - MadeMan - 25.09.2010

Do you use SetPlayerTeam to set your teams?


Re: How to lock a vehicle ? - Matej_ - 25.09.2010

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
Do you use SetPlayerTeam to set your teams?
pawn Код:
public SetPlayerTeamFromClass(playerid,classid)
{
    if(classid == 0 || classid == 1 || classid == 2) {
        gTeam[playerid] = TEAM_GREEN;
    } else if(classid == 3 || classid == 4 || classid == 5) {
        gTeam[playerid] = TEAM_BLUE;
    }
}



Re: How to lock a vehicle ? - MadeMan - 25.09.2010

pawn Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
    if(vehicleid == 423 && gTeam[forplayerid] == TEAM_GREEN)
    {
        SetVehicleParamsForPlayer(vehicleid, forplayerid, 0, 1);
    }
    return 1;
}
If you mean 423 as vehicle model id, then

pawn Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
    if(GetVehicleModel(vehicleid) == 423 && gTeam[forplayerid] == TEAM_GREEN)
    {
        SetVehicleParamsForPlayer(vehicleid, forplayerid, 0, 1);
    }
    return 1;
}



Re: How to lock a vehicle ? - Matej_ - 25.09.2010

@ MadeMan

Thanks

Off topic: How can I detect if player is in checkpoint with vehicle id 423 ?


Re: How to lock a vehicle ? - MadeMan - 25.09.2010

https://sampwiki.blast.hk/wiki/OnPlayerEnterCheckpoint

https://sampwiki.blast.hk/wiki/IsPlayerInCheckpoint

https://sampwiki.blast.hk/wiki/GetPlayerVehicleID


Re: How to lock a vehicle ? - NoobScripter1 - 25.09.2010

pawn Код:
new car1 (createvehicle..blabla
IsPlayerInVehicle(playerid,(car1));
{
   //type something here
}
else
{ sendclientmessage(playerid, Green," message");
}
something like this should work


Re: How to lock a vehicle ? - Matej_ - 25.09.2010

Quote:
Originally Posted by NoobScripter1
Посмотреть сообщение
pawn Код:
new car1 (createvehicle..blabla
IsPlayerInVehicle(playerid,(car1));
{
   //type something here
}
else
{ sendclientmessage(playerid, Green," message");
}
something like this should work
Not helpfull but thanks, I fixed the problem by myself.