afk and back command getting errors
#1

its in dutch but i changed it!
pawn Код:
CMD:weg(playerid,params[]) // afk command
{
        if(PlayerAFK[playerid] == 0)
        {
           new pName[MAX_PLAYER_NAME];
           GetPlayerName(playerid,pName,sizeof(pName));
           new string[120];
           format(string,sizeof(string),"%s(%d) Is nou AwayFromKeyBoard[AFK]!",pName,playerid); // name id is afk!
           TogglePlayerControllable(playerid,0);
           PlayerAFK[playerid] = 1; //afk!
           SendClientMessageToAll(-1,string);
        }
        if(PlayerAFK[playerid] == 1) return SendClientMessage(playerid,-1,"Je Bent al AwayFromKeyboard[AFK]!"); // your already afk
        } // error line one!
    } // error line second!
  return 1; // third!
}

CMD:terug(playerid,params[]) //back command!
{
   if(PlayerAFK[playerid] == 0) return SendClientMessage(playerid,-1,"Je bent niet AwayFromKeyboard[AFK]!");// your arnt afk
   if(PlayerAFK[playerid] == 1)
   {
      new pName[MAX_PLAYER_NAME];
      GetPlayerName(playerid,pName,sizeof(pName));
      new string[120];
      format(string,sizeof(string),"%s(%d) Is terug gekomen!",pName,playerid); //name id comes back
      TogglePlayerControllable(playerid,1);
      SendClientMessageToAll(-1,string);
      PlayerAFK[playerid] = 0; //not any more afk
    }
  return 1; // error last!
}
i getting this following errors i thread any thing but dont work
Код:
C:\Users\Mustafa\Desktop\SAmp SRV\ForYou\gamemodes\TDMNIEUW.pwn(1039) : warning 209: function "cmd_weg" should return a value
C:\Users\Mustafa\Desktop\SAmp SRV\ForYou\gamemodes\TDMNIEUW.pwn(1040) : error 054: unmatched closing brace ("}")
C:\Users\Mustafa\Desktop\SAmp SRV\ForYou\gamemodes\TDMNIEUW.pwn(1041) : error 010: invalid function or declaration
C:\Users\Mustafa\Desktop\SAmp SRV\ForYou\gamemodes\TDMNIEUW.pwn(1057) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Thank you for reading and i hope you can help me.
Reply
#2

delete both } before return 1;
Reply
#3

pawn Код:
CMD:weg(playerid,params[])
{
        if(PlayerAFK[playerid] == 0)
        {
           new pName[MAX_PLAYER_NAME];
           GetPlayerName(playerid,pName,sizeof(pName));
           new string[120];
           format(string,sizeof(string),"%s(%d) Is nou AwayFromKeyBoard[AFK]!",pName,playerid);
           TogglePlayerControllable(playerid,0);
           PlayerAFK[playerid] = 1;
           SendClientMessageToAll(-1,string);
        }
        if(PlayerAFK[playerid] == 1) return SendClientMessage(playerid,-1,"Je Bent al AwayFromKeyboard[AFK]!");
     }
   return 1;
}
Same errors?
Reply
#4

Quote:
Originally Posted by Mustafa6155
Посмотреть сообщение
pawn Код:
CMD:weg(playerid,params[])
{
        if(PlayerAFK[playerid] == 0)
        {
           new pName[MAX_PLAYER_NAME];
           GetPlayerName(playerid,pName,sizeof(pName));
           new string[120];
           format(string,sizeof(string),"%s(%d) Is nou AwayFromKeyBoard[AFK]!",pName,playerid);
           TogglePlayerControllable(playerid,0);
           PlayerAFK[playerid] = 1;
           SendClientMessageToAll(-1,string);
        }
        if(PlayerAFK[playerid] == 1) return SendClientMessage(playerid,-1,"Je Bent al AwayFromKeyboard[AFK]!");
     }
   return 1;
}
Same errors?
Here:
pawn Код:
CMD:weg(playerid,params[])
{
        if(PlayerAFK[playerid] == 0)
        {
           new pName[MAX_PLAYER_NAME];
           GetPlayerName(playerid,pName,sizeof(pName));
           new string[120];
           format(string,sizeof(string),"%s(%d) Is nou AwayFromKeyBoard[AFK]!",pName,playerid);
           TogglePlayerControllable(playerid,0);
           PlayerAFK[playerid] = 1;
           SendClientMessageToAll(-1,string);
        }
        if(PlayerAFK[playerid] == 1) return SendClientMessage(playerid,-1,"Je Bent al AwayFromKeyboard[AFK]!");
     
   return 1;
}
Greetz,
LetsOWN
Reply
#5

Код:
C:\Users\Mustafa\Desktop\SAmp SRV\ForYou\gamemodes\TDMNIEUW.pwn(1040) : warning 217: loose indentation
C:\Users\Mustafa\Desktop\SAmp SRV\ForYou\gamemodes\TDMNIEUW.pwn(1055) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
Reply
#6

Quote:
Originally Posted by Mustafa6155
Посмотреть сообщение
Код:
C:\Users\Mustafa\Desktop\SAmp SRV\ForYou\gamemodes\TDMNIEUW.pwn(1040) : warning 217: loose indentation
C:\Users\Mustafa\Desktop\SAmp SRV\ForYou\gamemodes\TDMNIEUW.pwn(1055) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
These warnings are caused by mess in the code.

What I mean is, that you would have receive same warnings, when instead of:
pawn Код:
SomecodeHere()
{
    SomeHere()
    {
        blabla
        ???
    }
    return Trollface;
}
you would have writen
pawn Код:
SomecodeHere()
{
SomecodeHere()
{
blabla
???
}
return Trollface;
}
You can fix this by either removing mess from the code or use
pawn Код:
#pragma tabsize 0
at the very top of your script

I hope you understood what I wanted to say.

How can I see, this causes problem:
pawn Код:
if(PlayerAFK[playerid] == 1) return SendClientMessage(playerid,-1,"Je Bent al AwayFromKeyboard[AFK]!");
     
   return 1; // <<<<
}
Greetz,
LetsOWN
Reply
#7

Thnx
I was forgot
#pragma tabsize 0
Reply
#8

How i will fix it then?
I dont have a idea!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)