Advertisement
N1E7R4V

Untitled

Nov 26th, 2016
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.82 KB | None | 0 0
  1. function login(pid,params)
  2. {
  3. if (Player[pid].logged == false)
  4. {
  5. local args = sscanf("s",params);
  6. if (args)
  7. {
  8. mysql_query(handler, "SET NAMES 'cp1251'");
  9. mysql_query(handler, "SET CHARACTER SET 'cp1251'");
  10. local query = mysql_query(handler,"SELECT * FROM `goose`.`players` WHERE `player_name` = '" + getPlayerName(pid) + "'");
  11. local row = mysql_fetch_row(query);
  12. if(row)
  13. {
  14. mysql_query(handler, "SET NAMES 'cp1251'");
  15. mysql_query(handler, "SET CHARACTER SET 'cp1251'");
  16. local query = mysql_query(handler,"SELECT * FROM `goose`.`players` WHERE `player_name` = '" + getPlayerName(pid) + "' AND `password` = '" + args + "'");
  17. local pass = mysql_fetch_row(query);
  18. if(row)
  19. {
  20. callClientFunc(pid,RELIABLE,"setFreeze",false);
  21. callClientFunc(pid,RELIABLE,"setLogged",true);
  22. Player[pid].logged = true;
  23. readStats(pid);
  24. readItems(pid);
  25. sendMessage(pid,255,255,255,"Вы успешно вошли в аккаунт. Приятной игры!");
  26. }
  27. else
  28. {
  29. sendMessage(pid,255,0,0,"Ошибка! Неправильный пароль");
  30. }
  31. }
  32. else
  33. {
  34. sendMessage(pid,255,0,0,"Ошибка! Игрок с таким никнеймом не зарегистрирован!");
  35. sendMessage(pid,255,0,0,"Зарегистрируйтесь с помощью команды " + cav.tochar() + "/рег (пароль)" + cav.tochar() + " без скобок и кавычек.");
  36. sendMessage(pid,255,0,0,"Если Вы уже были зарегистрированы под этим никнеймом и не можете войти, то напишите в тех. поддержку на форуме.");
  37. }
  38. }
  39. else
  40. {
  41. sendMessage(pid,255,0,0,"Ошибка! Используйте команду " + cav.tochar() + "/лог (пароль)" + cav.tochar() + " без скобок и кавычек.");
  42. }
  43. }
  44. else
  45. {
  46. sendMessage(pid,255,0,0,"Ошибка! Вы уже вошли в аккаунт!");
  47. }
  48. }
  49.  
  50. function readStats(pid)
  51. {
  52. mysql_query(handler, "SET NAMES 'cp1251'");
  53. mysql_query(handler, "SET CHARACTER SET 'cp1251'");
  54. local string = format("SELECT * FROM `players` WHERE `player_name` = '" + getPlayerName(pid) + "'");
  55. local query = mysql_query(handler, string);
  56. local row = mysql_fetch_row(query);
  57.  
  58. if (row)
  59. {
  60. callClientFunc(pid,RELIABLE,"setMaxHealth",row["maxhp"]); //АШЫПКА
  61. callClientFunc(pid,RELIABLE,"setHealth",row["hp"]);
  62. callClientFunc(pid,RELIABLE,"setMaxMana",row["maxmp"]);
  63. callClientFunc(pid,RELIABLE,"setMana",row["mp"]);
  64. callClientFunc(pid,RELIABLE,"setStrength",row["str"]);
  65. callClientFunc(pid,RELIABLE,"setDexterity",row["dex"]);
  66. callClientFunc(pid,RELIABLE,"setWeaponSkill",1,row["1h"]);
  67. callClientFunc(pid,RELIABLE,"setWeaponSkill",2,row["2h"]);
  68. callClientFunc(pid,RELIABLE,"setWeaponSkill",3,row["bow"]);
  69. callClientFunc(pid,RELIABLE,"setWeaponSkill",4,row["cbow"]);
  70. callClientFunc(pid,RELIABLE,"setMagicLevel",row["magiclvl"]);
  71. callClientFunc(pid,RELIABLE,"setAcrobatic",row["acro"]);
  72. callClientFunc(pid,RELIABLE,"setTalent",1,row["sneaking"]);
  73. callClientFunc(pid,RELIABLE,"setTalent",2,row["locks"]);
  74. callClientFunc(pid,RELIABLE,"setTalent",3,row["thief"]);
  75. callClientFunc(pid,RELIABLE,"setTalent",4,row["runes"]);
  76. callClientFunc(pid,RELIABLE,"setTalent",5,row["alchemy"]);
  77. callClientFunc(pid,RELIABLE,"setTalent",6,row["blades"]);
  78. callClientFunc(pid,RELIABLE,"setTalent",7,row["trophies"]);
  79. callClientFunc(pid,RELIABLE,"setPosition",row["posx"],row["posy"],row["posz"]);
  80. callClientFunc(pid,RELIABLE,"setAngle",row["angle"]);
  81. callClientFunc(pid,RELIABLE,"setAdditionalVisual",row["body"].tostring(),row["btexture"].tointeger(),row["model"].tostring(),row["htexture"].tointeger());
  82. }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement