Admin script
#1

How do i fix these errors

Код:
D:\Users\Tanush\Desktop\SA-MP\filterscripts\admin.pwn(36) : warning 201: redefinition of constant/macro (symbol "COLOR_SEAGREEN")
D:\Users\Tanush\Desktop\SA-MP\filterscripts\admin.pwn(54) : error 017: undefined symbol "strtok"
D:\Users\Tanush\Desktop\SA-MP\filterscripts\admin.pwn(54) : error 033: array must be indexed (variable "cmd")
D:\Users\Tanush\Desktop\SA-MP\filterscripts\admin.pwn(63) : error 017: undefined symbol "strtok"
D:\Users\Tanush\Desktop\SA-MP\filterscripts\admin.pwn(63) : error 033: array must be indexed (variable "tmp")
D:\Users\Tanush\Desktop\SA-MP\filterscripts\admin.pwn(71) : error 017: undefined symbol "strtok"
D:\Users\Tanush\Desktop\SA-MP\filterscripts\admin.pwn(71) : error 033: array must be indexed (variable "tmp")
D:\Users\Tanush\Desktop\SA-MP\filterscripts\admin.pwn(82) : warning 217: loose indentation
D:\Users\Tanush\Desktop\SA-MP\filterscripts\admin.pwn(53) : warning 203: symbol is never used: "idx"
D:\Users\Tanush\Desktop\SA-MP\filterscripts\admin.pwn(53 -- 97) : warning 209: function "OnPlayerCommandText" should return a value
D:\Users\Tanush\Desktop\SA-MP\filterscripts\admin.pwn(114) : error 017: undefined symbol "IsNumeric"
D:\Users\Tanush\Desktop\SA-MP\filterscripts\admin.pwn(154) : warning 203: symbol is never used: "OnPlayerConnect"
, THE RED ONE!!


pawn Код:
#include <a_samp>

//Colours//
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_BLUE 0x0000BBAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_RED 0xAA3333AA
#define COLOR_LIME 0x10F441AA
#define COLOR_MAGENTA 0xFF00FFFF
#define COLOR_NAVY 0x000080AA
#define COLOR_AQUA 0xF0F8FFAA
#define COLOR_CRIMSON 0xDC143CAA
#define COLOR_FLBLUE 0x6495EDAA
#define COLOR_BISQUE 0xFFE4C4AA
#define COLOR_BLACK 0x000000AA
#define COLOR_CHARTREUSE 0x7FFF00AA
#define COLOR_BROWN 0XA52A2AAA
#define COLOR_CORAL 0xFF7F50AA
#define COLOR_GOLD 0xB8860BAA
#define COLOR_GREENYELLOW 0xADFF2FAA
#define COLOR_INDIGO 0x4B00B0AA
#define COLOR_IVORY 0xFFFF82AA
#define COLOR_LAWNGREEN 0x7CFC00AA
#define COLOR_SEAGREEN 0x20B2AAAA
#define COLOR_LIMEGREEN 0x32CD32AA //<--- Dark lime
#define COLOR_MIDNIGHTBLUE 0X191970AA
#define COLOR_MAROON 0x800000AA
#define COLOR_OLIVE 0x808000AA
#define COLOR_ORANGERED 0xFF4500AA
#define COLOR_PINK 0xFFC0CBAA // - Light light pink
#define COLOR_SEAGREEN 0x2E8B57AA
#define COLOR_SPRINGGREEN 0x00FF7FAA
#define COLOR_TOMATO 0xFF6347AA // - Tomato >:/ sounds wrong lol... well... :P
#define COLOR_YELLOWGREEN 0x9ACD32AA //- like military green
#define COLOR_MEDIUMAQUA 0x83BFBFAA
#define COLOR_MEDIUMMAGENTA 0x8B008BAA // dark magenta ^^
//colours//


enum Info
{
   AdminLevel,
}
new PlayerInfo[MAX_PLAYERS][Info];

public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256], idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/makeadmin", true) == 0)
{
       new string[128];
       new tmp[256];
       new player[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME];
       new giveplayerid;
       if (IsPlayerAdmin(playerid))
       {
               tmp = strtok(cmdtext, idx);
               if(!strlen(tmp))
               {
                       SendClientMessage(playerid, 0xFF9900AA, "USAGE: /makeadmin [playerid] [level]");
                       SendClientMessage(playerid, 0xFF9900AA, "FUNCTION: Player will be an admin.");
                       return 1;
               }
               giveplayerid = ReturnUser(tmp);
               tmp = strtok(cmdtext, idx);
               new level = strval(tmp);
               if(giveplayerid != INVALID_PLAYER_ID)
               {
                       GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                       GetPlayerName(playerid, player, sizeof(player));
                       PlayerInfo[giveplayerid][AdminLevel] = level;
                       printf("Admin %s made %s a level %d admin.", player, giveplayer, level);
                       format(string, sizeof(string), "You are now an administrator level %d thanks to %s.", level,  player);
                       SendClientMessage(giveplayerid, 0x00C2ECFF, string);
                       format(string, sizeof(string), "You have given %s level %d admin.",  giveplayer,PlayerInfo[giveplayerid][AdminLevel]);
                               SendClientMessage(playerid, 0x00C2ECFF, string);
               }
               else if(giveplayerid == INVALID_PLAYER_ID)
               {
                       format(string, sizeof(string), "%i is not an active player.", giveplayerid);
                       SendClientMessage(playerid, 0xE60000FF, string);
               }
       }
       else
       {
           SendClientMessage(playerid, 0xE60000FF, "You are not a lead admin!");
       }
       return 1;
}

}

OnPlayerConnect(playerid)
{
    PlayerInfo[playerid][AdminLevel] = 0;
    return 1;
}

ReturnUser(text[], playerid = INVALID_PLAYER_ID)
{
    new pos = 0;
    while (text[pos] < 0x21)
    {
        if (text[pos] == 0) return INVALID_PLAYER_ID;
        pos++;
    }
    new userid = INVALID_PLAYER_ID;
    if (IsNumeric(text[pos]))
    {
        userid = strval(text[pos]);
        if (userid >=0 && userid < MAX_PLAYERS)
        {
            if(!IsPlayerConnected(userid))
                userid = INVALID_PLAYER_ID;
            else return userid;
        }
    }
    new len = strlen(text[pos]);
    new count = 0;
    new pname[MAX_PLAYER_NAME];
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {
            GetPlayerName(i, pname, sizeof (pname));
            if (strcmp(pname, text[pos], true, len) == 0)
            {
                if (len == strlen(pname)) return i;
                else
                {
                    count++;
                    userid = i;
                }
            }
        }
    }
    if (count != 1)
    {
        if (playerid != INVALID_PLAYER_ID)
        {
            if (count) SendClientMessage(playerid, COLOR_YELLOW, "There are multiple users, enter full playername.");
            else SendClientMessage(playerid, COLOR_RED, "Playername not found.");
        }
        userid = INVALID_PLAYER_ID;
    }
    return userid;
}
Reply
#2

http://pastebin.com/TqkanCYq

not tested
Reply
#3

dude... THANK YOU MAN!!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)