Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function login(pid,params)
- {
- if (Player[pid].logged == false)
- {
- local args = sscanf("s",params);
- if (args)
- {
- mysql_query(handler, "SET NAMES 'cp1251'");
- mysql_query(handler, "SET CHARACTER SET 'cp1251'");
- local query = mysql_query(handler,"SELECT * FROM `goose`.`players` WHERE `player_name` = '" + getPlayerName(pid) + "'");
- local row = mysql_fetch_row(query);
- if(row)
- {
- mysql_query(handler, "SET NAMES 'cp1251'");
- mysql_query(handler, "SET CHARACTER SET 'cp1251'");
- local query = mysql_query(handler,"SELECT * FROM `goose`.`players` WHERE `player_name` = '" + getPlayerName(pid) + "' AND `password` = '" + args + "'");
- local pass = mysql_fetch_row(query);
- if(row)
- {
- callClientFunc(pid,RELIABLE,"setFreeze",false);
- callClientFunc(pid,RELIABLE,"setLogged",true);
- Player[pid].logged = true;
- readStats(pid);
- readItems(pid);
- sendMessage(pid,255,255,255,"Вы успешно вошли в аккаунт. Приятной игры!");
- }
- else
- {
- sendMessage(pid,255,0,0,"Ошибка! Неправильный пароль");
- }
- }
- else
- {
- sendMessage(pid,255,0,0,"Ошибка! Игрок с таким никнеймом не зарегистрирован!");
- sendMessage(pid,255,0,0,"Зарегистрируйтесь с помощью команды " + cav.tochar() + "/рег (пароль)" + cav.tochar() + " без скобок и кавычек.");
- sendMessage(pid,255,0,0,"Если Вы уже были зарегистрированы под этим никнеймом и не можете войти, то напишите в тех. поддержку на форуме.");
- }
- }
- else
- {
- sendMessage(pid,255,0,0,"Ошибка! Используйте команду " + cav.tochar() + "/лог (пароль)" + cav.tochar() + " без скобок и кавычек.");
- }
- }
- else
- {
- sendMessage(pid,255,0,0,"Ошибка! Вы уже вошли в аккаунт!");
- }
- }
- function readStats(pid)
- {
- mysql_query(handler, "SET NAMES 'cp1251'");
- mysql_query(handler, "SET CHARACTER SET 'cp1251'");
- local string = format("SELECT * FROM `players` WHERE `player_name` = '" + getPlayerName(pid) + "'");
- local query = mysql_query(handler, string);
- local row = mysql_fetch_row(query);
- if (row)
- {
- callClientFunc(pid,RELIABLE,"setMaxHealth",row["maxhp"]); //АШЫПКА
- callClientFunc(pid,RELIABLE,"setHealth",row["hp"]);
- callClientFunc(pid,RELIABLE,"setMaxMana",row["maxmp"]);
- callClientFunc(pid,RELIABLE,"setMana",row["mp"]);
- callClientFunc(pid,RELIABLE,"setStrength",row["str"]);
- callClientFunc(pid,RELIABLE,"setDexterity",row["dex"]);
- callClientFunc(pid,RELIABLE,"setWeaponSkill",1,row["1h"]);
- callClientFunc(pid,RELIABLE,"setWeaponSkill",2,row["2h"]);
- callClientFunc(pid,RELIABLE,"setWeaponSkill",3,row["bow"]);
- callClientFunc(pid,RELIABLE,"setWeaponSkill",4,row["cbow"]);
- callClientFunc(pid,RELIABLE,"setMagicLevel",row["magiclvl"]);
- callClientFunc(pid,RELIABLE,"setAcrobatic",row["acro"]);
- callClientFunc(pid,RELIABLE,"setTalent",1,row["sneaking"]);
- callClientFunc(pid,RELIABLE,"setTalent",2,row["locks"]);
- callClientFunc(pid,RELIABLE,"setTalent",3,row["thief"]);
- callClientFunc(pid,RELIABLE,"setTalent",4,row["runes"]);
- callClientFunc(pid,RELIABLE,"setTalent",5,row["alchemy"]);
- callClientFunc(pid,RELIABLE,"setTalent",6,row["blades"]);
- callClientFunc(pid,RELIABLE,"setTalent",7,row["trophies"]);
- callClientFunc(pid,RELIABLE,"setPosition",row["posx"],row["posy"],row["posz"]);
- callClientFunc(pid,RELIABLE,"setAngle",row["angle"]);
- callClientFunc(pid,RELIABLE,"setAdditionalVisual",row["body"].tostring(),row["btexture"].tointeger(),row["model"].tostring(),row["htexture"].tointeger());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement