OnPlayerExitVehicle
#1

Hi all, how can I do that the player would not go out of the car?

Thanks for help.
Reply
#2

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.
Reply
#3

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..
Reply
#4

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.
Reply
#5

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

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

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

do u create this for minigame ?
Reply
#9

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)