[HELP] PlayerIntoVehicle -_-
#1

i got this :

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(IsPlayerInAnyVehicle(vehicleid) == 598)
     {
    if(COP[playerid] == 1)
     {
     SendClientMessage(playerid, 0xFF9900AA, "SendClientMessage(playerid, 0xFF9900AA, "You Are Now In A Police Car.");
     }
     else
     {
     RemovePlayerFromVehicle(playerid);
     }
 }
When im a COP and i enter the car nothing happen.. i dont see the You Are Now In A Police Car. And when i'm not a COP and i enter the police car nothing happen... it doesn't remove me from the vehicle.. why?

Sorry for my bad English!
Reply
#2

Why dont u use
if(GetPlayerVehicleID(playerid) == 59
instead of
if(IsPlayerInAnyVehicle(vehicleid) == 59
I think this function doesnt works for what you want.
Reply
#3

You missed a return 1.

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(IsPlayerInAnyVehicle(vehicleid) == 598)
     {
    if(COP[playerid] == 1)
     {
     SendClientMessage(playerid, 0xFF9900AA, "You Are Now In A Police Car.");
     return 1;
     }
     else
     {
     RemovePlayerFromVehicle(playerid);
     }
 }
Fixed your sendclientmessage too.
Reply
#4

Everyone got the same problem with OnPlayerEnterVehicle. This callback is called when player is ENTERING TO THE VEHICLE. Use OnPlayerStateChange, it will remove the player from vehicle. If you use RemovePlayerFromVehicle on OnPlayerEnterVehicle, it just lets you drive the vehicle, it doesn't remove you. I Hope you understand me
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)