OnPlayerEnterVehicle
#1

i currently have when i press f to enter a vehicle it shows a message
i want it to show the message ONLY when im in the car not before.
can anybody help me with that maybe some suggestions?

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid)
    {
    new string[128];
    if(IsBuyableCar[vehicleid]!=0)
        {
        GetVehicleName(vehicleid);

        if(strmatch(VehicleSystem[IsBuyableCar[vehicleid]][Owner],PlayerName(playerid)))
            {
            format(string,sizeof(string)," Vehicle ID: %d / Name: %s / Bought by: %s !",VehicleSystem[IsBuyableCar[vehicleid]][CarID],VehicleSystem[IsBuyableCar[vehicleid]][Name],VehicleSystem[IsBuyableCar[vehicleid]][Owner]);
            SendClientMessage(playerid,COLOR_GREY,string);
            }
Reply
#2

OnPlayerStateChange.
Reply
#3

you need the callback OnPlayerStateChange

and function GetPlayerState DRIVER or PASSENGER
that way it will set the message ONLY when your already sitting in the vehicle
Reply
#4

OnPlayerEnterVehicle is called when a player presses 'F'/'enter' near an valid vehicle.

OnPlayerStateChange should help with your case.

pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        new string[128];
        if(IsBuyableCar[GetPlayerVehicleID(playerid)]!=0)
        ....
Reply
#5

Quote:
Originally Posted by Conroy
Посмотреть сообщение
Quote:
Originally Posted by boelie
Посмотреть сообщение
you need the callback OnPlayerStateChange

and function GetPlayerState DRIVER or PASSENGER
that way it will set the message ONLY when your already sitting in the vehicle
Quote:
Originally Posted by [XST]O_x
Посмотреть сообщение
OnPlayerEnterVehicle is called when a player presses 'F'/'enter' near an valid vehicle.

OnPlayerStateChange should help with your case.

pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        new string[128];
        if(IsBuyableCar[vehicleid]!=0)
        ....
Thanks for quick respond working now.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)