28.04.2010, 18:48
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256],tmp[256], tmp2[256];
new idx;
new string[256];
cmd = strtok(cmdtext, idx);
GetPlayerName(playerid, playername, sizeof(playername));
tmp = strtok(cmdtext, idx);
if(strcmp(cmd, "/register", true) == 0)
{
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /register (password)");
}
else
{
if (!dini_Exists(udb_encode(playername)))
{
dini_Create(udb_encode(playername));
dini_IntSet(udb_encode(playername), "password", udb_hash(tmp));
dini_IntSet(udb_encode(playername), "adminlevel", 0);
dini_IntSet(udb_encode(playername), "money", 0);
dini_IntSet(udb_encode(playername), "score", 0);
format(string, sizeof(string), "Account %s has been made! You can now login with the password: %s.", playername, tmp);
SendClientMessage(playerid, COLOR_GREEN, string);
}else{
format(string, sizeof(string), "%s is already registered.", playername,tmp);
SendClientMessage(playerid, COLOR_RED, string);
}
}
return 1;
}
return 0;
}