problem with getting vehicleid
#1

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
Reply
#2

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

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);
    }
Reply
#4

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)