SA-MP Forums Archive
Reset array data - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Reset array data (/showthread.php?tid=368789)



Reset array data - Killer#Mummy - 14.08.2012

Hi!

My array is defined with:
pawn Код:
enum PlayerData
{
pString[64],
bool: pLogged,
pTime,
.
.
.
}
new Player[MAX_PLAYERS][PlayerData];
When player disconnect, I want to reset the Player[playerid] array to default values.

The following code does NOT work.
pawn Код:
for(new i;i < sizeof(PlayerData);i++)
{
Player[playerid][i] = 0;
}
How can I do this?


Re : Reset array data - BigBaws - 14.08.2012

Код:
for(new i;i < sizeof(PlayerData);i++)
{
Player[playerid][i] = --;
}
Try this



Re: Reset array data - Youarex - 14.08.2012

We can try this code:

pawn Код:
for(new j = 0; j < sizeof(Player); j++)
{
    Player[playerid][PlayerData:j] = 0;
}