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



/setadmin - Trevor Gin - 27.03.2015

Well, I have system /odemote offline remove admin now how i can make it /odemote [playername] [admin level], I need to make it offline set admin
Код:
CMD:odemote(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 9999)
	{
		SendClientMessageEx(playerid, COLOR_WHITE, "{FF0000}ERROR{E3E3E3}: You have insufficient rights to use this certain command!");
		return 1;
	}

	new string[128], query[512], tmpName[MAX_PLAYER_NAME];
	if(isnull(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /odemote [player name]");

	mysql_real_escape_string(params, tmpName);
	SetPVarString(playerid, "OnDemoted", tmpName);

	format(query,sizeof(query),"UPDATE `accounts` SET `AdminLevel` = 0 WHERE `Username`= '%s' AND `AdminLevel` < 99999 AND `AdminLevel` > 0",tmpName);
	mysql_function_query(MainPipeline, query, false, "OnDemoted", "ii", playerid, true);

	format(string,sizeof(string),"Attempting to demote %s's account.",tmpName);
	SendClientMessageEx(playerid,COLOR_YELLOW,string);
	return 1;
}

forward OnDemoted(index);
public OnDemoted(index)
{
	new string[128], name[24];
	GetPVarString(index, "OnDemoted", name, 24);

	if(mysql_affected_rows(MainPipeline)) {
		format(string, sizeof(string), "You have successfully demoted %s's account.", name);
		SendClientMessageEx(index, COLOR_WHITE, string);

		format(string, sizeof(string), "AdmCmd: %s was offline demoted by %s.", name, GetPlayerNameEx(index));
		Log("logs/odemote.log", string);
	}
	else {
		format(string, sizeof(string), "There was an issue with demoting %s's account.", name);
		SendClientMessageEx(index, COLOR_WHITE, string);
	}
	DeletePVar(index, "OnDemoted");

	return 1;
}



Re: /setadmin - Trevor Gin - 27.03.2015

HUUH?


Re: /setadmin - CalvinC - 27.03.2015

Quote:
Originally Posted by ShadeWalker
Посмотреть сообщение
HUUH?
Instead of illegally bumping, tell us what the exact problem is, what are we supposed to help you with?


Re: /setadmin - Trevor Gin - 27.03.2015

I have this System /odemote = offline fired(OFFILINE REMOVE ADMIN) now how i can make it /odemote [playername] [level] set offline admin level to remove


Re: /setadmin - Richie© - 27.03.2015

for one, you are sending 2 values to 'OnDemoted', playerid, true. And your callback is OnDemoted(index);


Re: /setadmin - Trevor Gin - 27.03.2015

What?


Re: /setadmin - Trevor Gin - 27.03.2015

send me it with the new codes please