15.08.2013, 03:25
Thanks guy but now i need help with /register and /login Zcmds with dialog
[pawn]CMD:login(playerid,params[])
{
if (PlayerInfo[playerid][LoggedIn] == 1) return SendClientMessage(playerid,COLOR_RED,"{FA0C24}ACCO UNT: You are {FAFA0C}already logged in.");
if (!udb_Exists(PlayerName2(playerid))) return SendClientMessage(playerid,COLOR_RED,"{FA0C24}ACCO UNT: Account doesn't exist, please use {FAFA0C}'/register [password]'.");
if (strlen(params)==0) return SendClientMessage(playerid,COLOR_RED,"{FA0C24}ACCO UNT: Correct usage: {FAFA0C}'/login [password]'");
if (udb_CheckLogin(PlayerName2(playerid),params))
{
new file[256], tmp3[100], string[128], lname[MAX_PLAYER_NAME];
GetPlayerName(playerid,lname,sizeof(lname));
format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(lname));
GetPlayerIp(playerid,tmp3,100);
dini_Set(file,"ip",tmp3);
LoginPlayer(playerid);
LoadPlayer(playerid);
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
if(PlayerInfo[playerid][Level] > 0) {
format(string,sizeof(string),"{FAFA0C}ACCOUNT: Successfully {251BE0}Logged In. {FA0C24}(Level %d)", PlayerInfo[playerid][Level] );
return SendClientMessage(playerid,green,string);
} else return SendClientMessage(playerid,green,"{FAFA0C}ACCOUNT: {251BE0}Successfully {FA0C24}Logged In");
}
return SendClientMessage(playerid,COLOR_RED,"{FAFA0C}ACCO UNT: {251BE0}Login failed! {FA0C24}Incorrect Password");
}
LoginPlayer(playerid)
{
if(ServerInfo[GiveMoney] == 1) {ResetPlayerMoney(playerid); GivePlayerMoney(playerid, dUserINT(PlayerName2(playerid)).("money") ); }
dUserSetINT(PlayerName2(playerid)).("loggedin",1);
PlayerInfo[playerid][Deaths] = (dUserINT(PlayerName2(playerid)).("deaths"));
PlayerInfo[playerid][Kills] = (dUserINT(PlayerName2(playerid)).("kills"));
PlayerInfo[playerid][Level] = (dUserINT(PlayerName2(playerid)).("level"));
PlayerInfo[playerid][Registered] = 1;
PlayerInfo[playerid][LoggedIn] = 1;
}[pawn]
[pawn]CMD:login(playerid,params[])
{
if (PlayerInfo[playerid][LoggedIn] == 1) return SendClientMessage(playerid,COLOR_RED,"{FA0C24}ACCO UNT: You are {FAFA0C}already logged in.");
if (!udb_Exists(PlayerName2(playerid))) return SendClientMessage(playerid,COLOR_RED,"{FA0C24}ACCO UNT: Account doesn't exist, please use {FAFA0C}'/register [password]'.");
if (strlen(params)==0) return SendClientMessage(playerid,COLOR_RED,"{FA0C24}ACCO UNT: Correct usage: {FAFA0C}'/login [password]'");
if (udb_CheckLogin(PlayerName2(playerid),params))
{
new file[256], tmp3[100], string[128], lname[MAX_PLAYER_NAME];
GetPlayerName(playerid,lname,sizeof(lname));
format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(lname));
GetPlayerIp(playerid,tmp3,100);
dini_Set(file,"ip",tmp3);
LoginPlayer(playerid);
LoadPlayer(playerid);
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
if(PlayerInfo[playerid][Level] > 0) {
format(string,sizeof(string),"{FAFA0C}ACCOUNT: Successfully {251BE0}Logged In. {FA0C24}(Level %d)", PlayerInfo[playerid][Level] );
return SendClientMessage(playerid,green,string);
} else return SendClientMessage(playerid,green,"{FAFA0C}ACCOUNT: {251BE0}Successfully {FA0C24}Logged In");
}
return SendClientMessage(playerid,COLOR_RED,"{FAFA0C}ACCO UNT: {251BE0}Login failed! {FA0C24}Incorrect Password");
}
LoginPlayer(playerid)
{
if(ServerInfo[GiveMoney] == 1) {ResetPlayerMoney(playerid); GivePlayerMoney(playerid, dUserINT(PlayerName2(playerid)).("money") ); }
dUserSetINT(PlayerName2(playerid)).("loggedin",1);
PlayerInfo[playerid][Deaths] = (dUserINT(PlayerName2(playerid)).("deaths"));
PlayerInfo[playerid][Kills] = (dUserINT(PlayerName2(playerid)).("kills"));
PlayerInfo[playerid][Level] = (dUserINT(PlayerName2(playerid)).("level"));
PlayerInfo[playerid][Registered] = 1;
PlayerInfo[playerid][LoggedIn] = 1;
}[pawn]