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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×
×
  • Create New...

Important Information

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