05.01.2011, 19:00
Quote:
Yeah and don't forget to SET their score using "SetPlayerScore", otherwise it would be a useless variable.
|
Quote:
Under RegisterPlayer() change this:
pawn Код:
pawn Код:
|
pawn Код:
AccountInfo[playerid][aScore] = GetPlayerScore(playerid);
pawn Код:
AccountInfo[playerid][aScore] = 0;
pawn Код:
SetPlayerScore(playerid, 0);
So here is the result:
pawn Код:
public RegisterPlayer(playerid, password[])
{
if(IsPlayerConnected(playerid))
{
new name[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, name, sizeof name);
format(str, sizeof str, "%s.ini", name);
new File:account = fopen(str, io_write);
if (account)
{
SetPlayerScore(playerid, 0)
strmid(AccountInfo[playerid][aPassword], password, 0, strlen(password), 128);
AccountInfo[playerid][aCash] = GetPlayerMoney(playerid);
AccountInfo[playerid][aScore] = 0;
GetPlayerPos(playerid, AccountInfo[playerid][aX], AccountInfo[playerid][aY], AccountInfo[playerid][aZ]);
GetPlayerFacingAngle(playerid, AccountInfo[playerid][aA]);
new file[128];
{
format(file, sizeof file, "Password: %s\n", AccountInfo[playerid][aPassword]);
{ fwrite(account, file); }
format(file, sizeof file, "Cash: %d\n",AccountInfo[playerid][aCash]);
{ fwrite(account, file); }
format(file, sizeof file, "Score: %d\n", AccountInfo[playerid][aScore]);
{ fwrite(account, file); }
format(file, sizeof file, "X: %f\n",AccountInfo[playerid][aX]);
{ fwrite(account, file); }
format(file, sizeof file, "Y: %f\n",AccountInfo[playerid][aY]);
{ fwrite(account, file); }
format(file, sizeof file, "Z: %f\n",AccountInfo[playerid][aZ]);
{ fwrite(account, file); }
format(file, sizeof file, "Angle: %f\n",AccountInfo[playerid][aA]);
{ fwrite(account, file); }
}
fclose(account);
SendClientMessage(playerid, 0x21DD00FF, "You have successfully registered an account. You may now /login.");
}
}
return 1;
}