I think i missing Brackets Help pls
#1

Hello all i have made acmd for block pm but i gos some errors maybe can anyone help me
i don't know how to found the missing bracket

Код:
D:\price\matrix\Gamemodes\DNTDM1.pwn(47826) : warning 209: function "cmd_dnd" should return a value
D:\price\matrix\Gamemodes\DNTDM1.pwn(47826) : error 010: invalid function or declaration
D:\price\matrix\Gamemodes\DNTDM1.pwn(47827) : error 010: invalid function or declaration
D:\price\matrix\Gamemodes\DNTDM1.pwn(47829) : error 010: invalid function or declaration
D:\price\matrix\Gamemodes\DNTDM1.pwn(47830) : error 010: invalid function or declaration
D:\price\matrix\Gamemodes\DNTDM1.pwn(47832) : error 010: invalid function or declaration
D:\price\matrix\Gamemodes\DNTDM1.pwn(47833) : error 010: invalid function or declaration
D:\price\matrix\Gamemodes\DNTDM1.pwn(47835) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


7 Errors.
here's command
Код:
CMD:dnd(playerid,params[]) {
	#pragma unused params
	#pragma unused params
	if(PlayerInfo[playerid][Level] >= 6)
	{
    if(PlayerInfo[playerid][Block] == 1)
    return SendClientMessage(playerid, red, "ERROR: You already Blocking your PM's!");
    PlayerInfo[playerid][Block] = 1;
    return SendClientMessage(playerid, green, "| - Block PM activated, players cannot PM you. - |");
	}
} else {
    if(PlayerInfo[playerid][Level] >= 6)
	{
    if(PlayerInfo[playerid][Block] != 1)
	return SendClientMessage(playerid, red, "ERROR: You are not Blocking your PM's!");

    PlayerInfo[playerid][Block] = 0;
    return SendClientMessage(playerid, green, "| - You can receive PM's from players now. - |");
	}
	else return SendClientMessage(playerid, red, "ERROR: You are not a high enough level to use this command");
}
Reply
#2

If you were to properly indent your code the mistake would be painfully obvious. Indentation is two simple rules:
  1. After each { all the code below is moved to the right by 1 tab.
  2. After each } all the code below is moved back to the left by 1 tab.
Reply
#3

idk now i have missing brackets "
Reply
#4

now i have missing brackets ? Or NO >>??
Reply
#5

any help or ideas
Reply
#6

Try this
PHP код:
CMD:dnd(playeridparams[])
{
    if(
PlayerInfo[playerid][Level] >= 6)
    {
        if(
PlayerInfo[playerid][Block] == 1)return SendClientMessage(playeridred"ERROR: You already Blocking your PM's!");
        {
            
PlayerInfo[playerid][Block] = 1;
            
SendClientMessage(playeridgreen"| - Block PM activated, players cannot PM you. - |");
        }
        if(
PlayerInfo[playerid][Block] != 1)return SendClientMessage(playeridred"ERROR: You are not Blocking your PM's!");
        {
            
PlayerInfo[playerid][Block] = 0;
            
SendClientMessage(playeridgreen"| - You can receive PM's from players now. - |");
        }
    }
    else return 
SendClientMessage(playeridred"ERROR: You are not a high enough level to use this command");
    return 
1;

Reply
#7

yea that's works thx man
Reply
#8

i got that when when i tested it
it's block and unblock in same time
Reply
#9

any help?
Reply
#10

Alright this should work:
PHP код:
CMD:dnd(playeridparams[])
{
    if(
PlayerInfo[playerid][Level] >= 6)
    {
    if(
PlayerInfo[playerid][Block] == 0)
    { 
//return SendClientMessage(playerid, red, "ERROR: You already Blocking your PM's!");
        
PlayerInfo[playerid][Block] = 1;
          
SendClientMessage(playeridgreen"| - Block PM activated, players cannot PM you. - |");
    }
    else
//if(PlayerInfo[playerid][Block] == 1)//return SendClientMessage(playerid, red, "ERROR: You are not Blocking your PM's!");
    
{
        
PlayerInfo[playerid][Block] = 0;
        
SendClientMessage(playeridgreen"| - You can receive PM's from players now. - |");
        }
    }
    else return 
SendClientMessage(playeridred"ERROR: You are not a high enough level to use this command");
    return 
1;

You can't use those return SendClientMessage's here as it's a togglable CMD and they won't work.
If I helped you, I'd appreciate a +1.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)