25.05.2013, 18:05
(
Последний раз редактировалось Areax; 25.05.2013 в 19:17.
)
Hey!
I made a /makeadmin command and when I type it ingame, then it change the admin level...but if I relog and come back, then is my admin level same as it was.
Code:
Thanks
I made a /makeadmin command and when I type it ingame, then it change the admin level...but if I relog and come back, then is my admin level same as it was.
Code:
pawn Код:
CMD:makeadmin(playerid, params[])
{
new targetid;
new level;
new string[200];
if(gPlayerInfo[playerid][pAdminLevel] < gCommands[MAKEADMIN])return SCM(playerid, COLOR_RED, "[ERROR]: You can't use this command!");
if(sscanf(params, "ui", targetid, level))return SCM(playerid, COLOR_GREY, "[USAGE]: /makeadmin [playerid] [level]");
if(!IsPlayerConnected(targetid))return SCM(playerid, COLOR_RED, "[ERROR]: This player is not connected!");
if(level < 0 || level > 10)return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Invalid Admin Level (0-10)!");
gPlayerInfo[targetid][pAdminLevel] = level;
format(string, sizeof(string), "{80FF00}[Admin]: {0000FF}%s(ID:%d) has changed %s(ID:%d)'s Admin Level to %i!", GetName(playerid), playerid, GetName(targetid), targetid, level);
SCMToAll(COLOR_BLUE, string);
new file[200];
format(file, sizeof(file), PlayerFile, gPlayerInfo[playerid][pName]);
dini_Set(file, "Name", gPlayerInfo[playerid][pName]);
dini_Set(file, "Ip", gPlayerInfo[playerid][pIp]);
dini_IntSet(file, "Registered", gPlayerInfo[playerid][pRegged]);
dini_IntSet(file, "Password", gPlayerInfo[playerid][pPassword]);
dini_IntSet(file, "Admin Level", gPlayerInfo[playerid][pAdminLevel]);
dini_IntSet(file, "Money", GetPlayerMoney(playerid));
dini_IntSet(file, "VIP Level", gPlayerInfo[playerid][pVipLevel]);
dini_IntSet(file, "Score", GetPlayerScore(playerid));
dini_Set(file, "Kills", gPlayerInfo[playerid][pKills]);
dini_Set(file, "Deaths", gPlayerInfo[playerid][pDeaths]);
gPlayerLogged[playerid] = 0;
return 1;
}