/pm ignore - 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: /pm ignore (
/showthread.php?tid=335767)
/pm ignore -
boyan96 - 19.04.2012
PHP код:
if(strcmp(cmd, "/pm", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " You havent logged in yet!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /pm [playerid/PartOfName] [text]");
return 1;
}
giveplayerid = strval(tmp);
if (IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[256];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /pm [playerid/PartOfName] [text]");
return 1;
}
format(string, sizeof(string), "* PM from %s(ID: %d): %s", PlayerName(playerid), playerid, (result));
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
format(string, sizeof(string), "* PM to %s(ID: %d): %s", giveplayer, giveplayerid, (result));
SendClientMessage(playerid, COLOR_YELLOW, string);//to6o
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pAdmin] >= 1)
{
if(PlayerInfo[i][aTog] == 1)
{
format(string, sizeof(string), "* PM from %s[%d] to %s[%d]: %s", PlayerName(playerid), playerid, giveplayer, giveplayerid, (result));
SendClientMessage(i, COLOR_YELLOW, string);//to6o
}
}
}
}
return 1;
}
}
else
{
format(string, sizeof(string), " %d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}
How i can make and command to stop all PM messages
Re: /pm ignore -
MeDaKewlDude - 19.04.2012
add this to the other variables:
Код:
new ignorepm[MAX_PLAYERS][MAX_PLAYERS] = 0;
the new command:
Код:
if(strcmp(cmd, "/pmignore", true) == 0)
{
giveplayerid = strval(tmp);
if (IsPlayerConnected(giveplayerid))
{
SendClientMessage(playerid, COLOR_GRAD2, "This player is offline.");
return 1;
}
if(ignorepm[playerid][giveplayerid] == 1)
{
SendClientMessage(playerid, COLOR_GRAD2, "you are already ignoring this player.");
return 1;
}
ignorepm[playerid][giveplayerid] = 1;
}
and added:
Код:
if(ignorepm[giveplayerid][playerid] == 1)
{
SendClientMessage(playerid, COLOR_GRAD2, "This player is ignoring you.");
return 1;
}
to this:
Код:
if(strcmp(cmd, "/pm", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " You havent logged in yet!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /pm [playerid/PartOfName] [text]");
return 1;
}
giveplayerid = strval(tmp);
if (IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[256];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /pm [playerid/PartOfName] [text]");
return 1;
}
if(ignorepm[giveplayerid][playerid] = 1)
{
SendClientMessage(playerid, COLOR_GRAD2, "This player is ignoring you.");
return 1;
}
format(string, sizeof(string), "* PM from %s(ID: %d): %s", PlayerName(playerid), playerid, (result));
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
format(string, sizeof(string), "* PM to %s(ID: %d): %s", giveplayer, giveplayerid, (result));
SendClientMessage(playerid, COLOR_YELLOW, string);//to6o
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pAdmin] >= 1)
{
if(PlayerInfo[i][aTog] == 1)
{
format(string, sizeof(string), "* PM from %s[%d] to %s[%d]: %s", PlayerName(playerid), playerid, giveplayer, giveplayerid, (result));
SendClientMessage(i, COLOR_YELLOW, string);//to6o
}
}
}
}
return 1;
}
}
else
{
format(string, sizeof(string), " %d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}
sorry if this doesn't work, i'm not too familiar with strtok. i usually work with dcmd.