21.04.2010, 18:39
Hey Guys! alright I'm trying to make a Login Dialog system Hers what i got:
This Under OnPlayerConnect.
This at the top.
Register:
Alright this doesn't work at all.. nothing pops up when you enter the server :S
Do you know what the problem is? Thanks!
This Under OnPlayerConnect.
Код:
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Login", "Welcome Back!", "Login", "Quit");
Код:
enum pInfo // Stats { pAdminLevel, pBites, pKills }; new cmd[256], idx, file[128], tmp[256], tmp2[256];
Код:
{ cmd = strtok(cmdtext, idx); if(strcmp(cmd, "/register", true) == 0) { new name[MAX_PLAYER_NAME]; tmp = strtok(cmdtext, idx); GetPlayerName(playerid, name, sizeof(name)); if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /register [password]"); format(file,sizeof(file),"%s.ini",name); if(!fexist(file)) { dini_Create(file); dini_IntSet(file,"pPassword", udb_hash(tmp)); dini_IntSet(file,"pBites", 0); dini_IntSet(file,"pKills", 0); SendClientMessage(playerid, DARKRED, "[System]: Account Created!"); PlayerPlaySound(playerid,1057,0.0,0.0,0.0); GetPlayerName(playerid, name, sizeof(name)); printf("%s has registered a account!", name); } else { SendClientMessage(playerid, DARKRED, " Account Already Found In Database"); PlayerPlaySound(playerid,1057,0.0,0.0,0.0); } return 1; } return 0;
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if (dialogid == 1) { if (response == 1) //making sure "Login" was pressed { tmp2 = dini_Get(file, "pPassword"); if(udb_hash(tmp) != strval(tmp2)) { IsLogged[playerid] = 1; PlayerInfo[playerid][pBites] = dini_Int(file, "pBites"); } else //incorrect password { ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, "Invalid Password", "Invalid Password, try again", "Login", "Cancel");. } } else //pressed "Cancel" { SendClientMessage(playerid, 0xFFFFFFFF, "You have to log In! "); SendClientMessage(playerid, 0xFFFFFFFF, "Relog!"); SetTimerEx("kicker", 200, 0, "i", playerid); } return 1; } return 0; }
Alright this doesn't work at all.. nothing pops up when you enter the server :S
Do you know what the problem is? Thanks!