Small warning i'm trying to fix!
#1

Hello Again!

I'm just trying to make it so if the player isn't pBCSD or below admin level 5, he/she can't use the command.

I put a ! infront as you can see, but it returns me a warning saying: warning 213: tag mismatch.


Line:
pawn Код:
if(!playerVariables[playerid][pBCSD] <= 5 || !playerVariables[playerid][pAdmin] <= 5) return 0;
Any resolution?

Kind Regards
Oscii.
Reply
#2

this should work.

Код:
CMD:command(playerid, params[])
{
	if(!playerVariables[playerid][pBCSD] <= 5 || !playerVariables[playerid][pAdmin] <= 5)
	//code
	else
	{
	    SendClientMessage(playerid, -1, "ERROR:You are not in BCSD or an admin!");
	    return 1;
	}
}
Reply
#3

pawn Код:
CMD:setbcsd(playerid, params[])
{
    new szQuery[128];
    new levels,Nam[MAX_PLAYER_NAME],pname[MAX_PLAYER_NAME],str[128],ID;
    if(!playerVariables[playerid][pBCSD] <= 5 || !playerVariables[playerid][pAdmin] <= 5)
    if(sscanf(params,"ui",ID,levels)) return SendClientMessage(playerid,0xFF9900AA, "USAGE: /setadmin [ID] [Level 1-7]");//it will show this if you dont use the format properly
    if(levels > 7) return SendClientMessage(playerid,0xFF0000FF,"LEVELS AVAILABLE 1-7!");//Available levels
    if(!IsPlayerConnected(ID))return SendClientMessage(playerid,COLOR_RED,"That user is not connected.");//Detect if the id/partofname is connected
    if(playerVariables[ID][pAdmin] == levels) return SendClientMessage(playerid,0xFF0000FF, "ERROR: That person is already this rank!");//Detect if the guy is already the level you setted
    GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);//define the playerid name
    GetPlayerName(ID,pname,MAX_PLAYER_NAME);//define the other person name
    if(levels == 0)
    {
        format(str, sizeof(str),"%s has your BCSD rank level to %d . *cry *cry",Nam,levels);
        SendClientMessage(ID,COLOR_RED,str);
        format(str, sizeof(str),"You have set %s BCSD rank to %d!",pname,levels);
        SendClientMessage(playerid,0xFF9900AA,str);
        playerVariables[ID][pBCSD] = levels;//this sets the player level
//          format(szQuery, sizeof(szQuery), "UPDATE players SET Admin = '%d'", levels);
        return 1;
    }
    format(str, sizeof(str),"%s has your BCSD rank level to %d on the server.",Nam,levels);
//      format(szQuery, sizeof(szQuery), "UPDATE players SET Admin = '%d'", levels);
    SendClientMessage(ID,COLOR_GREEN,str);
    format(str, sizeof(str),"You had set %s BCSD rank level to %d!",pname,levels);
    SendClientMessage(playerid,0xFF9900AA,str);
    playerVariables[ID][pBCSD] = levels;
 //   mysql_query(szQuery, THREAD_NO_RESULT, levels, iConnectionHandle);
    else
    {
        SendClientMessage(playerid, -1, "ERROR:You are not in BCSD or an admin!");
        return 1;
    }
}
Is my command now i've added what you told me, But still warnings!
Reply
#4

I also have an error on the line

" else "

error 029: invalid expression, assumed zero
Reply
#5

What are your warnings?
Reply
#6

The same as before.
Reply
#7

That has to work..

Код:
CMD:setbcsd(playerid, params[])
{
    new szQuery[128];
    new levels,Nam[MAX_PLAYER_NAME],pname[MAX_PLAYER_NAME],str[128],ID;
    if(playerVariables[playerid][pBCSD] <= 5 || !playerVariables[playerid][pAdmin] <= 5) return SendClientMessage(playerid, -1, "ERROR: You are not in BCSD or an admin!");
    if(sscanf(params,"ui",ID,levels)) return SendClientMessage(playerid,0xFF9900AA, "USAGE: /setadmin [ID] [Level 1-7]");//it will show this if you dont use the format properly
    if(levels > 7) return SendClientMessage(playerid,0xFF0000FF,"LEVELS AVAILABLE 1-7!");//Available levels
    if(!IsPlayerConnected(ID))return SendClientMessage(playerid,COLOR_RED,"That user is not connected.");//Detect if the id/partofname is connected
    if(playerVariables[ID][pAdmin] == levels) return SendClientMessage(playerid,0xFF0000FF, "ERROR: That person is already this rank!");//Detect if the guy is already the level you setted
    GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);//define the playerid name
    GetPlayerName(ID,pname,MAX_PLAYER_NAME);//define the other person name
    if(levels == 0)
    {
        format(str, sizeof(str),"%s has your BCSD rank level to %d . *cry *cry",Nam,levels);
        SendClientMessage(ID,COLOR_RED,str);
        format(str, sizeof(str),"You have set %s BCSD rank to %d!",pname,levels);
        SendClientMessage(playerid,0xFF9900AA,str);
        playerVariables[ID][pBCSD] = levels;//this sets the player level
//          format(szQuery, sizeof(szQuery), "UPDATE players SET Admin = '%d'", levels);
        return 1;
    }
    format(str, sizeof(str),"%s has your BCSD rank level to %d on the server.",Nam,levels);
//      format(szQuery, sizeof(szQuery), "UPDATE players SET Admin = '%d'", levels);
    SendClientMessage(ID,COLOR_GREEN,str);
    format(str, sizeof(str),"You had set %s BCSD rank level to %d!",pname,levels);
    SendClientMessage(playerid,0xFF9900AA,str);
    playerVariables[ID][pBCSD] = levels;
 //   mysql_query(szQuery, THREAD_NO_RESULT, levels, iConnectionHandle);
}
Reply
#8

Now I only have one

warning 213: tag mismatch.
Reply
#9

what line ?
Reply
#10

pawn Код:
if(!playerVariables[playerid][pBCSD] <= 5 || !playerVariables[playerid][pAdmin] <= 5) return 0;
// Change it to
if(playerVariables[playerid][pBCSD] < 5 || playerVariables[playerid][pAdmin] < 5) return 0;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)