What the bug is>>> The Register + Login system doesnt work...I Dont know why.I asked befor some of my friends but they hadnt any ideas. I hope u guys got some ideas and can help me plsss
Код:
//---------------
/*
* /register password
*
*/
dcmd_register(playerid,params[]) {
// The command shouldn't work if we already are authed
if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid,"Already authed.");
// The command shouldn't work if an account with this
// nick already exists
if (udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,"Account already exists, please use '/login password'.");
// Did he forgot the password?
if (strlen(params)==0) return SystemMsg(playerid,"Correct usage: '/register password'");
// We save the money to the accstate
if (udb_Create(PlayerName(playerid),params)) return SystemMsg(playerid,"Account successfully created. Login with '/login password' now.");
return true;
}
/*
* /login password
*
*/
dcmd_login(playerid,params[]) {
// The command shouldn't work if we already are authed
if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid,"Already authed.");
// The command shouldn't work if an account with this
// nick does not exists
if (!udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,"Account doesn't exist, please use '/register password'.");
// Did he forgot the password?
if (strlen(params)==0) return SystemMsg(playerid,"Correct usage: '/login password'");
if (udb_CheckLogin(PlayerName(playerid),params)) {
// Login was correct
// Following thing is the same like the missing SetPlayerCommand
GivePlayerMoney(playerid,dUserINT(PlayerName(playerid)).("money")-GetPlayerMoney(playerid));
PLAYERLIST_authed[playerid]=true;
return SystemMsg(playerid,"Successfully authed!");
}
// Login was incorrect
return SystemMsg(playerid,"Login failed!");
}
//------------------------------------------------------------------------------------------------------
public OnPlayerCommandText(playerid, cmdtext[])
{
new string[256];
new playermoney;
new sendername[MAX_PLAYER_NAME];
new giveplayer[MAX_PLAYER_NAME];
new cmd[256];
new giveplayerid, moneys, idx, weaponid;
cmd = strtok(cmdtext, idx);
dcmd(login,5,cmdtext); // because login has 5 characters
dcmd(register,8,cmdtext); // because register has 8 characters
//------------------- /help