Need /block Command - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need /block Command (
/showthread.php?tid=64841)
Need /block Command -
micki501 - 07.02.2009
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
Re: Need /block Command -
ICECOLDKILLAK8 - 07.02.2009
What do you mean Ignore?, Ignore what?
Re: Need /block Command -
pspleo - 07.02.2009
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
}
Re: Need /block Command -
micki501 - 07.02.2009
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?
Re: Need /block Command -
micki501 - 07.02.2009
Sorry for Doppelpost, i dont unterstand it..
Re: Need /block Command -
micki501 - 08.02.2009
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
Re: Need /block Command -
pspleo - 08.02.2009
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 !");
}
}
}
}