GetLocalPlayerIndex()
GetLocalPlayerIndex():
number
Description
The GetLocalPlayerIndex
function returns the local player index. If the local player does not exist, the function returns -1
.
Returned
number
- index local player.-1
- if local player is not exists.
Example
ts
let exampleScript: ScriptDescription = {};
exampleScript.OnScriptLoad = () => {
let myPlayerIndex = EntitySystem.GetLocalPlayerIndex();
console.log("My player index - ", myPlayerIndex);
}
RegisterScript(exampleScript, "Example script");
TIP
You can get a Player object thanks to GetByIndex