get vehicleid before enter? -
happyface - 03.07.2009
im trying to make it so when player try to enter a car, if its a specific car it doesnt let him enter, but my problem is i dont know how to get the vehicleid of the car hes trying to enter. any idea?
somethink like
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_ENTER_VEHICLE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid); //but of course not known yet since not in it
if(vehicleid == testcar1)
{
SendClientMessage(playerid,COLOR_BRIGHTRED,"LOCKED..");
//....
}
}
return 1;
}
seems like it should be an easy solution but im stuck. just need help with getting the vehicle part, any help much appreciated thanks.
Re: get vehicleid before enter? -
ledzep - 03.07.2009
There is an entire callback dedicated to this purpose.
https://sampwiki.blast.hk/wiki/OnPlayerEnterVehicle
Re: get vehicleid before enter? -
yezizhu - 03.07.2009
new Float
x,Float
y,Float
z;
GetPlayerPos(playerid,px,py,pz);
SetPlayerPos(playerid,px,py,pz);
Re: get vehicleid before enter? -
happyface - 03.07.2009
Quote:
Originally Posted by ledzep
|
thx for fast reply, but my intention to keep him from even being able to enter the car if you know what i mean, so when he is at state 5, trying to enter, it keep him from enter, so i dont think i can use that callback fro this correct?
Re: get vehicleid before enter? -
yezizhu - 03.07.2009
new Float
x,Float
y,Float
z;
GetPlayerPos(playerid,px,py,pz);
SetPlayerPos(playerid,px,py,pz);
Re: get vehicleid before enter? -
happyface - 03.07.2009
Quote:
Originally Posted by yezizhu
new Float x,Float y,Float z;
GetPlayerPos(playerid,px,py,pz);
SetPlayerPos(playerid,px,py,pz);
|
this have nothing to do with the question?
Re: get vehicleid before enter? -
ledzep - 03.07.2009
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(vehicleid == ledzepCar){
SendClientMessage(playerid, COLOR_RED, "NOT TODAY MOTHERFUCKER!");
SetVehicleParamsForPlayer(vehicleid, playerid, 0, 1); // Lock the car, thereby pwning playerid
}
}
Or you could 'slap' them.
Re: get vehicleid before enter? -
yezizhu - 03.07.2009
Quote:
Originally Posted by happyface
Quote:
Originally Posted by yezizhu
new Float x,Float y,Float z;
GetPlayerPos(playerid,px,py,pz);
SetPlayerPos(playerid,px,py,pz);
|
this have nothing to do with the question?
|
NO, it will keep the player from entering the vehicle.
Re: get vehicleid before enter? -
happyface - 03.07.2009
Quote:
Originally Posted by ledzep
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { if(vehicleid == ledzepCar){ SendClientMessage(playerid, COLOR_RED, "NOT TODAY MOTHERFUCKER!"); SetVehicleParamsForPlayer(vehicleid, playerid, 0, 1); // Lock the car, thereby pwning playerid } }
Or you could 'slap' them.
|
hey thanks! SetVehicleParamsForPlayer works perfect for what i needed, had never used this before.
Re: get vehicleid before enter? -
yom - 03.07.2009
Quote:
Originally Posted by happyface
Quote:
Originally Posted by yezizhu
new Float x,Float y,Float z;
GetPlayerPos(playerid,px,py,pz);
SetPlayerPos(playerid,px,py,pz);
|
this have nothing to do with the question?
|
This will set the player pos to where he was just when he pressed enter, disabling the 'enter vehicle' animation.