ADMIN ONLY VEH HELP
#3

hey, this should work, i tested it on my own game mode just now.

but please note, it needs to go under
pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
I'll explain why after..

pawn Код:
new plvehid = GetVehicleModel(GetPlayerVehicleID(playerid));

    if(oldstate == PLAYER_STATE_ONFOOT)
    {
    if(plvehid == 490)
        {
        if(Level[playerid] == 1 && IsLoggedIn[playerid] == 1)
        {
            SendClientMessage(playerid,COLOR_PINK,"*** [ADMIN VEHICLE] You Are In An Admin Only Vehicle.");
            }
        else
            {
            GameTextForPlayer(playerid,"~r~Ejected",3000,5);
        SendClientMessage(playerid,COLOR_SPRINGGREEN,"Only Admins Can Use This Vehicle.");
        RemovePlayerFromVehicle(playerid);
            }
        }
    }
Ok, the reason it wont work with OnPlayerEnterVehicle is because that function is called ONLY when the player presses to enter the vehicle.

So OnPlayerEnterVehicle is called as the player is actually getting into the vehicle, NOT while they're inside it.

So when they're getting into it, they aren't actually inside te vehicle, so they cant be ejected, even though the message might display.

OnPlayerStateChange is called when the player finishes getting into the vehicle, because their state has officially changed from on foot, to driver or passenger.


The only thing i found that i couldn't get working is the GameTextForPlayer, when they enter as a driver it doesnt show, but the other message does, and they're ejected. So that part works.

When the player enters as a passenger the EJECTED message works.

If you want to change it so that it can accept passengers, then just change
pawn Код:
if(oldstate == PLAYER_STATE_ONFOOT)
to

pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
Reply


Messages In This Thread
ADMIN ONLY VEH HELP - by StrickenKid - 15.03.2009, 19:18
Re: ADMIN ONLY VEH HELP - by javind0 - 15.03.2009, 19:30
Re: ADMIN ONLY VEH HELP - by Outbreak - 15.03.2009, 20:23

Forum Jump:


Users browsing this thread: 1 Guest(s)