23.07.2011, 09:36
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?
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 |
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 v = 1, vmax = AmountOfVehicles(); v < vmax; v++)
{
if((vmodel = GetVehicleModel(v)) == 472 || vmodel == 473 || vmodel == 493 || vmodel == 595 ||
vmodel == 484 || vmodel == 430 || vmodel == 453 || vmodel == 452 || vmodel == 446 || vmodel == 454)
{
GetPlayerPos(v, vCoords[X], vCoords[Y], vCoords[Z]);
if(IsPlayerInRangeOfPoint(playerid, 3.0, vCoords[X], vCoords[Y], vCoords[Z]))
{
return v;
}
}
}
#undef X, Y, Z
return -1;
}
AmountOfVehicles()
{
new VCount;
for(new i = 1; i < MAX_VEHICLES; i++) if(GetVehicleModel(i) != 0) VCount++;
return VCount;
}