Separate names with a comma.
Comments in 'Plugin Development' started by Adaasi, Sep 8, 2014.
Can I store a variable to a specified player?
You should make an array and store the variable to the array with the key as the player's name or entity ID.
Remember, it has to be an array field.
emm... create an array, add a key by player name...
$array = ;
$array[$player->getName()] = "Example";
echo $array[$player->getName()]; //Example
The $array should be declared outside.
Array "$array" can be added in anywhere of function.
So it can be called in other functions.?
Noup, but in one "function" it can be function. (c)
? After the class deceleration.
Then you can use it anywhere in the plugin with: $this->var
I write, anywhere in one function...
If u need use var in anywhere of plugin, u can create a var by OOP.
Yes, but he wants to store the variable, and normally he only has one player in his function so saving a local variable is pointless.