Am incercat sa fac comanda '/makeadmin' pe dialog(adica:scrii '/makeadmin <part of name/id> si iti apare o list cu nivelele de admin pe care i le poti da playerului respectiv), dar, imi seteaza mie nivelul de admin, si habar n-am cum sa-l fac sa seteze nivelul altui player.. sper ca ma intelegeti.
Am /makeadmin, asa:
Iar eu am incercat asa:
Am /makeadmin, asa:
HTML Code:
CMD:makeadmin(playerid, params[])
{
if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] >= 6)
{
new id,adminlevel,sendername[30],giveplayer[30],string[200];
if(sscanf(params, "ui",id,adminlevel)) return SendClientMessage(playerid, 0xFFFFFFFF, "{B8DBFF}Syntax: /makeadmin <Name/Playerid> <Admin Level>");
if(IsPlayerConnected(id))
{
if(id != INVALID_PLAYER_ID)
{
GetPlayerName(id, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[id][pAdmin] = adminlevel;
PlayerInfo[id][pChar] = 217;
SetPlayerSkin(id, 217);
printf("AdmCmd: %s has promoted %s to a level %d admin.", sendername, giveplayer, adminlevel);
format(string, sizeof(string), "You have been promoted to a level %d admin by %s.", adminlevel, sendername);
SendClientMessage(id, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "You have promoted %s to a level %d admin.", giveplayer,adminlevel);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "{f03337}Warning: Admin %s has set %s to a level %d admin.", sendername,giveplayer,adminlevel);
ABroadCast(COLOR_WHITE,string,4);
new wakaname[25];
GetPlayerName(id,wakaname,25);
new str[256];
format(str,256,"UPDATE users SET `Admin`='%d',`CChar`='%d' WHERE `name`='%s'",PlayerInfo[id][pAdmin],PlayerInfo[id][pChar],wakaname);
mysql_query(SQL,str);
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: Player not connected.");
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, AdminOnly);
}
}
return 1;
}
HTML Code:
CMD:dialogma(playerid, params[])
{
if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] >= 6)
{
new id,adminlevel,sendername[30],giveplayer[30],string[200];
if(sscanf(params, "ui",id)) return SendClientMessage(playerid, 0xFFFFFFFF, "{B8DBFF}Syntax: /makeadmin <Name/Playerid>");
if(IsPlayerConnected(id))
{
if(id != INVALID_PLAYER_ID)
{
ShowPlayerDialog(playerid,DIALOG_MAKEADMIN,DIALOG_STYLE_LIST, "MakeAdmin:", "Level1\nLevel2\nLevel3", "Select", "");
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: Player not connected.");
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, AdminOnly);
}
}
return 1;
}
// Dialog:
if(dialogid == DIALOG_MAKEADMIN)
{
if(response)
{
if(listitem == 0)
{
PlayerInfo[playerid][pAdmin] = 1;
}
if(listitem == 1)
{
PlayerInfo[playerid][pAdmin] = 2;
}
}
if(listitem == 2)
{
PlayerInfo[playerid][pAdmin] = 3;
}
}
}
return 1;
}
Aucun commentaire:
Enregistrer un commentaire