Page 1 of 1
attribute in a CTmPlayer class
Posted: 26 Jul 2015, 00:42
by TheBigMiike
I want your help again because I want to create an attribute in a
CTmPlayer class in order to store the amount of times a player pressed the 'Restart' button but I read somewhere in the ManiaPlanet documentation (I'm not sure) that it was not possible.
So my decision was to create an array with the Player object as index and the count as value but I think there is a better solution for that so i'm wondering the following question :
My Question :
Is there an easier way to attach this data (The amount of restart times) to a player ?
Do you use this kind of array for these datas ? Else, which solution you use ?
Re: attribute in a CTmPlayer class
Posted: 26 Jul 2015, 09:30
by Dommy
http://maniascript.team-devota.com/stru ... esult.html
Player.CurRace / Player.CurLap
Score.BestRace / Score.PrevRace / Score.BestLap
Re: attribute in a CTmPlayer class
Posted: 26 Jul 2015, 10:37
by TGYoshi
You can basically dynamically extend existing structures like CTmPlayer using
Code: Select all
declare Type blabla for playerinstance = default;
Then the "blabla" variable in that scope will belong to the playerinstance.
These values do not cross the server-client boundary, though.
You can add some "as alias" construct too to locally "rename" it, in case you have potentially conflicting variable names (e.g. when having two players in the same scope).
Re: attribute in a CTmPlayer class
Posted: 26 Jul 2015, 15:08
by Dommy
@Tiggs
For netwrite/netread it's good to send data arrays via Teams[0] with logins as keys. Then instead sharing custom data for player only (UI), you can also display custom data of spectated player.
Example:
Code: Select all
Net_PlayerHighestJump[Player.User.Login] = Player.Position.Y;