13.06.2015, 19:58
First, sorry my bad english, but help-me, i don't know what i'm doing wrong, i'm using the Overhaul tutorial to make the system and my code don't show erros, the MySql and Whirlpool neither, but when i login i spawn on the void, with any dialog for login or register, look the pawn compiler, code and server.cfg below:
Code:
Compiler:
MySql:
http://i.imgur.com/CDiqUrY.png
Server
i don't know what to do because i don't know what is wrong
Code:
Код:
#include <a_samp> #include <sscanf2> #include <zcmd> #include <a_mysql> //-------------[MY SQL - UCP]------------- #define MYSQL_HOST "localhost" #define MYSQL_USER "root" #define MYSQL_DATABASE "beta_ucp" #define MYSQL_PASSWORD "" enum { LoginDialog, RegisterDialog }; new mysql; native WP_Hash(buffer[], len, const str[]); enum PlayerData { ID, Nome[MAX_PLAYER_NAME], Senha[129], IP[16], Admin, VIP, Dinheiro, Float:PosX, Float:PosY, Float:PosZ, Float:PosA }; new Player[MAX_PLAYERS][PlayerData]; //---------------------------------------- public OnGameModeInit() { mysql_log(LOG_ALL); mysql = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_DATABASE, MYSQL_PASSWORD); if (mysql_errno() != 0) { printf("[MySQL] Conexгo falhou!"); } else { printf("[MySQL] Conexгo estabelecida!"); } //AddPlayerClass(20,2035.3422,1326.9642,10.8203,271.0643,0,0,0,0,0,0); return 1; } public OnPlayerConnect(playerid) { new query[128], playername[MAX_PLAYER_NAME]; GetPlayerName(playerid, playername, sizeof(playername)); mysql_format(mysql, query, sizeof(query), "SELECT 'Senha', 'ID' FROM 'accounts' WHERE 'Nome' = '%e' LIMIT 1", playername); mysql_tquery(mysql, query, "OnAccountCheck", "i", playerid); return 1; } public OnPlayerDisconnect(playerid, reason) { new query[128], Float:pos[4]; GetPlayerPos(playerid, pos[0], pos[1], pos[2]); GetPlayerFacingAngle (playerid, pos[3]); mysql_format(mysql, query, sizeof(query), "UPDATE `accounts` SET `Dinheiro` = %d, `PosX` = %f, `PosY` = %f, `PosZ` = %f, `PosA` = %f WHERE `ID` = %d", GetPlayerMoney(playerid), pos[0], pos[1], pos[2], pos[3], Player[playerid][ID]); mysql_tquery(mysql, query, "", ""); return 1; } public OnPlayerSpawn(playerid) { SendClientMessage(playerid, -1, "Agora vocк esta jogando"); SetPlayerPos(playerid, Player[playerid][PosX], Player[playerid][PosY], Player[playerid][PosZ]); SetPlayerFacingAngle(playerid, Player[playerid][PosA]); return 1; } forward OnAccountCheck(playerid); public OnAccountCheck(playerid) { new rows, fields; cache_get_data (rows, fields, mysql); if(rows) { cache_get_field_content(0, "Senha", Player[playerid][Senha], mysql, 129); Player[playerid][ID] = cache_get_field_content_int(0, "ID"); ShowPlayerDialog (playerid, LoginDialog, DIALOG_STYLE_INPUT, "Login", "Bem vindo!\nSua conta foi encontrada em nosso banco de dados.\nPor Favor coloque sua senha:", "Login", "Quit"); } else { ShowPlayerDialog (playerid, RegisterDialog, DIALOG_STYLE_INPUT, "Register", "Bem vindo!\nSua conta ainda nгo esta registrada.\nPor Favor preencha sua senha para criar a conta.", "Register", "Quit"); } } forward OnAccountLoad (playerid); public OnAccountLoad(playerid) { Player[playerid][Admin] = cache_get_field_content_int(0, "Admin"); Player[playerid][VIP] = cache_get_field_content_int(0, "VIP"); Player[playerid][Dinheiro] = cache_get_field_content_int(0, "Dinheiro"); Player[playerid][PosX] = cache_get_field_content_float(0, "PosX"); Player[playerid][PosY] = cache_get_field_content_float(0, "PosY"); Player[playerid][PosZ] = cache_get_field_content_float(0, "PosZ"); Player[playerid][PosA] = cache_get_field_content_float(0, "PosA"); ResetPlayerMoney(playerid); GivePlayerMoney(playerid, Player[playerid][Dinheiro]); SendClientMessage(playerid, -1, "You have successfully logged in."); } forward OnAccountRegister (playerid); public OnAccountRegister (playerid) { Player[playerid][ID] = cache_insert_id(); printf("[Registration] New account registered. Database ID: [%d]", Player[playerid][ID]); return 1; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch(dialogid) { case LoginDialog: { if(!response) Kick(playerid); new hashpass[129], query[100], playername[MAX_PLAYER_NAME]; GetPlayerName (playerid, playername, sizeof(playername)); WP_Hash (hashpass, sizeof(hashpass), inputtext); if (!strcmp(hashpass, Player[playerid][Senha])) { mysql_format(mysql, query, sizeof(query), "SELECT * FROM `accounts` WHERE `Nome` = '%e' LIMIT 1", playername); mysql_tquery(mysql, query, "OnAccountLoad", "i", playerid); } else { SendClientMessage(playerid, -1, "Senha incorreta!"); ShowPlayerDialog(playerid, LoginDialog, DIALOG_STYLE_INPUT, "Login", "Bem Vindo!\nYour account has been found in our database. Please fill in your password:", "Login", "Quit"); } } case RegisterDialog: { if(!response) return Kick(playerid); if(strlen(inputtext) < 5) { SendClientMessage (playerid, -1, "Sua senha deve ter mais de 4 caracteres!"); return ShowPlayerDialog(playerid, RegisterDialog, DIALOG_STYLE_INPUT, "Register", "Welcome player!\nYour account has not been registered yet. Please fill in your desired password:", "Register", "Quit"); } new query[512], playername[MAX_PLAYER_NAME], playerip[16]; GetPlayerName(playerid, playername, sizeof(playername)); GetPlayerIp(playerid, playerip, sizeof(playerip)); WP_Hash(Player[playerid][Senha], 129, inputtext); mysql_format(mysql, query, sizeof(query), "INSERT INTO `accounts` (`Nome`, `Senha`, `IP`, `Admin`, `VIP`, `Dinheiro`, `PosX`, `PosY`, `PosZ`, `PosA`) VALUES ('%e', '%e', '%e', 0, 0, 0, 0.0, 0.0, 0.0, 0.0)", playername, Player[playerid][Senha], playerip); mysql_tquery(mysql, query, "OnAccountRegister", "i", playerid); } } return 1; }
Код:
C:\Downloads\samp037_svr_R1_win32\gamemodes\new.pwn(118) : warning 217: loose indentation C:\Downloads\samp037_svr_R1_win32\gamemodes\new.pwn(404) : warning 217: loose indentation Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 2 Warnings.
http://i.imgur.com/CDiqUrY.png
Server
Код:
SA-MP Dedicated Server ---------------------- v0.3.7, ©2005-2015 SA-MP Team [12:17:34] [12:17:34] Server Plugins [12:17:34] -------------- [12:17:34] Loading plugin: sscanf [12:17:34] [12:17:34] =============================== [12:17:34] sscanf plugin loaded. [12:17:34] Version: 2.8.1 [12:17:34] © 2012 Alex "******" Cole [12:17:34] =============================== [12:17:34] Loaded. [12:17:34] Loading plugin: Whirlpool [12:17:34] [12:17:34] ================== [12:17:34] [12:17:34] Whirlpool loaded [12:17:34] [12:17:34] ================== [12:17:34] [12:17:34] Loaded. [12:17:34] Loading plugin: mysql [12:17:34] >> plugin.mysql: R39-3 successfully loaded. [12:17:34] Loaded. [12:17:34] Loaded 3 plugins. [12:17:34] [12:17:34] Filterscripts [12:17:34] --------------- [12:17:34] Loading filterscript '0.amx'... [12:17:34] Unable to load filterscript '0.amx'. [12:17:34] Loaded 0 filterscripts. [12:17:34] [MySQL] Conexгo estabelecida! [12:17:34] -------------------- [12:17:34] Blank Gamemode by Duh [12:17:34] ---------------------- [12:17:34] Number of vehicle models: 0 [12:18:20] [connection] ***.***.***.***:53006 requests connection cookie. [12:18:21] Incoming connection: ***.***.***.***:53006 id: 0 [12:18:22] [join] Ethan_Davis has joined the server (0:***.***.***.***)