05.12.2009, 21:29
I am trying to make it so that when i /giveadmin a account it saves it in there user file, but i cant seem to link the command to the user file
i tried putting in
like in the register and login but thats not working, it doesnt change the admin level of the player when i do it
full command i got so far is
i tried putting in
pawn Код:
new file[256];
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(string), "\\Users\\%s.ini", pname);
dini_IntSet(file, "level", admlvl);
full command i got so far is
pawn Код:
dcmd_giveadmin(playerid, cmdtext[])
{
new idx;
new tmp[256];
new string[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_RED, "USAGE: /giveadmin [playerid/PartOfName] [level(1-4)]");
return 1;
}
new sendername[MAX_PLAYER_NAME];
new giveplayer[MAX_PLAYER_NAME];
new para1;
new admlvl;
if(IsStringAName(tmp))
{
para1 = GetPlayerID(tmp);
}
else
{
para1 = strval(tmp);
}
tmp = strtok(cmdtext, idx);
admlvl = strval(tmp);
if(level[playerid] >= 4)
{
new file[256];
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(string), "\\Users\\%s.ini", pname);
dini_IntSet(file, "level", admlvl);
GetPlayerName(para1, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
printf("AdmCmd: %s has promoted %s to a level %d admin.", sendername, giveplayer, admlvl);
format(string, sizeof(string), " You have been promoted to a level %d admin by %s", admlvl, sendername);
SendClientMessage(para1, COLOR_RED, string);
format(string, sizeof(string), " You have promoted %s to a level %d admin.", giveplayer,admlvl);
SendClientMessage(playerid, COLOR_RED, string);
}
else
{
SendClientMessage(playerid, COLOR_RED, " you are not authorized to use that command!");
}
return 1;
}