Scripting problem
#1

Код:
#include <a_samp>
#include <a_mysql>

native WP_Hash(buffer[], len, const str[]);

//EDIT IT--------->
#define mysql_host "127.0.0.1"
#define mysql_user "*****"
#define mysql_password "******"
#define mysql_database "******"



new logintries[MAX_PLAYERS];
new db;

enum penum
{
	pLogged,
	Password[130],5
	pAdmin
}

new pInfo[MAX_PLAYERS][penum];

enum dialogs
{
	DIALOG_LOGIN,
	DIALOG_REGISTER
}

main(){}

stock Name(playerid)
{
    new pname[24];
    GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
    return pname;
}

public OnGameModeInit()
{
    //mysql_log(LOG_ALL);
    UsePlayerPedAnims();
    db = mysql_connect(mysql_host, mysql_user, mysql_database, mysql_password);
    if(mysql_errno())
    {
        print(">> Connection to MySQL database FAILED");
        print("Game mode will now exit.");
        SendRconCommand("exit");
        return 1;
    }
    print(">> Connection to MySQL database SUCCESSFULL");
    mysql_tquery(db, "CREATE TABLE IF NOT EXISTS `users`(`name` VARCHAR(24), `pass` VARCHAR(130), `score` INT(20) DEFAULT 0, `money` INT(20) DEFAULT 0, `IP` VARCHAR(16), `admin` INT(2) DEFAULT 0 )");
	return 1;
}

public OnGameModeExit()
{
	mysql_close(db);
    print(">> Disconnected from MySQL.");
    return 1;
}


public OnPlayerConnect(playerid)
{
	SetPlayerWeather(playerid, 18);
	SetPlayerTime(playerid, 17, 0);
	new query[250];
 	mysql_format(db, query, sizeof(query), "SELECT `pass` FROM `users` WHERE `name` = '%e' LIMIT 1", Name(playerid));
  	mysql_tquery(db, query, "AccountCheck", "d", playerid);
  	return 1;
}

forward AccountCheck(playerid);
public AccountCheck(playerid)
{
	new string[200];
	if(cache_get_row_count())
    {
        new temp[130];
        cache_get_field_content(0, "pass", temp);
        format(pInfo[playerid][Password], 130, "%s", temp);
        format(string, sizeof(string),"{ffffff}Welcome back {00f0f0}%s \n\n{f0f000}Please login to continue.", Name(playerid));
		ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"{ffffff}Account Login Panel", string, "Login", "Quit");
	}
	else
	{
	    format(string, sizeof(string), "{ffffff}Welcome {00f0f0}%s \n\n{f0f000}Please register to continue.", Name(playerid));
		ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,"{ffffff}Account Register Panel", string, "Register", "Quit");
  	}
	return 1;
}

forward OnPlayerRegister(playerid);
public OnPlayerRegister(playerid)
{
    SendClientMessage(playerid,-1,"*{00ff00} You have been successfully registered.");
   	pInfo[playerid][pLogged] = 1;
	return 1;
}

stock LoadStats(playerid)
{
	new query[100];
	mysql_format(db, query, sizeof(query), "SELECT * FROM `users` WHERE `name` = '%e' LIMIT 1", Name(playerid));
	mysql_tquery(db, query, "PlayerLoad", "d", playerid);
	return 1;
}

forward KickEx(playerid);
public KickEx(playerid)return Kick(playerid);

forward PlayerLoad(playerid);
public PlayerLoad(playerid)
{
	new temp[25];
	cache_get_field_content(0, "score", temp, db), SetPlayerScore(playerid, strval(temp));
	ResetPlayerMoney(playerid);
	cache_get_field_content(0, "money", temp, db), GivePlayerMoney(playerid, strval(temp));
	cache_get_field_content(0, "admin", temp, db), pInfo[playerid][pAdmin] = strval(temp);
	return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	switch(dialogid)
    {
   		case DIALOG_LOGIN:
        {
        	if(!response)
	        {
 				ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_MSGBOX,"{ff0000}Kicked","{ffffff} You must login to play", "Close", "");
				SetTimerEx("KickEx", 500, false, "d", playerid);
	        }
	        new buf[130];
	        WP_Hash(buf, sizeof(buf), inputtext);
            if(!strcmp(buf, pInfo[playerid][Password]))
            {
				pInfo[playerid][pLogged] = 1;
				SendClientMessage(playerid,-1,"*{00ff00} You have been successfully logged in.");
				LoadStats(playerid);
            }
            else
            {
                if(logintries[playerid] < 3)
                {
                	SendClientMessage(playerid,-4,"*{ff0000} Wrong password!");
                	ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"{ffffff}Account Login Panel", "TRY AGAIN - reason: Wrong Password", "Login", "Quit");
                	logintries[playerid]++;
				}
				else
				{
				    Kick(playerid);
				    logintries[playerid] = 0;
				}
			}
        }

        case DIALOG_REGISTER:
        {
	        if(!response)
	        {
 				ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_MSGBOX,"{ff0000}Kicked","{ffffff}You must login to play","Close","");
				KickEx(playerid);
	        }
			new IP[16], buf[130];
			GetPlayerIp(playerid, IP, sizeof(IP));
			WP_Hash(buf, sizeof(buf), inputtext);
			new query[250];
			mysql_format(db, query, sizeof(query), "INSERT INTO `users` (`name`, `pass`, `IP`) VALUES ('%e', '%s', '%s')",
						Name(playerid),
						buf,
						IP);
			mysql_tquery(db, query, "OnPlayerRegister", "d", playerid);
		}
	}
	return 1;
}


public OnPlayerDisconnect(playerid, reason)
{
    if(pInfo[playerid][pLogged] == 1)
    {
   		pInfo[playerid][pLogged] = 0;
   		new query[250];
   		mysql_format(db, query, sizeof(query), "UPDATE `users` SET `money` = %d, `score` = %d WHERE `name` = '%e'", GetPlayerMoney(playerid), GetPlayerScore(playerid), Name(playerid));
		mysql_tquery(db, query);
  	}
    return 1;
}


Giving this error
Код:
C:\Users\HP Pavilion 15\Desktop\Mughees\AttDef - 2.6 ®\pawno\lego.pwn(20) : error 001: expected token: "-identifier-", but found "-integer value-"
C:\Users\HP Pavilion 15\Desktop\Mughees\AttDef - 2.6 ®\pawno\lego.pwn(54) : error 017: undefined symbol "mysql_tquery"
C:\Users\HP Pavilion 15\Desktop\Mughees\AttDef - 2.6 ®\pawno\lego.pwn(71) : error 017: undefined symbol "mysql_format"
C:\Users\HP Pavilion 15\Desktop\Mughees\AttDef - 2.6 ®\pawno\lego.pwn(71) : warning 202: number of arguments does not match definition
C:\Users\HP Pavilion 15\Desktop\Mughees\AttDef - 2.6 ®\pawno\lego.pwn(71) : warning 202: number of arguments does not match definition
C:\Users\HP Pavilion 15\Desktop\Mughees\AttDef - 2.6 ®\pawno\lego.pwn(71) : warning 202: number of arguments does not match definition
C:\Users\HP Pavilion 15\Desktop\Mughees\AttDef - 2.6 ®\pawno\lego.pwn(72) : error 017: undefined symbol "mysql_tquery"
C:\Users\HP Pavilion 15\Desktop\Mughees\AttDef - 2.6 ®\pawno\lego.pwn(80) : error 017: undefined symbol "cache_get_row_count"
C:\Users\HP Pavilion 15\Desktop\Mughees\AttDef - 2.6 ®\pawno\lego.pwn(83) : error 017: undefined symbol "cache_get_field_content"
C:\Users\HP Pavilion 15\Desktop\Mughees\AttDef - 2.6 ®\pawno\lego.pwn(107) : error 017: undefined symbol "mysql_format"
C:\Users\HP Pavilion 15\Desktop\Mughees\AttDef - 2.6 ®\pawno\lego.pwn(107) : warning 202: number of arguments does not match definition
C:\Users\HP Pavilion 15\Desktop\Mughees\AttDef - 2.6 ®\pawno\lego.pwn(107) : warning 202: number of arguments does not match definition
C:\Users\HP Pavilion 15\Desktop\Mughees\AttDef - 2.6 ®\pawno\lego.pwn(107) : warning 202: number of arguments does not match definition
C:\Users\HP Pavilion 15\Desktop\Mughees\AttDef - 2.6 ®\pawno\lego.pwn(108) : error 017: undefined symbol "mysql_tquery"
C:\Users\HP Pavilion 15\Desktop\Mughees\AttDef - 2.6 ®\pawno\lego.pwn(119) : error 017: undefined symbol "cache_get_field_content"
C:\Users\HP Pavilion 15\Desktop\Mughees\AttDef - 2.6 ®\pawno\lego.pwn(121) : error 017: undefined symbol "cache_get_field_content"
C:\Users\HP Pavilion 15\Desktop\Mughees\AttDef - 2.6 ®\pawno\lego.pwn(122) : error 017: undefined symbol "cache_get_field_content"
C:\Users\HP Pavilion 15\Desktop\Mughees\AttDef - 2.6 ®\pawno\lego.pwn(172) : error 017: undefined symbol "mysql_format"
C:\Users\HP Pavilion 15\Desktop\Mughees\AttDef - 2.6 ®\pawno\lego.pwn(172) : warning 202: number of arguments does not match definition
C:\Users\HP Pavilion 15\Desktop\Mughees\AttDef - 2.6 ®\pawno\lego.pwn(172) : warning 202: number of arguments does not match definition
C:\Users\HP Pavilion 15\Desktop\Mughees\AttDef - 2.6 ®\pawno\lego.pwn(172 -- 173) : warning 202: number of arguments does not match definition
C:\Users\HP Pavilion 15\Desktop\Mughees\AttDef - 2.6 ®\pawno\lego.pwn(172 -- 174) : warning 202: number of arguments does not match definition
C:\Users\HP Pavilion 15\Desktop\Mughees\AttDef - 2.6 ®\pawno\lego.pwn(172 -- 175) : warning 202: number of arguments does not match definition
C:\Users\HP Pavilion 15\Desktop\Mughees\AttDef - 2.6 ®\pawno\lego.pwn(176) : error 017: undefined symbol "mysql_tquery"
C:\Users\HP Pavilion 15\Desktop\Mughees\AttDef - 2.6 ®\pawno\lego.pwn(189) : error 017: undefined symbol "mysql_format"
C:\Users\HP Pavilion 15\Desktop\Mughees\AttDef - 2.6 ®\pawno\lego.pwn(189) : warning 202: number of arguments does not match definition
C:\Users\HP Pavilion 15\Desktop\Mughees\AttDef - 2.6 ®\pawno\lego.pwn(189) : warning 202: number of arguments does not match definition
C:\Users\HP Pavilion 15\Desktop\Mughees\AttDef - 2.6 ®\pawno\lego.pwn(189) : warning 202: number of arguments does not match definition
C:\Users\HP Pavilion 15\Desktop\Mughees\AttDef - 2.6 ®\pawno\lego.pwn(189) : warning 202: number of arguments does not match definition
C:\Users\HP Pavilion 15\Desktop\Mughees\AttDef - 2.6 ®\pawno\lego.pwn(189) : warning 202: number of arguments does not match definition
C:\Users\HP Pavilion 15\Desktop\Mughees\AttDef - 2.6 ®\pawno\lego.pwn(190) : error 017: undefined symbol "mysql_tquery"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


15 Errors.
Reply
#2

You have the wrong version of the MySQL include and plugin. You need to upgrade to a newer version.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)