Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: MEGAMIND on Oct 04, 2024, 09:45 AM

Title: SetVehicle3DArrowEnabled
Post by: MEGAMIND on Oct 04, 2024, 09:45 AM
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
Title: Re: SetVehicle3DArrowEnabled
Post by: MEGAMIND on Oct 04, 2024, 06:11 PM
anyone?
Title: Re: SetVehicle3DArrowEnabled
Post by: habi2 on Oct 04, 2024, 06:53 PM
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 (https://github.com/sfwidde/vcmp-latest-features-for-squirrel) and topic?=9452.0 (https://forum.vc-mp.org/index.php?topic=9452.0)
Title: Re: SetVehicle3DArrowEnabled
Post by: [R3V]Kelvin on Oct 04, 2024, 09:59 PM
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.
Title: Re: SetVehicle3DArrowEnabled
Post by: habi2 on Oct 05, 2024, 07:53 AM
QuoteAlso thanks @habi2 for providing a correct example on the usage of this function
You are welcome
Title: Re: SetVehicle3DArrowEnabled
Post by: MEGAMIND on Oct 05, 2024, 09:33 AM
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