Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dofile("classes/user.nut");
- local player = User();
- local handler = mysql_connect("localhost", "root", "", "gothic");
- local SERVER_NAME = "Sequel RolePlay";
- function onInit()
- {
- }
- function onJoin(pid)
- {
- print("player: " + getPlayerName(pid));
- print("isLogged: " + player.isLogged);
- if(!player.isLogged)
- {
- for(local i = 0; i < getMaxSlots(); ++i)
- {
- sendMessage(i, 225, 225, 225, "Игрок " + getPlayerName(pid) + " подключился к игре.");
- }
- local string = format("SELECT * FROM player_stats WHERE login = '%s'", getPlayerName(pid));
- local row = mysql_fetch_row(mysql_query(handler, string));
- sendMessage(pid, 225, 225, 225, "* Добро пожаловать на игровой сервер Gothic Online");
- if(!row)
- {
- sendMessage(pid, 225, 225, 225, "* Ваш игровой аккаунт не зарегистрирован.");
- sendMessage(pid, 225, 225, 225, "* Для регистрации воспользуйтесь: /reg <пароль> <пароль>");
- }
- else
- {
- sendMessage(pid, 225, 225, 225, "* Для авторизации воспользуйтесь: /log <пароль>")
- }
- }
- else
- {
- sendMessage(pid, 225, 225, 225, "* Ваш игровой аккаунт был поврежден.");
- kick(pid);
- }
- }
- function onDisconnect(pid, reason)
- {
- player.saveAccount(pid);
- player.clearPlayerStats(pid);
- }
- function onDie(pid, kid)
- {
- }
- function onCommand(pid, cmd, params)
- {
- switch(cmd)
- {
- case "reg":
- {
- player.regAccount(pid, params);
- break;
- }
- case "log":
- {
- player.logAccount(pid, params);
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement