SA-MP Forums Archive
How to do this? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to do this? (/showthread.php?tid=142484)



How to do this? - RSC_Quicker - 18.04.2010

Hehy I got this
new pStats[MAX_PLAYERS][Player] (Player is the enum)
How I can set all those things to 0 for a player when he connect?
Something like:
for(new i=0; i<sizeof(pStats); i++) { pStats[playerid][i] = 0; }
but that doesn't work.


Re: How to do this? - aircombat - 18.04.2010

Код:
OnPlayerConnect(playerid)
{
pStats[playerid][Level] = 0; // Level is just an example
return 1;
}



Re: How to do this? - RSC_Quicker - 18.04.2010

Quote:
Originally Posted by Etch ❽ H
Код:
OnPlayerConnect(playerid)
{
pStats[playerid][Level] = 0; // Level is just an example
return 1;
}
Nah I want to set all of them to 0 in once. Not with 50 lines.


Re: How to do this? - Cank - 18.04.2010

Quote:

for(new i=0; i<sizeof(pStats); i++) { pStats[playerid] = 0; }

simply use "i" instead of "playerid"


Re: How to do this? - Sergei - 18.04.2010

Quote:
Originally Posted by MyName?
Quote:
Originally Posted by Etch ❽ H
Код:
OnPlayerConnect(playerid)
{
pStats[playerid][Level] = 0; // Level is just an example
return 1;
}
Nah I want to set all of them to 0 in once. Not with 50 lines.
You will need 50 lines then or use PVars which are reset automatically.

Quote:
Originally Posted by Cank
Quote:

for(new i=0; i<sizeof(pStats); i++) { pStats[playerid] = 0; }

simply use "i" instead of "playerid"
Fail


Re: How to do this? - RSC_Quicker - 19.04.2010

Quote:
Originally Posted by $ЂЯĢ
Quote:
Originally Posted by MyName?
Quote:
Originally Posted by Etch ❽ H
Код:
OnPlayerConnect(playerid)
{
pStats[playerid][Level] = 0; // Level is just an example
return 1;
}
Nah I want to set all of them to 0 in once. Not with 50 lines.
You will need 50 lines then or use PVars which are reset automatically.

Quote:
Originally Posted by Cank
Quote:

for(new i=0; i<sizeof(pStats); i++) { pStats[playerid] = 0; }

simply use "i" instead of "playerid"
Fail
yea thats fail.
Never mind I already use the 50 lines. Who cares