SA-MP Forums Archive
Small warning i'm trying to fix! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Small warning i'm trying to fix! (/showthread.php?tid=403868)



Small warning i'm trying to fix! - Oscii - 01.01.2013

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.



Re: Small warning i'm trying to fix! - Socan - 01.01.2013

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;
	}
}



Re: Small warning i'm trying to fix! - Oscii - 01.01.2013

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!


Re: Small warning i'm trying to fix! - Oscii - 01.01.2013

I also have an error on the line

" else "

error 029: invalid expression, assumed zero


Re: Small warning i'm trying to fix! - Socan - 01.01.2013

What are your warnings?


Re: Small warning i'm trying to fix! - Oscii - 01.01.2013

The same as before.


Re: Small warning i'm trying to fix! - Socan - 01.01.2013

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);
}



Re: Small warning i'm trying to fix! - Oscii - 01.01.2013

Now I only have one

warning 213: tag mismatch.


Re: Small warning i'm trying to fix! - Socan - 01.01.2013

what line ?


Re: Small warning i'm trying to fix! - Gangster-rocks - 01.01.2013

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;