open.mp icon indicating copy to clipboard operation
open.mp copied to clipboard

Missed (but important) YSF natives

Open NexiusTailer opened this issue 1 year ago • 1 comments

Speaking about YSF functions, there are also still some of them which could be ported (implemented) in open.mp server by default without any problems or in-script issues with their using.

Vehicle functions:

  • HideVehicle, ShowVehicle, IsVehicleHidden

All they do is just toggle vehActive internal server flag (like vehWasted), pretty simple yet useful.


Removed building function:

  • IsBuildingRemovedForPlayer

Check if the building with a certain model and coords were already removed previously. Useful not to do a double-removing something in a script and thus increase the chances of a client crash when repeating such code many times. Moreover, GetPlayerBuildingsRemoved is already exist in omp server, so this will be an expectable addition.


Object functions:

  • HideObjectForPlayer, ShowObjectForPlayer, IsObjectHiddenForPlayer

The difference between this and destroying an object in that it won't free this object slot (ID) for other objects if they created after, and showing an object back will save its ID like it was before hiding. Considered relevant since similar natives for pickup (ShowPickupForPlayer, HidePickupForPlayer and IsPickupHiddenForPlayer) were already ported and exist now.

  • IsPlayerEditingObject, IsPlayerEditingAttachedObject

They were removed from older YSF versions just because of crashes (ha-ha), so now it can be re-implemented natively without any such problems...


Actor functions:

  • HideActorForPlayer, ShowActorForPlayer, IsActorHiddenForPlayer

The difference between this and destroying an actor in that it won't free this actor slot (ID) for other actors if they created after, and showing an actor back will save its ID like it was before hiding. Considered relevant since similar natives for pickup (ShowPickupForPlayer, HidePickupForPlayer and IsPickupHiddenForPlayer) were already ported and exist now.

  • SetActorSpawnInfo

Seems to be pretty useful as well as to be in-line with SetSpawnInfo and SetVehicleSpawnInfo analogues (for player and for vehicles accordingly) which are already exist.


Menu functions:

  • GetTotalMenus (or CountTotalMenus / GetMenuCount)
  • SetMenuItem, SetMenuPos, SetMenuWidth, SetMenuTitle

Good addition for the same getters from the original YSF which were already included in omp server.


RakNet function:

  • GetLocalIP

Allow to get the local IP address. In fact, it's able to get all IP address(es) of each network interface since RakNet knows this information and it could be accessed from a script. Useful to get internal and external server IP without bind cfg option or http request.


Player function:

  • GetPlayerAimZ

This could be implemented just as an alternative (alias) to the currently implemented GetPlayerZAim. May be done mostly for better compatibility.


NetStats function:

  • GetPlayerConnectMode

This could be implemented just as an alternative (alias) to NetStats_ConnectionStatus. Seems like YSF have the same function but has a different native name for it. May be done mostly for better compatibility.


UPD: Related to #189 but seems it's kinda stale for a long time..

NexiusTailer avatar Feb 23 '23 02:02 NexiusTailer