/a command aka /admin
#1

I have a code i need edited. Thanks
Код:
	if(strcmp(cmd, "/admin", true) == 0 || strcmp(cmd, "/a", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        new str[160];
		    GetPlayerName(playerid, str, MAX_PLAYER_NAME);
            for (new i = 0; i < MAX_PLAYER_NAME; i++)
            if (str[i] == '_')
            str[i] = ' ';
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
			new result[64];
			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
			{
				result[idx - offset] = cmdtext[idx];
				idx++;
			}
			result[idx - offset] = EOS;
			if(!strlen(result))
			{
				SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: (/a)dmin [admin chat]");
				return 1;
			}
			format(str, sizeof(str), "*%d Admin %s: %s", PlayerInfo[playerid][pAdmin], str, result);
			if (PlayerInfo[playerid][pAdmin] >= 1)
			{
				SendAdminMessage(COLOR_YELLOW, str);
			}
			printf("Admin %s: %s", str, result);
//			AdmincLog(string[]);
		}
		return 1;
	}
I need it so when /a instead of "Level 1340 Admin Luco_Corleone:"
And "Level 1340 Admin Anderson_Matthew:"

it says: "Owner Luco_Corleone:"
& "Owner Anderson_Matthew:"
Reply
#2

Код:
if(strcmp(cmd, "/admin", true) == 0 || strcmp(cmd, "/a", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        new str[160];
		    GetPlayerName(playerid, str, MAX_PLAYER_NAME);
            for (new i = 0; i < MAX_PLAYER_NAME; i++)
            if (str[i] == '_')
            str[i] = ' ';
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
			new result[64];
			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
			{
				result[idx - offset] = cmdtext[idx];
				idx++;
			}
			result[idx - offset] = EOS;
			if(!strlen(result))
			{
				SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: (/a)dmin [admin chat]");
				return 1;
			}
			new arank[64];
		    if(PlayerInfo[playerid][pAdmin] == 1340) { arank = "Owner"; }
			format(str, sizeof(str), "*%s Admin %s: %s", arank, str, result);
			if (PlayerInfo[playerid][pAdmin] >= 1)
			{
				SendAdminMessage(COLOR_YELLOW, str);
			}
			printf("Admin %s: %s", str, result);
//			AdmincLog(string[]);
		}
		return 1;
	}
Reply
#3

A bug,
It says
Owner Admin
Not just owner?
Reply
#4

Can you jsut add all my other ranks to fix it and remove the existing admin thing?
Rank 1 = "New Admin"
Rank 2 = "Admin"
Rank 3 = "High Level Admin"
Rank 4 = "Head Admin"
Rank 1340 = "Owner"
Reply
#5

pawn Код:
if(strcmp(cmd, "/admin", true) == 0 || strcmp(cmd, "/a", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new str[160];
            GetPlayerName(playerid, str, MAX_PLAYER_NAME);
            for (new i = 0; i < MAX_PLAYER_NAME; i++)
            if (str[i] == '_')
                str[i] = ' ';
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[64];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: (/a)dmin [admin chat]");
                return 1;
            }
            new arank[64];
            if(PlayerInfo[playerid][pAdmin] == 1) { arank = "New Admin"; }
            if(PlayerInfo[playerid][pAdmin] == 2) { arank = "Admin"; }
            if(PlayerInfo[playerid][pAdmin] == 3) { arank = "High Level Admin"; }
            if(PlayerInfo[playerid][pAdmin] == 4) { arank = "Head Admin"; }
            if(PlayerInfo[playerid][pAdmin] == 1340) { arank = "Owner"; }
            format(str, sizeof(str), "*%s %s: %s", arank, str, result);
            if (PlayerInfo[playerid][pAdmin] >= 1)
            {
                SendAdminMessage(COLOR_YELLOW, str);
            }
            printf("Admin %s: %s", str, result);
//          AdmincLog(string[]);
        }
        return 1;
    }
Reply
#6

Quote:
Originally Posted by CAR
Посмотреть сообщение
pawn Код:
if(strcmp(cmd, "/admin", true) == 0 || strcmp(cmd, "/a", true) == 0)
    {
        if(IsPlayerConnected(playerid))
            {
                    new str[160];
                    GetPlayerName(playerid, str, MAX_PLAYER_NAME);
                            for (new i = 0; i < MAX_PLAYER_NAME; i++)
                            if (str[i] == '_')
                                    str[i] = ' ';
                    new length = strlen(cmdtext);
                    while ((idx < length) && (cmdtext[idx] <= ' '))
                    {
                idx++;
                    }
                    new offset = idx;
                    new result[64];
                    while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                    {
                result[idx - offset] = cmdtext[idx];
                idx++;
                    }
                    result[idx - offset] = EOS;
                    if(!strlen(result))
                    {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: (/a)dmin [admin chat]");
                return 1;
                    }
                    new arank[64];
                            if(PlayerInfo[playerid][pAdmin] == 1) { arank = "New Admin"; }
                    if(PlayerInfo[playerid][pAdmin] == 2) { arank = "Admin"; }
                    if(PlayerInfo[playerid][pAdmin] == 3) { arank = "High Level Admin"; }
                    if(PlayerInfo[playerid][pAdmin] == 4) { arank = "Head Admin"; }
                    if(PlayerInfo[playerid][pAdmin] == 1340) { arank = "Owner"; }
                    format(str, sizeof(str), "*%s %s: %s", arank, str, result);
            if (PlayerInfo[playerid][pAdmin] >= 1)
                    {
                SendAdminMessage(COLOR_YELLOW, str);
                    }
                    printf("Admin %s: %s", str, result);
//                  AdmincLog(string[]);
        }
            return 1;
    }
Thank you, anyway you can check the tabsizes?
Reply
#7

Yes now i did
Reply
#8

because "if(PlayerInfo[playerid][pAdmin] == 1) { arank = "New Admin"; }"
and "if (PlayerInfo[playerid][pAdmin] >= 1)"
dont look right?
Reply
#9

Yes but that doesn't matter it should work now
Reply
#10

Ok, Thank you so much
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)