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:
- After each { all the code below is moved to the right by 1 tab.
- 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(playerid, 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;
SendClientMessage(playerid, green, "| - Block PM activated, players cannot PM you. - |");
}
if(PlayerInfo[playerid][Block] != 1)return SendClientMessage(playerid, red, "ERROR: You are not Blocking your PM's!");
{
PlayerInfo[playerid][Block] = 0;
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");
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(playerid, params[])
{
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(playerid, green, "| - 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(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");
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.