Need /block Command
#1

Hello People

I need a /block Command. This Block command is for every user to ignore other User - I don't know how i do it.. Grml

I think its a little bit like this ( Its Made by me ):
Код:
	if(strcmp(cmd, "/block", true) == 0)
	{
		 if(IsPlayerConnected(playerid))
		 {
			 if (!Block[playerid])
			 {
				 Block[playerid] = 1;
				 SendClientMessage(playerid, COLOR_GRAD2, "  Spieler wurde geblockt !");
			 }
			 else if (Block[playerid])
			 {
				 Block[playerid] = 0;
				 SendClientMessage(playerid, COLOR_GRAD2, "  Spieler wurde entblockt !");
			 }
		 }
		 else
		 {
			 SendClientMessage(playerid, COLOR_GREY, "  Du bist kein Admin / Premium Account User !");
			 return 1;
		 }
	 }
	 return 1;
	}
But i think its very wrong
Reply
#2

What do you mean Ignore?, Ignore what?
Reply
#3

Looks ok. And you shall do with other commands...
pawn Код:
//whatever command.. let's take hi command (ex)
if(strcmp(cmd, "/hi", true) == 0)
{
  new tmp[50];
  tmp = strtok(cmdtext, idx);
  new val = strval(tmp);
  if(IsPlayerConnected(val))
  {
    //and all other things
  }
  if(Block[val] == 1) return; //return, command doesn't do anything
}
Reply
#4

I will block the Text from other Users, that i cannot read this Text.. Like in GF with /togooc or /tognews or whatever - But i would like to choose, who user i block like /block ID - You unterstand?
Reply
#5

Sorry for Doppelpost, i dont unterstand it..
Reply
#6

Yeah, i again
My Code looks like this:
Код:
	if(strcmp(cmd, "/block", true) == 0)
	{
    if(IsPlayerConnected(playerid))
    {
			 new tmp[50]
			 tmp = strtok(cmdtext, idx);
			 new val = strval(tmp);
			 if(IsPlayerConnected(val))
			 {
				if (!Block[playerid])
				{
				 Block[val] == 1;
				 SendClientMessage(playerid, COLOR_GRAD2, "  Spieler wurde geblockt !");
				}
				else if (Block[playerid])
				{
				 Block[val] == 0;
				 SendClientMessage(playerid, COLOR_GRAD2, "  Spieler wurde entblockt !");
				}
			 }
			 if(Block[val] == 1) return;
	  }
When i compile this code, i become no Error with these Command, but many other commands like:
Код:
error 004: function "OnPlayerUpdate" is not implemented
C:\Dokumente und Einstellungen\Administrator\Desktop\Schiffkampf\Schiffkampf\gamemodes\SchiffDM.pwn(265) : error 017: undefined symbol "strtok"
C:\Dokumente und Einstellungen\Administrator\Desktop\Schiffkampf\Schiffkampf\gamemodes\SchiffDM.pwn(265) : error 033: array must be indexed (variable "cmd")
And so..

//Edit: When i take this command out of the script i become nothing errors
Reply
#7

You forgot an }. Let me fix it..
pawn Код:
if(strcmp(cmd, "/block", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
             new tmp[50]
             tmp = strtok(cmdtext, idx);
             new val = strval(tmp);
             if(IsPlayerConnected(val))
             {
                if (Block[val] == 0)
                {
                 Block[val] = 1;
                 SendClientMessage(playerid, COLOR_GRAD2, "  Spieler wurde geblockt !");
                }
                else if (Block[val] == 1)
                {
                 Block[val] = 0;
                 SendClientMessage(playerid, COLOR_GRAD2, "  Spieler wurde entblockt !");
                }
            }
        }
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)