SA-MP Forums Archive
Makeadmin error - 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: Makeadmin error (/showthread.php?tid=665476)



Makeadmin error - Mondialw98 - 05.04.2019

This is the "makeadmin" command! But me is not showing "X was changed the admin level to Y "
This is the command that anyting wrong is "format(gString, 100, "AdmCmd: %s i-a setat lui %s admin level %d.", GetName(playerid), GetName(id), adminlevel);"
Code:
YCMD:setadmin(playerid, params[], help) {

	new id, adminlevel, gString[120];

	if(PlayerInfo[playerid][pAdmin] < 6)
		return SCM(playerid, COLOR_WHITE, AdminOnly);

	if(sscanf(params, "ui", id, adminlevel))
		return SCM(playerid, COLOR_GREY, "USAGE: {FFFFFF}/setadmin <playerid/name> <Admin Level>");

	if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID)
		return SCM(playerid, COLOR_GREY, "Acel player nu este conectat.");

	if(adminlevel < 0 || adminlevel > 6)
		return SCM(playerid, COLOR_GREY, "Invalid admin level. 0-6");

	if(PlayerInfo[id][pAdmin] > PlayerInfo[playerid][pAdmin])
		return SCM(playerid, COLOR_GREY, "Nu poti folosi aceasta comanda pe acel player. Are admin level mai mare.");

	format(gString, 80, "Ai fost promovat la admin %d de %s", adminlevel, GetName(playerid));
	SCM(id, COLOR_LIGHTBLUE, gString);

	format(gString, 100, "AdmCmd: %s i-a setat lui %s admin level %d.", GetName(playerid), GetName(id), adminlevel);
	SendAdminHelperMessage(COLOR_LOGS, gString);

	if(adminlevel == 0) {
		PlayerInfo[id][pAW] = 0;
		UpdateVar(id, "AW", 0);
		SpecFaction[id] = 0;
		StopFly(playerid);
		UsedFly[playerid] = 0;
		SetPlayerHealthEx(playerid, 100);

		Iter_Remove(PlayerAdmins, id);
	}

	Iter_Add(PlayerAdmins, id);

	finishAchievement(id, 27);
	PlayerInfo[id][pAdmin] = adminlevel;

	new gQuery[180];

	if(adminlevel >= 1)
		format(gQuery, sizeof(gQuery), "UPDATE users SET `Admin`='%d', `HelpedPlayers`='0' WHERE `ID`='%d'", PlayerInfo[id][pAdmin]/*, MD5_Hash(DEFAULT_PASSWORD)*/, PlayerInfo[id][pSQLID]);
	else
		UpdateVar(id, "Admin", PlayerInfo[id][pAdmin]);
	mysql_tquery(SQL, gQuery, "", "");

	return true;
}



Re: Makeadmin error - polygxn - 05.04.2019

There is a problem with the SendAdminHelperMessage Im pretty sure. Give us the function itself.


Re: Makeadmin error - Mondialw98 - 05.04.2019

Code:
function SendAdminHelperMessage(color, string[]) {

	foreach(PlayerAdmins, i)
		SCM(i, color, string);

	foreach(PlayerHelpers, i)
		SCM(i, color, string);

	printf("%s", string);

	return true;
}



Re: Makeadmin error - CONTROLA - 05.04.2019

Do you add an admin to the PlayerAdmins iterator when you make them an admin? You add them with Iterator_Add(PlayerAdmins, playerid)


Re: Makeadmin error - JoshBrown - 06.04.2019

Is the problem solved?