Makeadmin help
#7

Quote:
Originally Posted by JXF
Посмотреть сообщение
I cannot find a script with zcmd which I can understand properly.
Then keep that script since you understand it properly but optimize it.
strtok and ReturnUser are very old and slow methods. sscanf is what you need!

"r" specifier is for "ID/Part Of Name" to players only ("u" includes NPCs too).
Assuming giveplayer, sendername and string have been declared in OnPlayerCommandText callback and they're not globals (I've them as local).

Last, but that's personal opinion only - having up to 1338 admin level is a bit ridiculous. 1-5 or even 1-10 seems acceptable.

PHP код:
CMD:makeadmin(playeridparams[])
{
    if (!
PlayerInfo[playerid][pAdmin] && !IsPlayerAdmin(playerid)) return SendClientMessage(playeridCOLOR_GRAD1"{09F7DF}DENIED: {ffffff}No access");
    new 
para1level;
    if (
sscanf(params"ri"para1level)) return SendClientMessage(playeridCOLOR_GRAD2"{00E6FF}UTILIZARE:{FFFFFF} /makeadmin [IDJucator/ParteDinNume] [level(1-1338)]");
    if (
para1 == INVALID_PLAYER_ID) return SendClientMessage(playeridCOLOR_GRAD1"Invalid player");
    if (!(
<= level <= 1338)) return SendClientMessage(playeridCOLOR_GRAD1"Invalid level. It must be between 1 and 1338");
    new 
giveplayer[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], string[144];
    
GetPlayerName(para1giveplayersizeof(giveplayer));
    
GetPlayerName(playeridsendernamesizeof(sendername));
    
PlayerInfo[para1][pAdmin] = level;
    
printf("AdmWarning: %s has promoted %s to a level %d admin."sendernamegiveplayerlevel);
    
format(stringsizeof(string), "   You have been promoted to a level %d admin by %s"levelsendername);
    
SendClientMessage(para1COLOR_LIGHTBLUEstring);
    
format(string128"{D11515}[AdmWarning]: {FF9203}%s {FFFFFF}has set {FF9203}%s {FFFFFF}to a level {FF9203}%d {FFFFFF}admin."sendernamegiveplayerlevel);
    
ABroadCast(COLOR_YELLOWstring5);
    return 
1;

Reply


Messages In This Thread
Makeadmin help - by JXF - 22.05.2016, 12:51
Re: Makeadmin help - by MBilal - 22.05.2016, 12:56
Re: Makeadmin help - by iKevin - 22.05.2016, 12:58
Re: Makeadmin help - by JXF - 22.05.2016, 13:43
Re: Makeadmin help - by MBilal - 22.05.2016, 13:59
Re: Makeadmin help - by J0sh... - 22.05.2016, 14:18
Re: Makeadmin help - by Konstantinos - 22.05.2016, 14:18
Re: Makeadmin help - by JXF - 22.05.2016, 14:32
Re: Makeadmin help - by CSLangdale - 22.05.2016, 16:28
Re: Makeadmin help - by Konstantinos - 22.05.2016, 17:19

Forum Jump:


Users browsing this thread: 1 Guest(s)