SA-MP Forums Archive
I think i missing Brackets Help pls - 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: I think i missing Brackets Help pls (/showthread.php?tid=623799)



I think i missing Brackets Help pls - vikoo - 05.12.2016

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



Re: I think i missing Brackets Help pls - Vince - 05.12.2016

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.



Re: I think i missing Brackets Help pls - vikoo - 05.12.2016

idk now i have missing brackets "


Re: I think i missing Brackets Help pls - vikoo - 05.12.2016

now i have missing brackets ? Or NO >>??


Re: I think i missing Brackets Help pls - vikoo - 05.12.2016

any help or ideas


Re: I think i missing Brackets Help pls - setes7 - 05.12.2016

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;




Re: I think i missing Brackets Help pls - vikoo - 05.12.2016

yea that's works thx man


Re: I think i missing Brackets Help pls - vikoo - 05.12.2016

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


Re: I think i missing Brackets Help pls - vikoo - 05.12.2016

any help?


Re: I think i missing Brackets Help pls - setes7 - 05.12.2016

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.