Best way to store variables relating to players?
I'm used to OOP languages where I can do stuff like:
Code:
player.MyVar = blah The next best thing I could think of is to store the info in arrays, but that would require over a dozen arrays per person and it would be a PITA to manage them as players constantly connect and disconnect. (on that note, are there multidimensional arrays in sourcepawn, e.g. array[foo][bar]? ) Is there a better way of handling this? Cheers. |
Re: Best way to store variables relating to players?
An easy way to store stuff and access named variables for each player would be enums, before I show you how I'll tell you that multidimensional arrays are possible in SourcePawn.
Example. PHP Code:
PHP Code:
enums are really just enumerated names that start with 0, so SomeNumber is really just index 1. |
Re: Best way to store variables relating to players?
I'm surprised sourcepawn has enums. They should work great.
Thanks for the help :) |
All times are GMT -4. The time now is 12:55. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.