i need very simple Admin lvls :) 1+ Repotions
#2

Compile as Filterscript and load onto your server:
pawn Код:
#include <a_samp>
new aLevel[MAX_PLAYERS];

public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[256];
    new index;
    cmd = strtok(cmdtext, index);
   
    if(!strcmp(cmd, "/makeadmin", true))
    {
        if(IsPlayerAdmin(playerid) || aLevel[playerid] == 2) // You must be RCon logged or aLevel 2 to make someone an admin
        {
            new param1[256];
            param1 = strtok(cmdtext, index);
            new param2[256];
            param2 = strtok(cmdtext, index);
           
            new player = strval(param1);
            new level = strval(param2);
           
            if(!IsPlayerConnected(player)) return 0;
            if(level < 0 || level > 2) return 0;
           
            aLevel[player] = level;
            SendClientMessage(playerid, 0x00FF00FF, "You have made this player an admin.");
            SendClientMessage(player, 0x00FF00FF, "You are now an admin.");
            return 1;
        }
    }
   
    if(!strcmp(cmd, "/mycommand", true))
    {
        if(aLevel[playerid] == 1)
        {
            // Make your command
        }
    }
    return 0;
}

stock strtok(const string[], &index)
{

    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)