01.03.2010, 23:13
Ingame if i type /register [mypassword]
Nothing happens..
But if i type /register, It shows the usage
Im using SeifAdmin v4 edited,
Nothing happens..
But if i type /register, It shows the usage
Im using SeifAdmin v4 edited,
pawn Код:
if (strcmp(cmd, "/register", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(AccountInfo[playerid][Logged] == 1)
{
SendClientMessage(playerid, RED, "You are already logged in.");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "/Gamemode/%s.cfg", sendername);
new File: hFile = fopen(string, io_read);
if (hFile)
{
SendClientMessage(playerid, RED, "That name is already taken. Please reconnect using a different username.");
fclose(hFile);
return 1;
}
new pass[150];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /register [password]");
WP_Hash(pass, sizeof pass, tmp);
printf("register: %s", pass);
OnPlayerRegister(playerid, pass);
}
return 1;
}
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, "/Gamemode/%s.cfg", 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[256];
{
format(file, sizeof file, "Password: %s\n", AccountInfo[playerid][Password]);
{fwrite(account, file); }
format(file, sizeof file, "Gender: %d\n", AccountInfo[playerid][Gender]);
{fwrite(account, file); }
format(file, sizeof file, "City: %d\n", AccountInfo[playerid][City]);
{fwrite(account, file); }
format(file, sizeof file, "Cash: %d\n", AccountInfo[playerid][Cash]);
{fwrite(account, file); }
format(file, sizeof file, "Warnings: %d\n",AccountInfo[playerid][Warns]);
{fwrite(account, file); }
format(file, sizeof file, "WarnReason1: %s\n",AccountInfo[playerid][WarnReason1]);
{fwrite(account, file); }
format(file, sizeof file, "WarnReason2: %s\n",AccountInfo[playerid][WarnReason2]);
{fwrite(account, file); }
format(file, sizeof file, "WarnReason3: %s\n",AccountInfo[playerid][WarnReason3]);
{fwrite(account, file); }
format(file, sizeof file, "IPAddress: %s\n",ip);
{fwrite(account, file); }
}
fclose(account);
SendClientMessage(playerid, GREEN, "You have successfully registered an account, Please login");
SendClientMessage(playerid, ORANGE, "\"/login [password]\"");
}
}
return 1;
}