Raised This Month: $ Target: $400
 0% 

Array Help ?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Drak
Veteran Member
Join Date: Jul 2005
Old 05-28-2009 , 00:49   Array Help ?
Reply With Quote #1

Sorry if I explain this bad.

I have this array
Code:
 new g_UserCustomMessage[33][MAX_CMSGS][128]

And I use it like so:
Code:
RemoveMessage(id,const Message[]) {     for(new Count;Count < MAX_CMSGS;Count++)         if(containi(g_UserCustomMessage[id][Count],Message) != -1)             copy(g_UserCustomMessage[id][Count],127,""); } AddMessage(id,const Message[]) {     formatex(g_UserCustomMessage[id][MAX_CMSGS - 1],"%s",Message);         RefreshMessages(id); } RefreshMessages(id)     for(new Count;Count < MAX_CMSGS;Count++)         copy(g_UserCustomMessage[id][Count],127,Count == MAX_CMSGS - 1 ? "" : g_UserCustomMessage[id][Count + 1]);

All that works just fine. And I have a task to remove messages in the array every so often. (RefreshMessages) But I want a better way to remove a message. This is my problem:

Code:
public func() {     AddMessage(id,"Hello World 1");     AddMessage(id,"Hello World 2");     AddMessage(id,"Hello World 3");         RemoveMessage(id,"Hello World"); }

Obviously, since i use "contain" it would remove all those messages. Is there any way i can maybe make "AddMessage" return something, to remove my exactly message I added? I can return the position where the string is, but "RefreshMessages" bumps it around. Any ideas?

This is what I was hoping for:
Code:
public Function() {     new Msg = AddMessage(id,"Some Message");     RemoveMessage(id,Msg); }
__________________
Oh yeah

Last edited by Drak; 05-28-2009 at 01:38.
Drak is offline
Send a message via MSN to Drak
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:32.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode