How to delete value from the array?

Timokha

New member
Messages
48
Points
0
Emulator
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.";
    }

 
try like this:

Code:
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;
 
Back
Top