stop player from driving vehicle -
park4bmx - 16.04.2011
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);
}
}
Re: stop player from driving vehicle -
austin070 - 16.04.2011
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(..)
Re: stop player from driving vehicle -
park4bmx - 16.04.2011
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
Re: stop player from driving vehicle -
austin070 - 16.04.2011
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!");
}
Re: stop player from driving vehicle -
park4bmx - 16.04.2011
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
Re: stop player from driving vehicle -
austin070 - 16.04.2011
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
at the end of OnPlayerEnterVehicle(..)?
Re: stop player from driving vehicle -
xir - 16.04.2011
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;
}
Re: stop player from driving vehicle -
aircombat - 16.04.2011
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
Re: stop player from driving vehicle -
park4bmx - 16.04.2011
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 ?
Re: stop player from driving vehicle -
xir - 16.04.2011
Try the code I posted above aircombat