SA-MP Forums Archive
[help] Server Unknown command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [help] Server Unknown command (/showthread.php?tid=356691)



[help] Server Unknown command - misticini - 04.07.2012

Why this code return message: server unknown command when i typed it:

Код:
CMD:changepass(playerid, params[])
{
	new string[128], password[256];
   	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(sscanf(params, "s[64]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /changepass [password]");
	if(strlen(params) > 256) return SendClientMessage(playerid, COLOR_GREY, "Password can't be longer than 256 characters.");
	
	WP_Hash(password, sizeof(password), params);
	if(aDuty[playerid])
	{
		MySQLUpdatePlayerStrSingleAdmin(RPNU(playerid),"Password",password);
	}
	else
	{
		MySQLUpdatePlayerStrSingle(PlayerInfo[playerid][pSQLID],"Password",password);
	}
	format(string, sizeof(string), " You have changed your password to: {FF6347}%s", params);
	SendClientMessage(playerid, COLOR_WHITE, string);

	return 1;
}

forward MySQLUpdatePlayerStrSingle(sqlplayerid, sqlvalname[], sqlupdatestr[]);
public MySQLUpdatePlayerStrSingle(sqlplayerid, sqlvalname[], sqlupdatestr[])
{
	new query[128];
	mysql_format(connectionHandle,query, "UPDATE user SET %s='%s' WHERE id=%d", sqlvalname, sqlupdatestr, sqlplayerid);
	mysql_function_query(connection,query,false,"","");
	return 1;
}

forward MySQLUpdatePlayerStrSingleAdmin(pname[], sqlvalname[], sqlupdatestr[]);
public MySQLUpdatePlayerStrSingleAdmin(pname[], sqlvalname[], sqlupdatestr[])
{
	new query[128];
	mysql_format(connectionHandle,query, "UPDATE user SET %s='%s' WHERE AdminName='%s'", sqlvalname, sqlupdatestr, pname);
	mysql_function_query(connectionHandle,query,false,"","");
	return 1;
}



Re: [help] Server Unknown command - misticini - 06.07.2012

Anyone can find a error of this code? I cant find any reason for this error message

Regards