Jump to content
  • 0

Problema leaders


Mister

Question

Problema intalnita (descriere): nu merge comanda /leaders imi da erori la stock
Ero(area / rile) / warning-(ul / urile):

(741) : error 017: undefined symbol "SQL"
(741) : warning 213: tag mismatch
(742) : error 017: undefined symbol "cache_get_data"
(743) : error 017: undefined symbol "cache_delete"
(741) : warning 204: symbol is assigned a value that is never used: "Result"
Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase


3 Errors.
(729) : error 017: undefined symbol "SQL"
(729) : warning 213: tag mismatch
(730) : error 017: undefined symbol "cache_get_data"
(732) : error 017: undefined symbol "cache_get_field_content"
(732) : warning 202: number of arguments does not match definition
(733) : error 017: undefined symbol "cache_delete"
(729) : warning 204: symbol is assigned a value that is never used: "Result"
Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase

Liniile de cod / sursa / script-ul(obligatoriu):

stock GetFactionLeader( FactionID )
{
    new szString[ 128 ], Cache: Result, Get[ 2 ], szLeaderName[ MAX_PLAYER_NAME ];
    format( szString, sizeof( szString ), "SELECT `username` FROM `players` WHERE Leader = %d LIMIT 1;", FactionID );// Aici modifici tu cum ai in baza de date !!
729    Result = mysql_query( SQL, szString );
 730   cache_get_data( Get[ 0 ], Get[ 1 ], SQL );
    if( !Get[ 0 ] ) szLeaderName = "NO-ONE";
732       else cache_get_field_content( 0, "username", szLeaderName, SQL, sizeof( szLeaderName ) );
733    cache_delete( Result );
    return ( szLeaderName );
}
stock GetFactionMembers( FactionID )
{
    new szString[ 128 ], Cache:Result, Get[ 2 ];
    format( szString, sizeof( szString ), "SELECT `Member` FROM `players` WHERE `Member` = %d", FactionID );// Aici modifici tu cum ai in baza de date !!
741    Result = mysql_query( SQL, szString );
 742   cache_get_data( Get[ 0 ], Get[ 1 ], SQL );
 743   cache_delete( Result );
    return Get[ 0 ];
}
  if (strcmp(cmd, "/leaderss", true) == 0)
    {

        new szString[ 1200 ];
format( szString, sizeof( szString ), "{FFFFFF}LSPD - Lider: %sn",  GetFactionLeader(1));
        format( szString, sizeof( szString ), "{FFFFFF}LSPD - Members: %sn",  GetFactionMembers(1));

        ShowPlayerDialog( playerid, 3434, DIALOG_STYLE_MSGBOX, "Lista Factiunilor %d", szString, "Ok", "" );
        return 1;
    }

Imagini / Video (optional):
Ati incercat sa rezolvati singur?: da, dar nu ma pricep prea bine la mysql

Edited by Mister

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

EDIT: 

Mafia. folosesc r5

/*
    SA-MP MySQL plugin R5
    Copyright © 2008-2010, G-sTyLeZzZ
*/

 

 

/*
    SA-MP MySQL plugin R5
    Copyright © 2008-2010, G-sTyLeZzZ
*/

#if defined mysql_included
    #endinput
#endif
#define mysql_included

//Common error codes (http://dev.mysql.com/doc/refman/5.0/en/error-messages-(client|server).html)

#define ER_DBACCESS_DENIED_ERROR 1044
#define ER_ACCESS_DENIED_ERROR 1045
#define ER_UNKNOWN_TABLE 1109
#define ER_SYNTAX_ERROR 1149
#define CR_SERVER_GONE_ERROR 2006
#define CR_SERVER_LOST 2013
#define CR_COMMAND_OUT_OF_SYNC 2014
#define CR_SERVER_LOST_EXTENDED 2055

//Native functions

#define mysql_fetch_row(%1) mysql_fetch_row_format(%1,"|")
#define mysql_next_row() mysql_retrieve_row()
#define mysql_get_field(%1,%2) mysql_fetch_field_row(%2,%1)

native mysql_affected_rows(connectionHandle = 1);
native mysql_close(connectionHandle = 1);
native mysql_connect(const host[],const user[],const database[],const password[]);
native mysql_debug(enable = 1);
native mysql_errno(connectionHandle = 1);
native mysql_fetch_int(connectionHandle = 1);
native mysql_fetch_field(number,dest[],connectionHandle = 1);
native mysql_fetch_field_row(string[],const fieldname[],connectionHandle = 1);
native mysql_fetch_float(&Float:result,connectionHandle = 1);
native mysql_fetch_row_format(string[],const delimiter[] = "|",connectionHandle = 1);
native mysql_field_count(connectionHandle = 1);
native mysql_free_result(connectionHandle = 1);
native mysql_get_charset(destination[],connectionHandle = 1);
native mysql_insert_id(connectionHandle = 1);
native mysql_num_rows(connectionHandle = 1);
native mysql_num_fields(connectionHandle = 1);
native mysql_ping(connectionHandle = 1);
native mysql_query(query[],resultid = (-1),extraid = (-1),connectionHandle = 1);
native mysql_query_callback(index,query[],callback[],extraid = 0,connectionHandle = 1);
native mysql_real_escape_string(const source[],destination[],connectionHandle = 1);
native mysql_reconnect(connectionHandle = 1);
native mysql_reload(connectionHandle = 1);
native mysql_retrieve_row(connectionHandle = 1);
native mysql_set_charset(charset[],connectionHandle = 1);
native mysql_stat(const destination[],connectionHandle = 1);
native mysql_store_result(connectionHandle = 1);
native mysql_warning_count(connectionHandle = 1);

//forward declarations

forward OnQueryFinish(query[], resultid, extraid, connectionHandle);
forward OnQueryError(errorid, error[], resultid, extraid, callback[], query[], connectionHandle);

Edited by Mister

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0

Uite ce se intampla cand actualizez la versiunea mysql r39-2 :|

 

Copypawnoincludesaveacc.inc(478) : error 035: argument type mismatch (argument 1) X 26

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


26 Errors.

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0

Poftim de aici pentru Mysql r5

	if (strcmp(cmd, "/leaders", true) == 0)
 	{
		if(IsPlayerConnected(playerid))
        {
			new LeaderList[ 2028 ];

			new Date[169], pName[30],status, szStatus[ 29 ],LeaderLevel,string3[100];
			mysql_query( "SELECT `Name`, `Leader`, `Status` FROM `players` WHERE Leader> 0 ORDER BY Leader DESC");
			mysql_store_result( );
			while(mysql_fetch_row(Date))
    		{
				sscanf(Date, "p<|>s[24]dd", pName, LeaderLevel, status);
				if( status != 0 ) szStatus = "{0cff00}Online"; 
				else szStatus = "{ff0000}Offline";
			    if(LeaderLevel == 1) string3 = "Police Departament";
				else if(LeaderLevel == 2) string3 = "Factiune";
				else if(LeaderLevel == 3) string3 = "Factiune";
				else if(LeaderLevel == 4) string3 = "Factiune";
				else if(LeaderLevel == 5) string3 = "ETC..";
				printf( "Nume: %s || IDLeader: %d || Status: %s", pName, LeaderLevel, szStatus );
				format(string, sizeof(string), "{8a2be2}%s -{ff9d00} %s - (%s) {ff9d00}n",pName,string3,szStatus);
				strcat(LeaderList, string);
			}
			ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "Leader List", LeaderList , "Close" ,"");
			mysql_free_result( );
		} 
        return 1;
  	}
Link to comment
Share on other sites

  • 0

Nu inteleg. Ce face acel sscanf?

sscanf(Date, "p<|>s[24]dd", ppName, LeaderLevel, status);

Eu nu am comenzi pe sscanf, din cate inteleg trebuie sa scriu gen: /leaders 2 ? pentru a vedea liderii factiunii 2?

Pentru ca eu vreau sa scriu /leaders si sa arate toti liderii.

 

Si la linia acea de mai sus da eroarea asta.

(36173) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
Edited by Mister

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.