SetMarkerType

From GT-MP
Jump to: navigation, search
SetMarkerType
Shared Function
Utilities-terminal.png Server-Side System-users.png Client-Side
Csharp.png C# Javascript.png JavaScript

You can change the type of the marker with this function.

Syntax

API.setMarkerType(NetHandle marker, int type);

Required Arguments

  • marker: parameter input should be in NetHandle type.
  • type: parameter input should be in int type. See Marker.

Usage example(s)

// A simple command to change the type of the given marker (server-side, C#)
[Command("changemarkertype")]
public void changeMarkerType(Client player, int markerID, int newMarkerType)
{
	bool isMarkerFound = false;

    if(newMarkerType > 31 || newMarkerType < 0)
    {
		API.sendChatMessageToPlayer(player, "Error", "There is no such marker type.");
    }

    List<NetHandle> markerList = API.getAllMarkers();
    foreach(NetHandle currentMarker in markerList)
    {
        if(markerID == API.getEntityData(currentMarker, "markerID"))
        {
            // we found the wanted marker
            API.setMarkerType(currentMarker, newMarkerType);
            isMarkerFound = true;
            break;
        }
    }

    if(isMarkerFound == false)
    {
        // so we did not find the marker
        API.sendChatMessageToPlayer(player, "Error", "There is no marker with the given ID.");
    }
}

References