IsPlayerInBoat?
#1

Is that possible to such function "IsPlayerInBoat"? No, not as driver but just check is player standing somewhere in any boat. Also, what about IsPlayerInWater?
Reply
#2

Quote:
Originally Posted by Gh0sT_
Посмотреть сообщение
Is that possible to such function "IsPlayerInBoat"? No, not as driver but just check is player standing somewhere in any boat. Also, what about IsPlayerInWater?
IsPlayerInWater - http://forum.sa-mp.com/showthread.ph...sPlayerSwiming
IsPlayerInWater & IsPlayerInAnyBoat - http://forum.sa-mp.com/showthread.ph...sPlayerInWater
Reply
#3

Quote:
Originally Posted by MoroDan
Посмотреть сообщение
Thanks for IPIW, but IPIAB - no, this will check only if player is in boat as driver, I need to check is player standing somewhere in boat, not is player driver.
Reply
#4

I'm not sure if this will work but try using GetPlayerSurfingVehicleID with GetVehicleModel. Might not work with boats but it's worth a try :P.
Reply
#5

And I tryed something too:
PHP код:
IsPlayerOnAnyBoat(playerid)
{
    
/*
        @ Returns:
                    -1 -> if player is not on a boat
                    the boat id -> if player is on that boat
    */
    #define X (0)
    #define Y (1)
    #define Z (2)
    
new Float:vCoords[3], vmodel;
    for(new 
1vmax AmountOfVehicles(); vmaxv++)
    {
        if((
vmodel GetVehicleModel(v)) == 472 || vmodel == 473 || vmodel == 493 || vmodel == 595 ||
        
vmodel == 484 || vmodel == 430 || vmodel == 453 || vmodel == 452 || vmodel == 446 || vmodel == 454)
        {
            
GetPlayerPos(vvCoords[X], vCoords[Y], vCoords[Z]);
            if(
IsPlayerInRangeOfPoint(playerid3.0vCoords[X], vCoords[Y], vCoords[Z]))
            {
                return 
v;
            }
        }
    }
    
#undef X, Y, Z
    
return -1;
}
AmountOfVehicles()
{
    new 
VCount;
    for(new 
1MAX_VEHICLESi++) if(GetVehicleModel(i) != 0VCount++;
    return 
VCount;

Reply
#6

I will test it soon, thanks. Anyways, I have an idea: what about using GetClosestVehicle and IsPlayerInWater?

I mean

if(GetVehicleModel(GetClosestVehicle(playerid)) == modelid && !IsPlayerInWater(playerid))

this should work I think?
Reply
#7

That will check if the player is in water and it's NEAR the boat ; because he can't be ON a boat and in the same time, in the water . Maybe if the boat is broken ^^:

Reply
#8

Broken boat in samp, wtf?XD And for my idea:

No, this will check is closest vehicle model == x, and will check is player is not in water
Reply
#9

Oh sorry, I haven't seen the negation operator !. Hmm, yes, that should work .
Reply
#10

And one more question: Im making DMV system, with random questions (not same questions all the time) and I want to made something like "no questions repeat". As far as I know, I can use goto this time, but as I know goto isnt very good? If its really isnt very good, then how should I do this?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)