SA-MP Forums Archive
problem with getting vehicleid - 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: problem with getting vehicleid (/showthread.php?tid=411546)



problem with getting vehicleid - akki - 29.01.2013

hello
i am a newb and i dont know much of scripting
so please help me
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	new check,leave=0;
	check=GetPlayerVehicleID(playerid);
	if(bot_vehs[0] == check)
	    leave=1;
	if(leave)
         RemovePlayerFromVehicle(playerid);
i have used vehicles name as bot_vehs[200]
i have only used bot_vehs[0] till now and i don't want the player to be able to get into the vehicle but they should be allowed to get in passenger.
please help me



Re: problem with getting vehicleid - Youice - 29.01.2013

use : https://sampwiki.blast.hk/wiki/GetPlayerVehicleSeat : will help you : D and welcome to the forums!


Re: problem with getting vehicleid - DaRk_RaiN - 29.01.2013

pawn Код:
//First of all leave should be a player variable, not global
//Under the includes
new leave[MAX_PLAYERS];
pawn Код:
//For the check
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    check=GetPlayerVehicleID(playerid);
    if(GetVehicleModel(vehicleid) == bot_vehs[0])
    {
    leave[playerid] = 1;
    }
    if(leave[playerid] == 1)
    {
        leave[playerid] = 0;//Avoiding further bugs.
       RemovePlayerFromVehicle(playerid);
    }



Re: problem with getting vehicleid - akki - 29.01.2013

Quote:
Originally Posted by DaRk_RaiN
Посмотреть сообщение
pawn Код:
//First of all leave should be a player variable, not global
//Under the includes
new leave[MAX_PLAYERS];
pawn Код:
//For the check
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    check=GetPlayerVehicleID(playerid);
    if(GetVehicleModel(vehicleid) == bot_vehs[0])
    {
    leave[playerid] = 1;
    }
    if(leave[playerid] == 1)
    {
        leave[playerid] = 0;//Avoiding further bugs.
       RemovePlayerFromVehicle(playerid);
    }
thanks for your great help but the variable leave is just to get true or false
true = he must leave the vehicle
false = he can drive it
so why we need MAX_PLAYERS for that