Jump to content
  • 0
Timokha

How to delete value from the array?

Question

Hello,

 

I am adding account ID to the variable by the following scripts:

set $MY_VARIABLE[0], getcharid(3);

set $MY_VARIABLE[getarraysize($MY_VARIABLE)], getcharid(3);

 

I have a list of values in this variable like:

2000000

2000001

2000002

etc

 

It indicates, that these accounts are participating in the game.

If the player fails, I need to delete it from this array, but cannot find the right script.

Could you please advise, how can I exclude the player from this variable, if he dies on my map for example?

 

OnPCDieEvent:
    if (strcharinfo(3) == MY_EVENT_MAP)
    {
        ????
        dispbottom "Game over.";
    }

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

  • 0

try like this:

OnPCDieEvent:
    if(strcharinfo(3) == MY_EVENT_MAP)
    {
        for(set .@i,0; .@i<getarraysize($MY_VARIABLE); set .@i,.@i+1)
		{
			if(getcharid(3) == $MY_VARIABLE[.@i])
			{
				deletearray $MY_VARIABLE[.@i],1;
				dispbottom "Game over.";
				break;
			}
		}        
    }
end;

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.