OnPlayerExitVehicle -
Ectazy - 03.08.2012
Hi all, how can I do that the player would not go out of the car?
Thanks for help.
Re: OnPlayerExitVehicle -
[MM]RoXoR[FS] - 03.08.2012
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
new seat = GetPlayerVehicleSeat(playerid);
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
SetPlayerPos(playerid,x,y,z);
PutPlayerInVehicle(playerid,vehicleid,seat);
return 1;
}
WARNING : If you use SendClientMessage, it shall be called 2 times.
Re: OnPlayerExitVehicle -
SEnergy - 03.08.2012
Quote:
Originally Posted by [MM]RoXoR[FS]
pawn Код:
GetPlayerPos(playerid,x,y,z); SetPlayerPos(playerid,x,y,z);
|
isn't this completelly useless? you ar eputting player into vehicle, it will automatically set his position..
Re: OnPlayerExitVehicle -
[MM]RoXoR[FS] - 03.08.2012
Quote:
Originally Posted by SEnergy
isn't this completelly useless? you ar eputting player into vehicle, it will automatically set his position..
|
Actually not.
If I dont use that code, it will fail to put player in vehicle(if he was a driver), reason being driver seat would be occupied by player.
This was needed to vacant the driver seat.
Re: OnPlayerExitVehicle -
SEnergy - 03.08.2012
Quote:
Originally Posted by [MM]RoXoR[FS]
Actually not.
If I dont use that code, it will fail to put player in vehicle(if he was a driver), reason being driver seat would be occupied by player.
This was needed to vacant the driver seat.
|
then use
pawn Код:
ClearAnimations(playerid);
it's working too and it uses less memory
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
ClearAnimations(playerid);
PutPlayerInVehicle(playerid, vehicleid, GetPlayerVehicleSeat(playerid));
return 1;
}
Re: OnPlayerExitVehicle -
JaKe Elite - 03.08.2012
This is the most such stupid thing i heard in SA-MP Before.
Why you don't want player to exit the vehicle? creating a minigames?
Re: OnPlayerExitVehicle -
SEnergy - 03.08.2012
Quote:
Originally Posted by ******
Source? Anyway, its there something inherently bad about the other method?
|
what source do you mean? the other metod uses more memory because it's storing 3 variables and calling 2 functions instead of just using 1 function for everything
Re: OnPlayerExitVehicle -
Devilxz97 - 03.08.2012
do u create this for minigame ?
Re: OnPlayerExitVehicle -
Devilxz97 - 03.08.2012
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(StayInTheCar[playerid] == 1)
{
SendClientMessage(playerid, -1,"You cant go out from Vehicle");
}
new vID = GetPlayerVehicleID(playerid);
new pSeat = GetPlayerVehicleSeat(playerid);
new Float:posX, Float:posY, Float:posZ;
GetPlayerPos(playerid,posX,posY,posZ);
SetPlayerPos(playerid,posX,posY,posZ);
StayInTheCar[playerid] = 1;
PutPlayerInVehicle(playerid,vID,pSeat);
return 1;
}
Re: OnPlayerExitVehicle -
SEnergy - 03.08.2012
Quote:
Originally Posted by Devilxz97
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid) { if(StayInTheCar[playerid] == 1) { SendClientMessage(playerid, -1,"You cant go out from Vehicle"); } new vID = GetPlayerVehicleID(playerid); new pSeat = GetPlayerVehicleSeat(playerid); new Float:posX, Float:posY, Float:posZ; GetPlayerPos(playerid,posX,posY,posZ); SetPlayerPos(playerid,posX,posY,posZ); StayInTheCar[playerid] = 1; PutPlayerInVehicle(playerid,vID,pSeat); return 1; }
|
you are like 30min late and your code has more useless functions and variables than roxor's, also it looks like you just copied his code and added useless variables such as "vID" so it will looks like yours