Problem with SSCANF
#1

The problem is that is not pass the syntax

Код:
forward Warn(playerid,params[]);
public Warn(playerid,params[])
{
	new rows,fields,targetid,motiv[129],warn_query_select[128];
	cache_get_data(rows, fields, conn_handler);
	cache_get_row(0, 23, player_warns, conn_handler);
	cache_get_row(0, 12, adminlevel, conn_handler);
	
	PlayerInfo[playerid][pWarns] = strval(player_warns);
	PlayerInfo[playerid][pAdminLevel] = strval(adminlevel);
	
	printf("admin level: %i", PlayerInfo[playerid][pAdminLevel]);

	if(PlayerInfo[playerid][pLogged] == 1)
	{
		printf("admin level in comanda: %i", PlayerInfo[playerid][pAdminLevel]);
		
		if(PlayerInfo[playerid][pAdminLevel] >= 2)
		{
			if(sscanf(params, "us[128]", targetid, motiv))
			{
				SCM(playerid,0xFF0000C8,"Utilizare: {FFFFFF} [playerid/name] [motiv]");
			}
			else
			{	
				if(!IsPlayerConnected(targetid))
				{
					SCM(playerid,0xFF0000C8,"[INDUNGI] {FFFFFF} Acest player nu este online!");
				}
				else
				{
					mysql_format(conn_handler, warn_query,"UPDATE `users` SET `pWarns` = '%i' WHERE `username` ='%s' ",PlayerInfo[playerid][pWarns]+1,GetName(playerid));
					mysql_function_query(conn_handler , warn_query, true, "Update_warn", "", "");
					format(warn_receive,sizeof(warn_receive),"Ai primit warn pentru %s !", motiv[128]);
					SCM(targetid,0xFFFFFFC8,warn_receive);
				}
			}
		}
		else
		{
			SCM(playerid,0xFF0000C8,"[INDUNGI] {FFFFFF} Nu ai acces la aceasta comanda!");
		}
	}
	else
	{
		SCM(playerid,0xFF0000C8,"[INDUNGI] {FFFFFF} Trebuie sa fi logat pentru a folosii comenzile!");
	}
}

COMMAND:warn(playerid)
{	
	mysql_format(conn_handler ,warn_query_select,"SELECT * FROM users WHERE username = '%s'", GetName(playerid));
	mysql_function_query(conn_handler , warn_query_select, true, "Warn", "", "");
	
	return 1;
}
Reply
#2

Try setting it to "us[129]" instead.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)