register problem -
dennis218 - 20.04.2009
}
public OnPlayerRegister(playerid, password[])
{
if(IsPlayerConnected(playerid))
{
new name[MAX_PLAYER_NAME], str[128], ip[15];
GetPlayerName(playerid, name, sizeof name);
GetPlayerIp(playerid, ip, sizeof ip);
format(str, sizeof str, "/SchockAccounts/%s.Schock", name);
new File:account = fopen(str, io_write);
if (account)
{
strmid(AccountInfo[playerid][Password], password, 0, strlen(password), 255);
AccountInfo[playerid][Cash] = GetPlayerMoney(playerid);
new file[128];
{
format(file, sizeof file, "Password: %s\n\r", AccountInfo[playerid][Password]);
{ fwrite(account, file); }
format(file, sizeof file, "AdminLevel: %d\n\r",AccountInfo[playerid][AdminLevel]);
{ fwrite(account, file); }
format(file, sizeof file, "Cash: %d\n\r", AccountInfo[playerid][Cash]);
{ fwrite(account, file); }
format(file, sizeof file, "Warnings: %d\n\r",AccountInfo[playerid][Warns]);
{ fwrite(account, file); }
format(file, sizeof file, "WarnReason1: %s\n\r",AccountInfo[playerid][WarnReason1]);
{ fwrite(account, file); }
format(file, sizeof file, "WarnReason2: %s\n\r",AccountInfo[playerid][WarnReason2]);
{ fwrite(account, file); }
format(file, sizeof file, "WarnReason3: %s\n\r",AccountInfo[playerid][WarnReason3]);
{ fwrite(account, file); }
format(file, sizeof file, "IPAddress: %s\n\r",ip);
{ fwrite(account, file); }
}
fclose(account);
SendClientMessage(playerid, GREEN, "|- Account successfully registered. You can now login ( /login [password] ) -|");
}
}
return 1;
}
public OnPlayerUpdateAccount(playerid)
{
if(IsPlayerConnected(playerid))
{
if(AccountInfo[playerid][Logged] == 1)
{
new name[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, name, sizeof name);
format(str, sizeof str, "/SchockAccounts/%s.Schock", name);
new File:account = fopen(str, io_write);
if (account)
{
AccountInfo[playerid][Cash] = GetPlayerMoney(playerid);
new file[128];
{
format(file, sizeof file, "Password: %s\n\r", AccountInfo[playerid][Password]);
{ fwrite(account, file); }
format(file, sizeof file, "AdminLevel: %d\n\r",AccountInfo[playerid][AdminLevel]);
{ fwrite(account, file); }
format(file, sizeof file, "Cash: %d\n\r", AccountInfo[playerid][Cash]);
{ fwrite(account, file); }
format(file, sizeof file, "Warnings: %d\n\r",AccountInfo[playerid][Warns]);
{ fwrite(account, file); }
format(file, sizeof file, "WarnReason1: %s\n\r",AccountInfo[playerid][WarnReason1]);
{ fwrite(account, file); }
format(file, sizeof file, "WarnReason2: %s\n\r",AccountInfo[playerid][WarnReason2]);
{ fwrite(account, file); }
format(file, sizeof file, "WarnReason3: %s\n\r",AccountInfo[playerid][WarnReason3]);
{ fwrite(account, file); }
format(file, sizeof file, "IPAddress: %s\n\r",AccountInfo[playerid][IP]);
{ fwrite(account, file); }
}
fclose(account);
}
}
}
return 1;
}
public OnPlayerLogin(playerid, password[])
{
new name[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, name, sizeof name);
format(str, sizeof str, "/SchockAccounts/%s.Schock", name);
new File:account = fopen(str, io_read);
if (account)
{
new pass[256];
new passres[128], value[128];
fread(account, pass, sizeof pass);
passres = GetFileString(pass);
if (!strcmp("Password", passres))
{
value = GetFileValue(pass);
strmid(AccountInfo[playerid][Password], value, 0, strlen(value)-1, 12

;
}
if (!strcmp(AccountInfo[playerid][Password], password, true))
{
while (fread(account, pass, 256))
{
passres = GetFileString(pass);
if (strfind(passres, "AdminLevel") != -1)
{
value = GetFileValue(pass);
AccountInfo[playerid][AdminLevel] = strval(value);
}
if (strfind(passres, "Cash") != -1)
{
value = GetFileValue(pass);
AccountInfo[playerid][Cash] = strval(value);
}
if (strfind(passres, "Warnings") != -1)
{
value = GetFileValue(pass);
AccountInfo[playerid][Warns] = strval(value);
}
if (strfind(passres, "WarnReason1") != -1)
{
value = GetFileValue(pass);
strmid(AccountInfo[playerid][WarnReason1], value, 0, strlen(value)-1, 12

;
}
if (strfind(passres, "WarnReason2") != -1)
{
value = GetFileValue(pass);
strmid(AccountInfo[playerid][WarnReason2], value, 0, strlen(value)-1, 12

;
}
if (strfind(passres, "WarnReason3") != -1)
{
value = GetFileValue(pass);
strmid(AccountInfo[playerid][WarnReason3], value, 0, strlen(value)-1, 12

;
}
}
fclose(account);
AccountInfo[playerid][Logged] = 1;
}
else
{
SendClientMessage(playerid, RED, "Incorrect Password.");
fclose(account);
return 1;
}
GivePlayerMoney(playerid, AccountInfo[playerid][Cash]);
format(str, sizeof str, "|- You have successfully logged in as %s -|", name);
SendClientMessage(playerid, GREEN, str);
printf("%s has logged in", name);
if (AccountInfo[playerid][AdminLevel] > 0)
{
format(str, sizeof str, "|» You are now logged in as a level %d admin «|", AccountInfo[playerid][AdminLevel]);
SendClientMessage(playerid, LIGHTGREEN, str);
ViewCmds[playerid] = 1;
Hide[playerid] = 1;
}
}
return 1;
}
main(){}
Re: register problem -
Rks25 - 20.04.2009
What is the uh problem here?
Re: register problem -
MenaceX^ - 20.04.2009
Quote:
Originally Posted by Rk_
What is the uh problem here?
|
They always do it

Show a code and never say what's wrong
Also I'd suggest you to go to Seif's admin script topic, it's taken from there though.
Re: register problem -
StrickenKid - 20.04.2009
befor i even look at it, it needs to be in
tags please.
Re: register problem -
Burridge - 20.04.2009
pawn Код:
}
public OnPlayerRegister(playerid, password[])
{
if(IsPlayerConnected(playerid))
{
new name[MAX_PLAYER_NAME], str[128], ip[15];
GetPlayerName(playerid, name, sizeof name);
GetPlayerIp(playerid, ip, sizeof ip);
format(str, sizeof str, "/SchockAccounts/%s.Schock", name);
new File:account = fopen(str, io_write);
if (account)
{
strmid(AccountInfo[playerid][Password], password, 0, strlen(password), 255);
AccountInfo[playerid][Cash] = GetPlayerMoney(playerid);
new file[128];
{
format(file, sizeof file, "Password: %s\n\r", AccountInfo[playerid][Password]);
{ fwrite(account, file); }
format(file, sizeof file, "AdminLevel: %d\n\r",AccountInfo[playerid][AdminLevel]);
{ fwrite(account, file); }
format(file, sizeof file, "Cash: %d\n\r", AccountInfo[playerid][Cash]);
{ fwrite(account, file); }
format(file, sizeof file, "Warnings: %d\n\r",AccountInfo[playerid][Warns]);
{ fwrite(account, file); }
format(file, sizeof file, "WarnReason1: %s\n\r",AccountInfo[playerid][WarnReason1]);
{ fwrite(account, file); }
format(file, sizeof file, "WarnReason2: %s\n\r",AccountInfo[playerid][WarnReason2]);
{ fwrite(account, file); }
format(file, sizeof file, "WarnReason3: %s\n\r",AccountInfo[playerid][WarnReason3]);
{ fwrite(account, file); }
format(file, sizeof file, "IPAddress: %s\n\r",ip);
{ fwrite(account, file); }
}
fclose(account);
SendClientMessage(playerid, GREEN, "|- Account successfully registered. You can now login ( /login [password] ) -|");
}
}
return 1;
}
public OnPlayerUpdateAccount(playerid)
{
if(IsPlayerConnected(playerid))
{
if(AccountInfo[playerid][Logged] == 1)
{
new name[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, name, sizeof name);
format(str, sizeof str, "/SchockAccounts/%s.Schock", name);
new File:account = fopen(str, io_write);
if (account)
{
AccountInfo[playerid][Cash] = GetPlayerMoney(playerid);
new file[128];
{
format(file, sizeof file, "Password: %s\n\r", AccountInfo[playerid][Password]);
{ fwrite(account, file); }
format(file, sizeof file, "AdminLevel: %d\n\r",AccountInfo[playerid][AdminLevel]);
{ fwrite(account, file); }
format(file, sizeof file, "Cash: %d\n\r", AccountInfo[playerid][Cash]);
{ fwrite(account, file); }
format(file, sizeof file, "Warnings: %d\n\r",AccountInfo[playerid][Warns]);
{ fwrite(account, file); }
format(file, sizeof file, "WarnReason1: %s\n\r",AccountInfo[playerid][WarnReason1]);
{ fwrite(account, file); }
format(file, sizeof file, "WarnReason2: %s\n\r",AccountInfo[playerid][WarnReason2]);
{ fwrite(account, file); }
format(file, sizeof file, "WarnReason3: %s\n\r",AccountInfo[playerid][WarnReason3]);
{ fwrite(account, file); }
format(file, sizeof file, "IPAddress: %s\n\r",AccountInfo[playerid][IP]);
{ fwrite(account, file); }
}
fclose(account);
}
}
}
return 1;
}
public OnPlayerLogin(playerid, password[])
{
new name[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, name, sizeof name);
format(str, sizeof str, "/SchockAccounts/%s.Schock", name);
new File:account = fopen(str, io_read);
if (account)
{
new pass[256];
new passres[128], value[128];
fread(account, pass, sizeof pass);
passres = GetFileString(pass);
if (!strcmp("Password", passres))
{
value = GetFileValue(pass);
strmid(AccountInfo[playerid][Password], value, 0, strlen(value)-1, 128);
}
if (!strcmp(AccountInfo[playerid][Password], password, true))
{
while (fread(account, pass, 256))
{
passres = GetFileString(pass);
if (strfind(passres, "AdminLevel") != -1)
{
value = GetFileValue(pass);
AccountInfo[playerid][AdminLevel] = strval(value);
}
if (strfind(passres, "Cash") != -1)
{
value = GetFileValue(pass);
AccountInfo[playerid][Cash] = strval(value);
}
if (strfind(passres, "Warnings") != -1)
{
value = GetFileValue(pass);
AccountInfo[playerid][Warns] = strval(value);
}
if (strfind(passres, "WarnReason1") != -1)
{
value = GetFileValue(pass);
strmid(AccountInfo[playerid][WarnReason1], value, 0, strlen(value)-1, 128);
}
if (strfind(passres, "WarnReason2") != -1)
{
value = GetFileValue(pass);
strmid(AccountInfo[playerid][WarnReason2], value, 0, strlen(value)-1, 128);
}
if (strfind(passres, "WarnReason3") != -1)
{
value = GetFileValue(pass);
strmid(AccountInfo[playerid][WarnReason3], value, 0, strlen(value)-1, 128);
}
}
fclose(account);
AccountInfo[playerid][Logged] = 1;
}
else
{
SendClientMessage(playerid, RED, "Incorrect Password.");
fclose(account);
return 1;
}
GivePlayerMoney(playerid, AccountInfo[playerid][Cash]);
format(str, sizeof str, "|- You have successfully logged in as %s -|", name);
SendClientMessage(playerid, GREEN, str);
printf("%s has logged in", name);
if (AccountInfo[playerid][AdminLevel] > 0)
{
format(str, sizeof str, "|» You are now logged in as a level %d admin «|", AccountInfo[playerid][AdminLevel]);
SendClientMessage(playerid, LIGHTGREEN, str);
ViewCmds[playerid] = 1;
Hide[playerid] = 1;
}
}
return 1;
}
main(){}
Done for you...
Re: register problem -
dennis218 - 21.04.2009
The stores are not the accounts!