Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
Couple Issues
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Mikee" data-source="post: 420465" data-attributes="member: 76567"><p>Jay is right, shoulda done it this way.</p><p>Make a class for NameColours that gets called when a user loads up the client. It calls RetrieveColours.</p><p>Then when setcolor is called, run a null check to make sure that RetrieveColours was actually called. So just check its size is greater 0.</p><p>If is is, then access the public list ColorsAvailable from NameColours to get that color.</p><p></p><p>UpdateColorsCommand would pretty much just run this RetrieveColours method again and store it. If you wanted to u could store it inside habbo.cs, but this should be enough to get u going. Don't have enough time to code it fully and proper and i did it on a texteditor, so excuse me for any linting errors.</p><p></p><p>[CODE]</p><p>public List<int> ColorsAvailable = new List<int>();</p><p>NumberOfRows = 0;</p><p></p><p></p><p>public static void RetreiveColours(){</p><p>using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()){</p><p>dbClient.SetQuery("SELECT COUNT(*) from colors");</p><p>NumberOfRows = dbClient.GetInteger();</p><p></p><p>for (x = 1; x <= NumberOfRows; x++){</p><p> dbClient.SetQuery("SELECT hex FROM colors WHERE id = '" + x);</p><p> Colours.Add(dbClient.GetInteger());</p><p>}</p><p>}</p><p>[/CODE]</p><p></p><p>edit: I realized u need the modify the code i have above, the list needs to be a hashmap instead. An array wouldn't work either. A hashmap would be needed to find the key and the value.</p></blockquote><p></p>
[QUOTE="Mikee, post: 420465, member: 76567"] Jay is right, shoulda done it this way. Make a class for NameColours that gets called when a user loads up the client. It calls RetrieveColours. Then when setcolor is called, run a null check to make sure that RetrieveColours was actually called. So just check its size is greater 0. If is is, then access the public list ColorsAvailable from NameColours to get that color. UpdateColorsCommand would pretty much just run this RetrieveColours method again and store it. If you wanted to u could store it inside habbo.cs, but this should be enough to get u going. Don't have enough time to code it fully and proper and i did it on a texteditor, so excuse me for any linting errors. [CODE] public List<int> ColorsAvailable = new List<int>(); NumberOfRows = 0; public static void RetreiveColours(){ using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()){ dbClient.SetQuery("SELECT COUNT(*) from colors"); NumberOfRows = dbClient.GetInteger(); for (x = 1; x <= NumberOfRows; x++){ dbClient.SetQuery("SELECT hex FROM colors WHERE id = '" + x); Colours.Add(dbClient.GetInteger()); } } [/CODE] edit: I realized u need the modify the code i have above, the list needs to be a hashmap instead. An array wouldn't work either. A hashmap would be needed to find the key and the value. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
Couple Issues
Top