IsPlayerInBoat? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: IsPlayerInBoat? (
/showthread.php?tid=271170)
IsPlayerInBoat? -
Gh0sT_ - 23.07.2011
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?
Re: IsPlayerInBoat? -
MoroDan - 23.07.2011
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
Re: IsPlayerInBoat? -
Gh0sT_ - 23.07.2011
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.
Re: IsPlayerInBoat? -
[HiC]TheKiller - 23.07.2011
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.
Re: IsPlayerInBoat? -
MoroDan - 23.07.2011
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 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;
}
Re: IsPlayerInBoat? -
Gh0sT_ - 23.07.2011
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?
Re: IsPlayerInBoat? -
MoroDan - 23.07.2011
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 ^^:
Re: IsPlayerInBoat? -
Gh0sT_ - 23.07.2011
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
Re: IsPlayerInBoat? -
MoroDan - 23.07.2011
Oh sorry, I haven't seen the negation operator
!. Hmm, yes, that should work

.
Re: IsPlayerInBoat? -
Gh0sT_ - 23.07.2011
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?