stop player from driving vehicle
#1

ok so i want to stop player from driving vehicle

i got this
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new vehicle = vehicle = GetPlayerVehicleID(playerid);
if(vehicle == 433)
    {
        SendClientMessage(playerid,YELLOW,"You Are Not Qualified To Drive This Vehicle !!!");
        RemovePlayerFromVehicle(playerid);
    }
}
But the problem is that when playerid 0 enters the vehicle nothing happesn but when playerid 1+
enter's the vehicle it only shows "You Are Not Qualified To Drive This Vehicle !!!"
So what is the probblem ?

NOTE
i also tried like this
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(vehicleid== 433)
    {
        SendClientMessage(playerid,YELLOW,"You Are Not Qualified To Drive This Vehicle !!!");
        RemovePlayerFromVehicle(playerid);
    }
}
Reply
#2

pawn Код:
if(GetPlayerVehicleID(playerid) == 433)
    {
        SetVehicleParamsForPlayer(vehicle, playerid, false, true)
        SendClientMessage(playerid, YELLOW, "You are not qualified to drive this vehicle!");
    }
Try this, but fix the indentations that the samp forum loves messing up. Rather than letting the player enter the vehicle and then get removed from it, this will simply LOCK the vehicle and prevent the player from entering. Make sure this is under OnPlayerEnterVehicle(..)
Reply
#3

Quote:
Originally Posted by austin070
Посмотреть сообщение
pawn Код:
if(GetPlayerVehicleID(playerid) == 433)
    {
        SetVehicleParamsForPlayer(vehicle, playerid, false, true)
        SendClientMessage(playerid, YELLOW, "You are not qualified to drive this vehicle!");
    }
Try this, but fix the indentations that the samp forum loves messing up. Rather than letting the player enter the vehicle and then get removed from it, this will simply LOCK the vehicle and prevent the player from entering. Make sure this is under OnPlayerEnterVehicle(..)
thanks but it still doesnt work
player still Enters vehicle and the message doesnt even show
Reply
#4

Try this, I made some errors in my first attempt lol.
pawn Код:
if(vehicleid == 433)
    {
        SetVehicleParamsForPlayer(vehicleid, playerid, false, true);
        SendClientMessage(playerid, COLOR_YELLOW, "You are not qualified to drive this vehicle!");
    }
Reply
#5

Quote:
Originally Posted by austin070
Посмотреть сообщение
Try this, I made some errors in my first attempt lol.
pawn Код:
if(vehicleid == 433)
    {
        SetVehicleParamsForPlayer(vehicleid, playerid, false, true);
        SendClientMessage(playerid, COLOR_YELLOW, "You are not qualified to drive this vehicle!");
    }
no i tried that before and it didn't work i even sad it on the top thanks anyways
Reply
#6

Quote:
Originally Posted by park4bmx
Посмотреть сообщение
no i tried that before and it didn't work i even sad it on the top thanks anyways
If that doesn't work for you then something is wrong with your script. Do you have a
pawn Код:
return 1;
at the end of OnPlayerEnterVehicle(..)?
Reply
#7

Try this

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(GetVehicleModel(vehicleid) == 433)
    {
        SendClientMessage(playerid, YELLOW, "You Are Not Qualified To Drive This Vehicle !!!");
        RemovePlayerFromVehicle(playerid);
        return 1;
    }
    return 1;
}
Reply
#8

id is not model id is like :

new vehicle;

vehicle = AddStaticVehicle ......

then u can use if(vehicleid == vehicle)

but for what u want u could use Xir code
Reply
#9

Quote:
Originally Posted by aircombat
Посмотреть сообщение
id is not model id is like :

new vehicle;

vehicle = AddStaticVehicle ......

then u can use if(vehicleid == vehicle)

but for what u want u could use Xir code
whats Xir Code ?
Reply
#10

Try the code I posted above aircombat
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)