SetVehicle3DArrowEnabled

Started by MEGAMIND, Oct 04, 2024, 09:45 AM

Previous topic - Next topic

MEGAMIND

function onSetVehicle3DArrowEnabled(vehicleId, playerToShowId, enable)
{
if (( vehicle.ID == 198)||( vehicle.ID == 32))
{
Message("[#FFFFFF]hiiiiiiiiiiiiiii!");
}
}
is it right  or em a not aware of docs? wiki

MEGAMIND


habi2

If using sqlatestfeatures04rel32 plugin by [R3V]Kevin,
//Vehicle ID = 198, Player ID =2
SetVehicle3DArrowEnabled(198, 2, true);

To check if vehicle has arrow on top,
//Vehicle ID=32, Player ID=6
//Arrows are created as player-vehicle pair. different players can have arrows on different vehicles.
if( IsVehicle3DArrowEnabled(32, 6) )
MessagePlayer("Enter the vehicle with arrow", FindPlayer(6));

code i have not tested. Ref: 1 and topic?=9452.0

[R3V]Kelvin

Quote from: MEGAMIND on Oct 04, 2024, 09:45 AMis it right  or em a not aware of docs? wiki
Here is plugin's full documentation: https://github.com/sfwidde/vcmp-latest-features-for-squirrel
The plugin does not call any sort of custom events at all. However, what you want to do is achievable manually. Here's a quick example which worked for me pretty good:
// Grab internal function from sqlatestfeatures plugin.
local fn = SetVehicle3DArrowEnabled;
// Overwrite SetVehicle3DArrowEnabled function with our own.
function SetVehicle3DArrowEnabled(vehicleId, playerToShowId, enable)
{
// Call internal plugin function.
fn(vehicleId, playerToShowId, enable);
// Call our custom event.
onVehicle3DArrowSet(FindVehicle(vehicleId), FindPlayer(playerToShowId), enable);
}

/* CVehicle, CPlayer/null, bool */
function onVehicle3DArrowSet(vehicle, playerToShow, enable)
{
print("3D arrow " + (enable ? "enabled" : "disabled") + " " +
"for vehicle " + GetVehicleNameFromModel(vehicle.Model) + " (ID: " + vehicle.ID + "), " +
"which is shown to " + (playerToShow ? playerToShow.Name : "everyone") + ".");
}
which will call onVehicle3DArrowSet custom event every time you call SetVehicle3DArrowEnabled.

Also thanks @habi2 for providing a correct example on the usage of this function.

habi2

QuoteAlso thanks @habi2 for providing a correct example on the usage of this function
You are welcome

MEGAMIND

#5
k so ive tried that if i sit in a vehicle the arrow apears but what could be the way to make the arrow appear witout sitting?

example in world 2 if i join a world by a pickup or by command i see my vehicle with arrow