Jump to content

[REZOLVAT] Problema - setadmin


TioO
 Share

Recommended Posts

  • Username : TioO
  • Problema întâlnită: Cum pot sa fac ca sa scrie pe chatul adminilor si helperilor ca i-am setat lui x admin x.
  • Detalii despre problemă: Nu primesc nici-o eroare la compilar. La sethelper am facut ceva asemanator dar nu imi dau seama de ce nu scrie.
  • Ce ai încercat să faci înainte să postezi?: Nimic pentru ca nu imi dau seama ce trebuie sa fac.
  • Cod sursa (recomandat pastebin.com) :  https://pastebin.com/g4mEHs8w
  • Alte detalii : -
Edited by TioO
Link to comment
Share on other sites

function SendAdminHelperMessage(color, string[]) {

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

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

	printf("%s", string);

	return true;
}

 

Link to comment
Share on other sites

8 minutes ago, sNaKe. said:

function SendAdminHelperMessage(color, string[]) {
	foreach(new i: Player) {
		if(PlayerInfo[i][pAdmin] >= 1 && PlayerInfo[i][pHelper] >= 1) {
			SendClientMessage(i, color, string);
		}
	}
	printf("%s", string);
	return 1;
}

 

Multumesc mult! Puteti da T/C pentru ca s-a rezolvat! @Leonard

Edited by TioO
Link to comment
Share on other sites

Acum 30 minute, sNaKe. a spus:

function SendAdminHelperMessage(color, string[]) {
	foreach(new i: Player) {
		if(PlayerInfo[i][pAdmin] >= 1 && PlayerInfo[i][pHelper] >= 1) {
			SendClientMessage(i, color, string);
		}
	}
	printf("%s", string);
	return 1;
}

 

cum cacat sa modifici functia aia care e de 1000 de ori mai buna decat cacatul asta?

Link to comment
Share on other sites

vad ca folosesti gm ul postat de mine, inlocuieste comanda aia cu asta:

YCMD:setadmin(playerid, params[], help) {

	new id, adminlevel, gString[120];

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

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

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

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

	if(PlayerInfo[id][pAdmin] > PlayerInfo[playerid][pAdmin])
		return SendClientMessage(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));
	SendClientMessage(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);

		SCMAf(COLOR_CLIENT, "(( AdmBot: %s a primit remove de la admin level %d de catre: %s. Ne pare rau!", GetName(id), PlayerInfo[id][pAdmin], GetName(playerid));

		Iter_Remove(PlayerAdmins, id);
	}

	if(adminlevel > 0) Iter_Add(PlayerAdmins, id), SCMAf(COLOR_CLIENT, "(( AdmBot: %s a fost promovat la admin level: %d de catre: %s. Felicitari! ))", GetName(id), adminlevel, GetName(playerid));

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

	new gQuery[180];

	if(adminlevel >= 1) 
		format(gQuery, sizeof(gQuery), "UPDATE users SET `Admin`='%d', `Security`='%s', `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, "", "");
	SetPVarInt(id, "SecurityPlayer", 0);

	return true;
} 

aia are un bug la iteratori.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...