Help with /makeadmin
#1

hi guys i would like to ask you why level isnt identified here:

Код:
dcmd_makeadmin(playerid, params[])
{
    if(gPlayerInfo[playerid][PLAYER_ADMIN] < 5)
    {
        SendClientMessage(playerid, COLOR_RED, "You must be an Owner to use that command!");
    }
    else
    {
        new tmp[256], tmp2[256], index, id;
        tmp = strtok(params, index);
        tmp2 = strtok(params, index);

        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_ORANGE, "[MAKEADMIN] Usage: /makeadmin [ID] [LEVEL]");
        }
		else if(!strlen(tmp2))
		{
            SendClientMessage(playerid, COLOR_ORANGE, "[MAKEADMIN] Usage: /makeadmin [ID] [LEVEL]");
		}
		else
		{
			id = strval(tmp);
			level = strval(tmp2);
            if(!IsPlayerConnected(id))
            {
                SendClientMessage(playerid, COLOR_ORANGE, "[MAKEEADMIN] That player is not connected.");
            }
            else if(id == playerid)
            {
                SendClientMessage(playerid, COLOR_ORANGE, "[MAKEADMIN] You are allready admin!.");
			}
            else if(level > 5 || level < 1)
            {
				SendClientMessage(playerid, COLOR_ORANGE, "You typed an invalid level!, (Valid levels: 1-5)");
            }
            else
            {
                level = strval(tmp2);
				new str[64];
                format(str, sizeof(str), "Felicitaciones, usted ha recibido el nivel de administraciуn: %d", level);
				SendClientMessage(id, COLOR_LIGHTBLUE, str);
                new str2[128];
                format(str2,sizeof(str2), PlayerFile, gPlayerInfo[playerid][PLAYER_NAME], level);
				dini_IntSet(str2, "Admin", %d, level);
            }
        }
    }
    return 1;
}
Im getting these errors:

Код:
C:\Users\Carlos\Desktop\Roleplay\filterscripts\Admin.pwn(577) : error 017: undefined symbol "level"
C:\Users\Carlos\Desktop\Roleplay\filterscripts\Admin.pwn(586) : error 017: undefined symbol "level"
C:\Users\Carlos\Desktop\Roleplay\filterscripts\Admin.pwn(592) : error 017: undefined symbol "level"
C:\Users\Carlos\Desktop\Roleplay\filterscripts\Admin.pwn(594) : error 017: undefined symbol "level"
C:\Users\Carlos\Desktop\Roleplay\filterscripts\Admin.pwn(597) : error 017: undefined symbol "level"
C:\Users\Carlos\Desktop\Roleplay\filterscripts\Admin.pwn(598) : error 029: invalid expression, assumed zero
C:\Users\Carlos\Desktop\Roleplay\filterscripts\Admin.pwn(598) : error 017: undefined symbol "d"
C:\Users\Carlos\Desktop\Roleplay\filterscripts\Admin.pwn(598) : error 029: invalid expression, assumed zero
C:\Users\Carlos\Desktop\Roleplay\filterscripts\Admin.pwn(598) : fatal error 107: too many error messages on one line
and i wanna know how to put the admin level inside "admin" because i tried this:

Код:
                new str2[128];
                format(str2,sizeof(str2), PlayerFile, gPlayerInfo[playerid][PLAYER_NAME], level);
				dini_IntSet(str2, "Admin", %d, level);
and i dont know how to make it, please help, thanks.
Reply
#2

i made the intset line to work but level aint identified, idk why, help please.
Reply
#3

You have that define "level".

pawn Код:
new level;
Reply
#4

well i recommand using zcmd and sscanf so it's easier, use this to help
Reply
#5

@ junkbuster nice one, that wasnt it but helped me to solve the problem.

it was here:

Код:
new tmp[256], tmp2[256], index, id;
i just needed to add the level

soo:

Код:
new tmp[256], tmp2[256], index, id, level;
@tanush123 i prefeer to use dcmd but later when i make too much commands i will start to use them
Reply
#6

Quote:
Originally Posted by ttloko2
Посмотреть сообщение
@ junkbuster nice one, that wasnt it but helped me to solve the problem.

it was here:

Код:
new tmp[256], tmp2[256], index, id;
i just needed to add the level

soo:

Код:
new tmp[256], tmp2[256], index, id, level;
@tanush123 i prefeer to use dcmd but later when i make too much commands i will start to use them
Remember that you can only use 1 command processor at once so in future, you will have to convert all of them. better start now. :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)