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);
}
__________________