ERRORS
#1

Can someone to solve this errors?

Gm:
Код:
//Include
#include <a_mysql>
#include <a_samp>
#include <zcmd>

//Define
//MYSQL
#define MYSQL_HOST	"127.0.0.1"
#define MYSQL_USER	"server_403"
#define MYSQL_DB	"server_403_database"
#define MYSQL_PASS 	"07062003"
//culori
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_BLUE 0x0000BBAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_RED 0xAA3333AA
#define COLOR_LIME 0x10F441AA
#define COLOR_MAGENTA 0xFF00FFFF
#define COLOR_NAVY 0x000080AA
#define COLOR_AQUA 0xF0F8FFAA
#define COLOR_CRIMSON 0xDC143CAA
#define COLOR_FLBLUE 0x6495EDAA
#define COLOR_BISQUE 0xFFE4C4AA
#define COLOR_BLACK 0x000000AA
#define COLOR_CHARTREUSE 0x7FFF00AA
#define COLOR_BROWN 0XA52A2AAA
#define COLOR_CORAL 0xFF7F50AA
#define COLOR_GOLD 0xB8860BAA
#define COLOR_GREENYELLOW 0xADFF2FAA
#define COLOR_INDIGO 0x4B00B0AA
#define COLOR_IVORY 0xFFFF82AA
#define COLOR_LAWNGREEN 0x7CFC00AA
#define COLOR_LIMEGREEN 0x32CD32AA //<--- Dark lime
#define COLOR_MIDNIGHTBLUE 0X191970AA
#define COLOR_MAROON 0x800000AA
#define COLOR_OLIVE 0x808000AA
#define COLOR_ORANGERED 0xFF4500AA
#define COLOR_PINK 0xFFC0CBAA // - Light light pink
#define COLOR_SEAGREEN 0x2E8B57AA
#define COLOR_SPRINGGREEN 0x00FF7FAA
#define COLOR_TOMATO 0xFF6347AA // - Tomato >:/ sounds wrong lol... well... :P
#define COLOR_YELLOWGREEN 0x9ACD32AA //- like military green
#define COLOR_MEDIUMAQUA 0x83BFBFAA
#define COLOR_MEDIUMMAGENTA 0x8B008BAA // dark magenta ^^
//maxplayers
#undef MAX_PLAYERS
#define MAX_PLAYERS 20
//Console
main()
{
	print("\n----------------------------------");
	print(" Serverul Ascardia a fost pornit!");
	print("----------------------------------\n");
}
//Variabile jucatori
enum pInfo
{
	pName[MAX_PLAYER_NAME],
	Password[32],
	pAdmin,
	pMoney
};
new PlayerInfo[MAX_PLAYERS][pInfo];
new AccountExists[MAX_PLAYERS];
new PlayerLogged[MAX_PLAYERS];

//Functii

stock ConnectMySQL()
	{
	if(mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_DB, MYSQL_PASS))
	    print("[MySQL] Baza de date a fost conectata cu succes!");

	else
	    print("[MySQL] Nu am reusit sa ma conectez la baza de date!");
}

stock explode(const sSource[], aExplode[][], const sDelimiter[] = " ", iVertices = sizeof aExplode, iLength = sizeof aExplode[]) // Created by Westie
{
	new
		iNode,
		iPointer,
		iPrevious = -1,
		iDelimiter = strlen(sDelimiter);

	while(iNode < iVertices)
	{
		iPointer = strfind(sSource, sDelimiter, false, iPointer);

		if(iPointer == -1)
		{
			strmid(aExplode[iNode], sSource, iPrevious, strlen(sSource), iLength);
			break;
		}
		else
		{
			strmid(aExplode[iNode], sSource, iPrevious, iPointer, iLength);
		}

		iPrevious = (iPointer += iDelimiter);
		++iNode;
	}
	return iPrevious;
}
stock RegisterPlayer(playerid, password[])
{
	if(AccountExists[playerid])
		return SendClientMessage(playerid, COLOR_RED, "[ACCOUNT] You're already registered!");

 	if(PlayerLogged[playerid])
		return SendClientMessage(playerid, COLOR_RED, "[ACCOUNT] You're already logged in!");

	if(strlen(password) < 3 || strlen(password) >= 32)
		return SendClientMessage(playerid, COLOR_RED, "[ACCOUNT] Your password is too short or too long!");

	CheckMySQL();

	new string[128];
	format(string, sizeof(string), "INSERT INTO Users (Name,Password) VALUES ('%s','%s')", PlayerInfo[playerid][pName], password);
	mysql_query(string);

    	AccountExists[playerid] = 1;
	SendClientMessage(playerid, COLOR_YELLOW, "[ACCOUNT] Your account has been created, please login now!");

	LoginPlayer(playerid, password);
	return 1;
}

stock LoginPlayer(playerid, password[])
{
	if(!AccountExists[playerid])
		return SendClientMessage(playerid, COLOR_RED, "[ACCOUNT] You're not registered!");

	if(PlayerLogged[playerid])
	    	return SendClientMessage(playerid, COLOR_RED, "[ACCOUNT] You're already logged in!");

 	if(strlen(password) < 3 || strlen(password) >= 32)
	    	return SendClientMessage(playerid, COLOR_RED, "[ACCOUNT] Your password is too short or too long!");

	CheckMySQL();

    	new string[128];
	format(string, sizeof(string), "SELECT * FROM Users WHERE Name = '%s' AND Password = '%s'", PlayerInfo[[playerid][Name], password);
	mysql_query(string);
	mysql_store_result();

	if(!mysql_num_rows())
		return SendClientMessage(playerid, COLOR_RED, "[ACCOUNT] Incorrect password!");

	new row[128]; // The length of 1 'row' total.
	new field[4][32]; // [4] = Amount of fields, [24] = Max length of the bigest field.

	mysql_fetch_row_format(row, "|");
	explode(row, field, "|");
	mysql_free_result();

	// The field starts here with 1, because the field 'Name' = 0, and we already have the name in a variable.
	format(PlayerInfo[[playerid][Password], 32, "%s", field[1]);
 	PlayerInfo[[playerid][Admin] = strval(field[2]);
 	PlayerInfo[[playerid][Money] = strval(field[3]);

 	GivePlayerMoney(playerid, PlayerInfo[[playerid][Money]);


	format(string, sizeof(string), "[ACCOUNT] Welcome back %s, you are now logged in!", PlayerInfo[[playerid][Name]);
    	SendClientMessage(playerid, COLOR_YELLOW, string);

    	PlayerLogged[playerid] = 1;
    	return 1;
}

stock SavePlayer(playerid)
{
	if(!PlayerLogged[playerid])
		return 0;

    	PlayerInfo[[playerid][Money] = GetPlayerMoney(playerid);


stock CheckMySQL();

    new string[256];
    format(string, sizeof(string), "UPDATE Users SET Password='%s',Admin='%d',Money='%d' WHERE Name='%s'", PlayerInfo[[playerid][Password], PlayerInfo[[playerid][Admin], PlayerInfo[[playerid][Money], PlayerInfo[[playerid][Name]);
    mysql_query(string);
    return 1;
}
stock CheckMySQL()
{
	if(mysql_ping() == -1)
		mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_DB, MYSQL_PASS);
}
stock CheckAccountExists(account[])
{
	new string[128];
    	format(string, sizeof(string), "SELECT * FROM Users WHERE Name = '%s'", account);
    	mysql_query(string);

	mysql_store_result();

	new value;
	value = mysql_num_rows();
	mysql_free_result();
	return value;
}

//public-uri

public OnGameModeInit()
{
    ConnectMySQL()
	SetGameModeText("Ascardia");
	AddPlayerClass(250,1801.3937,-1864.3235,13.5740,2.3498,0,0,0,0,0,0); //
	AddPlayerClass(250,1801.3937,-1864.3235,13.5740,2.3498,0,0,0,0,0,0); //
	AddPlayerClass(250,1801.3937,-1864.3235,13.5740,2.3498,0,0,0,0,0,0); //
	AddPlayerClass(250,1801.3937,-1864.3235,13.5740,2.3498,0,0,0,0,0,0); //
	AddPlayerClass(250,1801.3937,-1864.3235,13.5740,2.3498,0,0,0,0,0,0); //
	AddPlayerClass(250,1801.3937,-1864.3235,13.5740,2.3498,0,0,0,0,0,0); //
	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerConnect(playerid)
{
	GetPlayerName(playerid, PlayerInfo[[playerid][Name], MAX_PLAYER_NAME);

	if(CheckAccountExists(PlayerInfo[[playerid][Name])) AccountExists[playerid] = 1;
	else AccountExists[playerid] = 0;
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	SavePlayer(playerid);

	PlayerInfo[[playerid][pAdmin] = 0;
	PlayerInfo[[playerid][pMoney] = 0;
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	//Comenzi Jucatori
command:register(playerid, params[])
{
	RegisterPlayer(playerid, params);
	return 1;
}

command:login(playerid, params[])
{
	LoginPlayer(playerid, params);
	return 1;
}
Errors:

Код:
C:\Users\Sorin\Desktop\GM BigZone edited by Ainox\gamemodes\BlankGamemode.pwn(125) : error 035: argument type mismatch (argument 1)
C:\Users\Sorin\Desktop\GM BigZone edited by Ainox\gamemodes\BlankGamemode.pwn(146) : warning 217: loose indentation
C:\Users\Sorin\Desktop\GM BigZone edited by Ainox\gamemodes\BlankGamemode.pwn(147) : warning 217: loose indentation
C:\Users\Sorin\Desktop\GM BigZone edited by Ainox\gamemodes\BlankGamemode.pwn(147) : error 029: invalid expression, assumed zero
C:\Users\Sorin\Desktop\GM BigZone edited by Ainox\gamemodes\BlankGamemode.pwn(147) : warning 215: expression has no effect
C:\Users\Sorin\Desktop\GM BigZone edited by Ainox\gamemodes\BlankGamemode.pwn(147) : error 001: expected token: ";", but found "]"
C:\Users\Sorin\Desktop\GM BigZone edited by Ainox\gamemodes\BlankGamemode.pwn(147) : error 029: invalid expression, assumed zero
C:\Users\Sorin\Desktop\GM BigZone edited by Ainox\gamemodes\BlankGamemode.pwn(147) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
.
Reply
#2

public OnPlayerConnect(playerid)
{
GetPlayerName(playerid, PlayerInfo[[playerid][Name], MAX_PLAYER_NAME);

if(CheckAccountExists(PlayerInfo[[playerid][Name])) AccountExists[playerid] = 1;
else AccountExists[playerid] = 0;
return 1;
}

this is wrong, I think, check all


Modify all those rows that have this.
Reply
#3

Script uses mysql version R6-2 and you downloaded version R33+

You got 2 options:
• Download the outdated version R6-2 and get no support in case of server crashes related on mysql functions.
• Use latest version and update whole script.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)