Hey, I want to know how to set a variable to an object like if players buy an object is do that : PHP: $owner = $player; or is it an other thing like set title to object My Idea is When a player buy an object they set a variable to the object for a after sale service (yes i know is it not so useful) ; Any help is useful Hey! sorry for my english i'm FRENCH!
setting variables to object. first create an object and use it example: PHP: use Core\objects\Object; now to use it using variables: PHP: $object = new Object($args...); //you can set arguments in the object using __construct;//object's functions can be used if you have the object;//eg:$object->myFunction();// or new Object($args...)->myFunction(); // its better saving it as a variable so you dont have to call it every time & reset the data(most of the times).// you can make functions in objects just like creating a function in a plugin// eg:public function myFunction(){ echo("Hello World!"); // this will broadcast "Hello World" in your console (better sending a message to console using the $server->getLogger()->info();). return true; // return true is useful to say if the function was successful. thats if you wanna send an error/ message if it was unsuccessful}