23.05.2011, 17:11
(
Last edited by Dystans; 23/05/2011 at 05:15 PM.
Reason: some language bugs;)
)
Hi, this is my first post here, so if the wrong forum topic, please don't remove them, only to move, and I'm very sorry about this.
And now turn to the problem. So, I'm modify a L3th4l gamemode (Clean, Simple MySQL GM - https://sampforum.blast.hk/showthread.php?tid=208733), unfortunately, the GM don't have a loading money and points from MySQL. I tried different functions, but unfortunately I don't know so well PAWN, so I don't know how to repair this... Code looks like this:
and the function in the public DialogOnResponse looks that:
Is it possible to create such a code, which it read the points and money from this database? Sorry for my crappy english and regards, Linux_Shines.
And now turn to the problem. So, I'm modify a L3th4l gamemode (Clean, Simple MySQL GM - https://sampforum.blast.hk/showthread.php?tid=208733), unfortunately, the GM don't have a loading money and points from MySQL. I tried different functions, but unfortunately I don't know so well PAWN, so I don't know how to repair this... Code looks like this:
Code:
stock LoadPlayerInfo (iPlayer) { new Query [700]; if (mysql_fetch_row (Query)) { sscanf (Query, "e <p <|> s [24] s [35] ddddfffd>" PVar [iPlayer]); mysql_free_result (); } return true; }
Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch(dialogid) { case REGISTER: { if(!response) { format(Msg, sizeof(Msg), ""#CORANGE"%s (ID: %d) "#CBLUE"został(a) wyrzucony(a) - Powуd: Nie zarejestrował(a) się!", pName(playerid), playerid); SendClientMessageToAll(PSD_Kolor_Siwy, Msg); Kick(playerid); } else { if(!strlen(inputtext)) DialogInput(playerid, REGISTER, ""#CCADET"Rejestracja Konta", ""CYELLOW"Aby kontynuować musisz wpisać poniżej swoje hasło!", "Zarejestruj", "Wyjdź"); new Query[100], EscPass[30], EscName[MAX_PLAYER_NAME]; mysql_real_escape_string(pName(playerid), EscName); mysql_real_escape_string(inputtext, EscPass); format(Query, sizeof(Query), "INSERT INTO `playerinfo` (`user`, `password`) VALUES ('%s', md5('%s'))", EscName, EscPass); mysql_query(Query); SendClientMessage(playerid, PSD_Kolor_Niebieski, "Zarejestrowałeś(aś) się!"); GivePlayerMoney(playerid, 5000); SetPVarInt(playerid, "LoggedIN", 1); } } case LOGIN: { if(!response) { format(Msg, sizeof(Msg), ""#CORANGE"%s (ID: %d) "#CBLUE"został(a) wyrzucony(a) - Powуd: Nie zalogował(a) się!", pName(playerid), playerid); SendClientMessageToAll(PSD_Kolor_Siwy, Msg); Kick(playerid); } else { if(!strlen(inputtext)) DialogInput(playerid, LOGIN, ""#CCADET"Logowanie do Konta", ""#CYELLOW"Aby kontynuować musisz wpisać poniżej swoje hasło!", "Zaloguj", "Wyjdź"); new EscPass[38], Query[128]; mysql_real_escape_string(inputtext, EscPass); format(Query, sizeof(Query), "SELECT * FROM `playerinfo` WHERE `user` = '%s' AND `password` = md5('%s')", pName(playerid), EscPass); mysql_query(Query); mysql_store_result(); if(mysql_num_rows() > 0) { LoadPlayerInfo(playerid); SetPVarInt(playerid, "LoggedIN", 1); SendClientMessage(playerid, PSD_Kolor_Niebieski, "Zalogowałeś(aś) się!"); } else { SetPVarInt(playerid, "WrongPass", GetPVarInt(playerid, "WrongPass") + 1); SendClientMessage(playerid, PSD_Kolor_Czerwony, "Wpisałeś(aś) niepoprawne hasło. Sprуbuj ponownie!"); DialogInput(playerid, LOGIN, ""#CCADET"Logowanie do Konta", ""#CYELLOW"Masz 4 szanse aby wpisać poprawne hasło...", "Zaloguj", "Wyjdź"); } if(GetPVarInt(playerid, "WrongPass") == 1) { SendClientMessage(playerid, 0xF60000AA, "Zostały Ci 3 szansy, aby wpisać poprawne hasło!"); DialogInput(playerid, LOGIN, ""#CCADET"Logowanie do Konta", ""#CYELLOW"Masz 3 szanse aby wpisać poprawne hasło...", "Zaloguj", "Wyjdź"); } if(GetPVarInt(playerid, "WrongPass") == 2) { SendClientMessage(playerid, 0xF60000AA, "Zostały Ci 2 szansy, aby wpisać poprawne hasło!"); DialogInput(playerid, LOGIN, ""#CCADET"Logowanie do Konta", ""#CYELLOW"Masz 2 szanse aby wpisać poprawne hasło...", "Zaloguj", "Wyjdź"); } if(GetPVarInt(playerid, "WrongPass") == 3) { SendClientMessage(playerid, 0xF60000AA, "Została Ci 1 szansa, aby wpisać poprawne hasło!"); DialogInput(playerid, LOGIN, ""#CCADET"Logowanie do Konta", ""#CYELLOW"Masz 1 szansę aby wpisać poprawne hasło...", "Zaloguj", "Wyjdź"); } if(GetPVarInt(playerid, "WrongPass") == 4) { DialogInput(playerid, LOGIN, ""#CCADET"Osiągnięto maksymalną ilość szans!", ""#CYELLOW"Osiągnięto maksymalną ilość prуb wpisania poprawnego hasła! Automatyczne wyrzucenie!", "Okej", "Wyjdź"); Kick(playerid); } } } } return true; }