09.02.2011, 14:00
Well i can't figure out how to save score and money!! Can somebody help me!
Here will be code:
Here will be code:
Код:
public OnPlayerConnect(playerid) { Login[playerid] = 0; new name[MAX_PLAYER_NAME], archive[256]; GetPlayerName(playerid, name, sizeof(name)); format(archive, sizeof(archive), "/Users/%s.ini", name); if (!dini_Exists(archive)) { ShowPlayerDialog(playerid, Register, DIALOG_STYLE_INPUT, "Register", "Enter your password please:", "Accept", "Cancel"); } else { ShowPlayerDialog(playerid, Logged, DIALOG_STYLE_INPUT, "Login", "Enter your password please:", "Accept", "Cancel"); } return 1; }
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if (dialogid == Register) { new name[MAX_PLAYER_NAME], archive[256]; if (!strlen(inputtext)) return ShowPlayerDialog(playerid, Register, DIALOG_STYLE_INPUT, "Register", "Enter your password please", "Accept", "Cancel"); if (!response) return ShowPlayerDialog(playerid, Register, DIALOG_STYLE_INPUT, "Register", "Enter your password please:", "Accept", "Cancel"); GetPlayerName(playerid, name, sizeof(name)); format(archive, sizeof(archive), "/Users/%s.ini", name); dini_Create(archive); dini_Set(archive, "User", name); dini_Set(archive, "Password", inputtext); ShowPlayerDialog(playerid, Logged, DIALOG_STYLE_INPUT, "Login", "Enter your password please", "Accept", "Cancel"); } if (dialogid == Logged) { new name[MAX_PLAYER_NAME], archive[256], proof[256]; if (!strlen(inputtext)) return ShowPlayerDialog(playerid, Logged, DIALOG_STYLE_INPUT, "Login", "Enter your password please", "Accept", "Cancel"); if (!response) return ShowPlayerDialog(playerid, Logged, DIALOG_STYLE_INPUT, "Login", "Enter your password please", "Accept", "Cancel"); GetPlayerName(playerid, name, sizeof(name)); format(archive, sizeof(archive), "/Users/%s.ini", name); format(proof, sizeof(proof), "%s", dini_Get(archive, "Password")); if (!strcmp (inputtext, proof)) { } else { ShowPlayerDialog(playerid, Logged, DIALOG_STYLE_INPUT, "Login", "Enter your password please", "Accept", "Cancel"); } } return 1; }