OnPlayerEnterVehicle.
#1

Hello, I made a command that if the player enters the vehicle, a red marker shows up. But I want it to happen 1 time. So when I step out and step back in, I get the message again.

How can I make that it will be shown only once?

Here is my code:

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    SendClientMessage(playerid, COLOR_LAVENDER, "Your GPS has added a red marker on your mini map.");
    SendClientMessage(playerid, COLOR_LAVENDER, "Go to the red marker.");
    SetPlayerCheckpoint(playerid, 2583.0303,1041.4889,10.8203, 5.0);
    return 1;
}
- Hand.
Reply
#2

Create a new array
pawn Код:
new shown[MAX_PLAYERS];
When you enter the first time:
pawn Код:
shown[playerid] = 1;
Now everytime you enter check if it is 0 or one, so
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(shown[playerid] == 0)
{
    SendClientMessage(playerid, COLOR_LAVENDER, "Your GPS has added a red marker on your mini map.");
    SendClientMessage(playerid, COLOR_LAVENDER, "Go to the red marker.");
    SetPlayerCheckpoint(playerid, 2583.0303,1041.4889,10.8203, 5.0);
    return 1;
}
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)