Platform Builder Forums

Main => Suggestions => Topic started by: Antikore on February 22, 2020, 01:48:34 PM

Title: if player conditional
Post by: Antikore on February 22, 2020, 01:48:34 PM
Checks for the player that triggered the command prompt. If actually there is no player linked to the command prompt, it will return as false. You can detect -1 to check if it's null
Code: [Select]
if player = 1 //Checks if the player executor is 1
{
}
if player = 2 //Checks if the player executor is 2
{
}
if player = -1 //Checks when there is no player executor
{
}

This will work for example when detecting from a character which player is executing that thing. (If you have 2 players with the same character, and you want different code for each one.)
Also can be used to detect which player collected an item in the item's command prompt.
Title: Re: if player conditional
Post by: War on February 22, 2020, 03:32:00 PM
Checks for the player that triggered the command prompt. If actually there is no player linked to the command prompt, it will return as false. You can detect -1 to check if it's null
Code: [Select]
if player = 1 //Checks if the player executor is 1
{
}
if player = 2 //Checks if the player executor is 2
{
}
if player = -1 //Checks when there is no player executor
{
}

This will work for example when detecting from a character which player is executing that thing. (If you have 2 players with the same character, and you want different code for each one.)
Also can be used to detect which player collected an item in the item's command prompt.
🙌