Certain vehicle
#1

Hello, I have a question. Is there a way to let a player get a message when he enters a certain vehicle.

Example: A checkpoint will be shown when a player enters any crossmotor. When he enters any other vehicle the message will not show up.

Is this possible? Since IsPlayerInVehicle doesn't seem to support it.
Reply
#2

GetVehicleModel/GetPlayerVehicleID/OnPlayerStateChange.
Reply
#3

Thank you, MP2.
Reply
#4

What MP2 said is true - But you'll need to make a variable for that "certain car" unless you want it to work for all the vehicles with the same model.
Reply
#5

Here is an example for you..

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	new vehicle = GetPlayerVehicleID(playerid);
    if(newstate == PLAYER_STATE_DRIVER)
	{
	    if(GetVehicleModel(vehicle) == modelnumberhere)
	    {
	        SendClientMessage(playerid, COLOR_WHITE "Your message here");
			return 1;
	    }
EDIT:

Please note: Like the guy said above.. This will make it so anyone who enters ANY VEHICLE with ONLY THIS MODEL NUMBER will get the message. For example if you set the model number to 900 and the vehicle was a jeep.. Everyone who enters any jeep will get the message.

+Rep me if I helped you
Reply
#6

Yeah, that doesn't really matter since the vehicle is the only one in-game. Phil I can't since my minus rep.
Reply
#7

If you want a single vehicle (let's call them 'special vehicles'):

pawn Код:
new SpecVehID_catalinaBuffalo; // For example

public OnGameModeInit()
{
    SpecVehID_catalinaBuffalo = CreateVehicle(...);
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        new vehicleid = GetPlayerVehicleID(playerid);

        if(vehicleid == SpecVehID_catalinaBuffalo)
        {
            // They entered catalina's buffalo
        }
}
    return 1;
}
For multiple vehicles you should use an array.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)