SA-MP Forums

Go Back   SA-MP Forums > SA-MP > Bug Reports

Reply
 
Thread Tools Display Modes
Old 12/07/2012, 12:25 PM   #1
leong124
High-roller
 
leong124's Avatar
 
Join Date: Jun 2008
Location: Hong Kong, China
Posts: 1,549
Reputation: 134
Default Hanging on a boat cannot be detected with GetPlayerSurfingVehicleID

I got a problem that when you hanging on a boat, or climbing on it, GetPlayerSurfingVehicleID still returns INVALID_VEHICLE_ID.
Checking the player's animation and the distance between the boat and him won't work, because the player can install a mod to make the ship to be large. He can then climb on the boat on a further distance, which can escape from the distance check.
__________________
[KDT_MS]hk_shade

Sorry for my bad English and my weakness in expressing myself.
leong124 is offline   Reply With Quote
Old 12/07/2012, 01:26 PM   #2
MP2
Godfather
 
MP2's Avatar
 
Join Date: Jan 2011
Location: England
Posts: 6,422
Reputation: 968
Default Re: Hanging on a boat cannot be detected with GetPlayerSurfingVehicleID

Forbid mods then.
MP2 is offline   Reply With Quote
Old 12/07/2012, 04:44 PM   #3
YoungKris
Big Clucker
 
Join Date: Dec 2010
Location: London
Posts: 77
Reputation: 35
Default Re: Hanging on a boat cannot be detected with GetPlayerSurfingVehicleID

^^ ..
YoungKris is offline   Reply With Quote
Old 22/09/2017, 08:51 AM   #4
diclofoss
Little Clucker
 
Join Date: Apr 2013
Posts: 34
Reputation: 14
Default Re: Hanging on a boat cannot be detected with GetPlayerSurfingVehicleID

Hello! I have the same problem. Does any update for this issue?
diclofoss is offline   Reply With Quote
Old 24/09/2017, 07:04 AM   #5
NaS
High-roller
 
NaS's Avatar
 
Join Date: Mar 2008
Posts: 1,262
Reputation: 373
Default Re: Hanging on a boat cannot be detected with GetPlayerSurfingVehicleID

Wouldn't say this is a bug, because you cannot surf on unoccupied vehicles. Only on vehicles with a player (or NPC) in it.

You could of course argue that it should be added, but I really don't see a point in it. Especially because most unoccupied vehicles aren't really synced anyway.
NaS is offline   Reply With Quote
Old 24/09/2017, 08:33 AM   #6
Kar
High-roller
 
Kar's Avatar
 
Join Date: May 2010
Location: Black Asylum
Posts: 3,174
Reputation: 488
Default Re: Hanging on a boat cannot be detected with GetPlayerSurfingVehicleID

I use this code.

Code:
playerGetSurfingBoatFromLastVeh(playerid, Float:playerZ)
{
	if(isPlayerSwimming(playerid) || IsPlayerInAnyVehicle(playerid)) return INVALID_VEHICLE_ID;
	new vehicleID = INVALID_VEHICLE_ID;
	if(playerData[playerid][pCurrentVehicleID] != INVALID_VEHICLE_ID && GetPlayerDistanceFromVehicle(playerid, playerData[playerid][pCurrentVehicleID]) <= 10.0) {
		vehicleID = playerData[playerid][pCurrentVehicleID];
	}
	if(vehicleID == INVALID_VEHICLE_ID) {
		vehicleID = getClosestVehicle(playerid);
		if(!IsValidVehicle(vehicleID) || GetPlayerDistanceFromVehicle(playerid, vehicleID) > 10.0) {
			vehicleID = INVALID_VEHICLE_ID;
		}
	}
	if(vehicleID != INVALID_VEHICLE_ID) {
		new vehicleType = GetVehicleType(GetVehicleModel(vehicleID));
		if(vehicleType == VEHICLE_BOAT || vehicleType == VEHICLE_VORTEX) {
			new Float:vX, Float:vY, Float:vZ;
			GetVehiclePos(vehicleID, vX, vY, vZ);
			if(playerZ > vZ && (playerZ - vZ) <= 4.0 && GetPlayerDistanceFromPoint(playerid, vX, vY, vZ) <= 10.0) { // surfing
				return vehicleID;
			}
		}
	}
	return INVALID_VEHICLE_ID;
}

isPlayerSurfingBoat(playerid)
{
	if(IsPlayerInAnyVehicle(playerid)) return 0;
	new surfingVehicle = GetPlayerSurfingVehicleIDEx(playerid), vehicleType;
	vehicleType = GetVehicleType(GetVehicleModel(surfingVehicle));
	return surfingVehicle != INVALID_VEHICLE_ID && (vehicleType == VEHICLE_BOAT || vehicleType == VEHICLE_VORTEX);
}

GetPlayerSurfingVehicleIDEx(playerid)
{
	new surfingVehicle = GetPlayerSurfingVehicleID(playerid);
	if(surfingVehicle == INVALID_VEHICLE_ID) {
		new Float:z;
		GetPlayerPos(playerid, z, z, z);
		surfingVehicle = playerGetSurfingBoatFromLastVeh(playerid, z);
	}
	return surfingVehicle;
}
Kar is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Some fun stuff to do while hanging out with le gf. Mr.Hades Everything and Nothing 28 26/03/2012 12:07 AM
GetPlayerSurfingVehicleID() sabretur Help Archive 3 06/03/2011 11:28 AM
Bug confirmation - GetPlayerSurfingVehicleID with Trailers Mikep. Help Archive 5 16/10/2009 01:07 PM


All times are GMT. The time now is 08:40 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.