12.07.2011, 20:35
Can someone help me to create a register system in Dialogs with this commands?:
Код:
command(register, playerid, params[]) { if (PLAYERLIST_authed[playerid]) return SendClientMessage(playerid, Red, "You are already logged in."); if (udb_Exists(PlayerName(playerid))) return SendClientMessage(playerid, Orange, "This name is already taken."); if (strlen(params)==0) return SendClientMessage(playerid, Red, "Usage: /register [pass]"); if (udb_Create(PlayerName(playerid),params)) { dUserSetINT(PlayerName(playerid)).("Score", 0); dUserSetINT(PlayerName(playerid)).("AdminLevel", 0); dUserSetINT(PlayerName(playerid)).("PlayerLevel", 0); dUserSetINT(PlayerName(playerid)).("Kills", 0); dUserSetINT(PlayerName(playerid)).("Deaths", 0); new string[128]; new pname[24]; GetPlayerName(playerid, pname, 24); format(string, sizeof(string), "%s(%d) has created a player file.", pname, playerid); IRC_Say(gGroupID, IRC_CHANNEL, string); return SendClientMessage(playerid, Red, "Your account has been created."); } return true; }
Код:
command(login, playerid, params[]) { if (PLAYERLIST_authed[playerid]) return SendClientMessage(playerid, Orange, "You are already logged in"); if (!udb_Exists(PlayerName(playerid))) return SendClientMessage(playerid, Orange, "That account is not yet registerd."); if (strlen(params)==0) return SendClientMessage(playerid, Red, "Usage: /login password"); if (udb_CheckLogin(PlayerName(playerid), params)) { SetPlayerScore(playerid, dUserINT(PlayerName(playerid)).("Score")-GetPlayerScore(playerid)); AdminLevel[playerid] = dUserINT(PlayerName(playerid)).("AdminLevel"); PlayerLevel[playerid] = dUserINT(PlayerName(playerid)).("PlayerLevel"); AdminLevel[playerid] = dUserINT(PlayerName(playerid)).("AdminLevel"); Deaths[playerid] = dUserINT(PlayerName(playerid)).("Deaths"); Kills[playerid] = dUserINT(PlayerName(playerid)).("Kills"); PLAYERLIST_authed[playerid]=true; Logged[playerid] =1; new string[128]; new pname[24]; GetPlayerName(playerid, pname, 24); format(string, sizeof(string), "%s(%d) has logged into their player file.", pname, playerid); IRC_Say(gGroupID, IRC_CHANNEL, string); return SendClientMessage(playerid, Red, "You are now logged in."); } new string[128]; new pname[24]; GetPlayerName(playerid, pname, 24); format(string, sizeof(string), "%s(%d) has failed to login to the player file.", pname, playerid); IRC_Say(gGroupID, IRC_CHANNEL, string); return SendClientMessage(playerid, Red, "Login Failed."); }