SA-MP Forums Archive
PutPlayerInVehicle (Not working if seat = 0) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: PutPlayerInVehicle (Not working if seat = 0) (/showthread.php?tid=536064)



PutPlayerInVehicle (Not working if seat = 0) - Beckett - 07.09.2014

pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
    if(LastCar[playerid] == 1 || Seatbelt[playerid] == true)
    {
        new string[125];
        format(string,sizeof(string),"* %s tries to exit the vehicle but the seatbelt is on.",sendername(playerid));
        SetPlayerChatBubble(playerid,string,PURPLE,10,5000);
        MSG(playerid,COLOR_RED,"SERVER: Unbuckle your seatbelt to exit the vehicle.");
        PutPlayerInVehicle(playerid,LastCar[playerid],GetPlayerVehicleSeat(playerid));
        printf("Seat: %i Car: %i",GetPlayerVehicleSeat(playerid),LastCar[playerid]);

    }
        return 1;
}
Title says it all if the player is in the seat id 0 (AKA: Driver) he wont be set back in the vehicle. Other seats working fine.


Thanks.


Re: PutPlayerInVehicle (Not working if seat = 0) - BroZeus - 07.09.2014

try this -

Quote:

PutPlayerInVehicle(playerid,LastCar[playerid],GetPlayerVehicleSeat(playerid));

change the above to the following --
Quote:

PutPlayerInVehicle(playerid,vehicleid,GetPlayerVehicleSeat(playerid));




Re: PutPlayerInVehicle (Not working if seat = 0) - Beckett - 07.09.2014

That doesn't change anything because Lastcar = VEhicleid


Re: PutPlayerInVehicle (Not working if seat = 0) - BroZeus - 07.09.2014

does it send any message when player exits vehicle as driver?


Re: PutPlayerInVehicle (Not working if seat = 0) - Beckett - 07.09.2014

Yes it does.
And debug:
Seat: 0.
Car: 3.


Re: PutPlayerInVehicle (Not working if seat = 0) - AroseKhanNiazi - 07.09.2014

pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
    if(LastCar[playerid] == 1 || Seatbelt[playerid] == true)
    {
        new string[125];
        format(string,sizeof(string),"* %s tries to exit the vehicle but the seatbelt is on.",sendername(playerid));
        SetPlayerChatBubble(playerid,string,PURPLE,10,5000);
        MSG(playerid,COLOR_RED,"SERVER: Unbuckle your seatbelt to exit the vehicle.");
        PutPlayerInVehicle(playerid,LastCar[playerid],GetPlayerVehicleSeat(playerid));
        printf("Seat: %i Car: %i",GetPlayerVehicleSeat(playerid),LastCar[playerid]);
        return 0;
    }
        return 1;
}
try


Re: PutPlayerInVehicle (Not working if seat = 0) - BroZeus - 07.09.2014

Quote:
Originally Posted by AroseKhanNaizi
Посмотреть сообщение
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
    if(LastCar[playerid] == 1 || Seatbelt[playerid] == true)
    {
        new string[125];
        format(string,sizeof(string),"* %s tries to exit the vehicle but the seatbelt is on.",sendername(playerid));
        SetPlayerChatBubble(playerid,string,PURPLE,10,5000);
        MSG(playerid,COLOR_RED,"SERVER: Unbuckle your seatbelt to exit the vehicle.");
        PutPlayerInVehicle(playerid,LastCar[playerid],GetPlayerVehicleSeat(playerid));
        printf("Seat: %i Car: %i",GetPlayerVehicleSeat(playerid),LastCar[playerid]);
        return 0;
    }
        return 1;
}
try
Quote:

Return Values:
This callback does not handle returns.

https://sampwiki.blast.hk/wiki/OnPlayerExitVehicle


Re: PutPlayerInVehicle (Not working if seat = 0) - AroseKhanNiazi - 07.09.2014

oh ok so no other way then getting veh id and putting player again in it


Re: PutPlayerInVehicle (Not working if seat = 0) - Beckett - 07.09.2014

There is no problem in getting the car id or the seat id it works but the thing is if seat == 0 then he wont be set back in the seat should I try making a timer of 2 secs? then put him in or not?


Re: PutPlayerInVehicle (Not working if seat = 0) - AroseKhanNiazi - 07.09.2014

hmm well try add an stock for putting player in vehicle and add it because i think it will be enough time the player tried to get out and is again in it