24.01.2017, 08:53
Admin Level HELP !
24.01.2017, 08:54
Give the code of the set admin level command.
24.01.2017, 09:06
24.01.2017, 09:14
Set other guy level 3, and see if script sets to level 3 as well.
24.01.2017, 09:16
Yes...its the same....
With all the levels
With all the levels
24.01.2017, 09:34
I usually only show the right way, wont leave you at the destination:
Look at that ^ (in /setlevel)
Quote:
new key = DB::RetrieveKey(gGlobal[s_usertable], "username", ReturnPlayerName(playerid)); DB::SetIntEntry(gGlobal[s_usertable], key, "admin", level); |
24.01.2017, 10:11
So..what should i do cause im not a scripter...
24.01.2017, 10:20
I got this gamemode from Gamemodes in here.
24.01.2017, 10:24
Код:
CMD:setlevel(playerid, params[]) { //check if the player is a admin LevelCheck(playerid, 5); new target, level; if(sscanf(params, "ui", target, level)) return SendClientMessage(playerid, COLOR_THISTLE, "USAGE: /setlevel [player] [level]"); if(! IsPlayerConnected(target)) return SendClientMessage(playerid, COLOR_FIREBRICK, "ERROR: The specified player is not conected."); if(GetPlayerGAdminLevel(playerid) < GetPlayerGAdminLevel(target)) return SendClientMessage(playerid, COLOR_FIREBRICK, "ERROR: You cannot use this command on higher level admin."); if(level < 0 || level > MAX_ADMIN_LEVELS) return SendClientMessage(playerid, COLOR_FIREBRICK, "ERROR: Invalid level, mus be b/w 0-"#MAX_ADMIN_LEVELS"."); if(level == GetPlayerGAdminLevel(target)) return SendClientMessage(playerid, COLOR_FIREBRICK, "ERROR: Player is already of that level."); new string[144]; if(GetPlayerGAdminLevel(playerid) < level) { GameTextForPlayer(target, "~g~~h~~h~~h~Promoted", 5000, 1); format(string, sizeof(string), "You have been promoted to admin level %i by %s[%i], Congratulation.", level, ReturnPlayerName(playerid), playerid); SendClientMessage(target, COLOR_DODGER_BLUE, string); format(string, sizeof(string), "You have promoted %s[%i] to admin level %i.", ReturnPlayerName(target), target, level); SendClientMessage(playerid, COLOR_DODGER_BLUE, string); } else if(GetPlayerGAdminLevel(playerid) > level) { GameTextForPlayer(target, "~r~~h~~h~~h~Demoted", 5000, 1); format(string, sizeof(string), "You have been demoted to admin level %i by %s[%i], Sorry.", level, ReturnPlayerName(playerid), playerid); SendClientMessage(target, COLOR_DODGER_BLUE, string); format(string, sizeof(string), "You have demoted %s[%i] to admin level %i.", ReturnPlayerName(target), target, level); SendClientMessage(playerid, COLOR_DODGER_BLUE, string); } PlayerPlaySound(target, 1057, 0.0, 0.0, 0.0); PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0); new key = DB::RetrieveKey(gGlobal[s_usertable], "username", ReturnPlayerName(playerid)); DB::SetIntEntry(gGlobal[s_usertable], key, "admin", level); gUser[target][u_admin] = level; return 1; }
24.01.2017, 11:56
Below code should work perfectly fine.
PHP код:
CMD:setlevel(playerid, params[])
{
//check if the player is a admin
LevelCheck(playerid, 5);
new target, level;
if(sscanf(params, "ui", target, level)) return SendClientMessage(playerid, COLOR_THISTLE, "USAGE: /setlevel [player] [level]");
if(! IsPlayerConnected(target)) return SendClientMessage(playerid, COLOR_FIREBRICK, "ERROR: The specified player is not conected.");
if(GetPlayerGAdminLevel(playerid) < GetPlayerGAdminLevel(target)) return SendClientMessage(playerid, COLOR_FIREBRICK, "ERROR: You cannot use this command on higher level admin.");
if(level < 0 || level > MAX_ADMIN_LEVELS) return SendClientMessage(playerid, COLOR_FIREBRICK, "ERROR: Invalid level, mus be b/w 0-"#MAX_ADMIN_LEVELS".");
if(level == GetPlayerGAdminLevel(target)) return SendClientMessage(playerid, COLOR_FIREBRICK, "ERROR: Player is already of that level.");
new string[144];
if(GetPlayerGAdminLevel(playerid) < level)
{
GameTextForPlayer(target, "~g~~h~~h~~h~Promoted", 5000, 1);
format(string, sizeof(string), "You have been promoted to admin level %i by %s[%i], Congratulation.", level, ReturnPlayerName(playerid), playerid);
SendClientMessage(target, COLOR_DODGER_BLUE, string);
format(string, sizeof(string), "You have promoted %s[%i] to admin level %i.", ReturnPlayerName(target), target, level);
SendClientMessage(playerid, COLOR_DODGER_BLUE, string);
}
else if(GetPlayerGAdminLevel(playerid) > level)
{
GameTextForPlayer(target, "~r~~h~~h~~h~Demoted", 5000, 1);
format(string, sizeof(string), "You have been demoted to admin level %i by %s[%i], Sorry.", level, ReturnPlayerName(playerid), playerid);
SendClientMessage(target, COLOR_DODGER_BLUE, string);
format(string, sizeof(string), "You have demoted %s[%i] to admin level %i.", ReturnPlayerName(target), target, level);
SendClientMessage(playerid, COLOR_DODGER_BLUE, string);
}
PlayerPlaySound(target, 1057, 0.0, 0.0, 0.0);
PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
new key = DB::RetrieveKey(gGlobal[s_usertable], "username", ReturnPlayerName(target)); // It was "playerid" should be "target"
DB::SetIntEntry(gGlobal[s_usertable], key, "admin", level);
gUser[target][u_admin] = level;
return 1;
}
« Next Oldest | Next Newest »
Users browsing this thread: 1 Guest(s)