check boat
#1

I'm working on a command where players need to be on any boat in order to activate it.
How would I go about on checking if they are on any boat?
Thanks in advance.
Reply
#2

You want to check if they are driving a boat or just simply in a boat?
Reply
#3

Quote:
Originally Posted by Eoussama
Посмотреть сообщение
You want to check if they are driving a boat or just simply in a boat?
If they are driving a boat.
Reply
#4

Didn't test it, but here you go.

PHP код:

#define MAX_BOATS 10

new Boats[MAX_BOATS] = {472,473,595,493,430,453,484,446,452,454};

stock IsPlayerInBoat(playerid)
{
    new 
vehicleid GetPlayerVehicleID(playerid);
    if(!
IsPlayerInAnyVehicle(playerid)) return 0;
    
    for(new 
0MAX_BOATSi++)
    {
        if(
GetVehicleModel(vehicleid) == Boats[i])
           return 
true;
    }

    return 
false;

Reply
#5

Quote:
Originally Posted by Eoussama
Посмотреть сообщение
Didn't test it, but here you go.

PHP код:

#define MAX_BOATS 10
new Boats[MAX_BOATS] = {472,473,595,493,430,453,484,446,452,454};
stock IsPlayerInBoat(playerid)
{
    new 
vehicleid GetPlayerVehicleID(playerid);
    if(!
IsPlayerInAnyVehicle(playerid)) return 0;
    
    for(new 
0MAX_BOATSi++)
    {
        if(
GetVehicleModel(vehicleid) == Boats[i])
           return 
true;
    }
    return 
false;

oh whow, thank you! +rep'd
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)