Mute - 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: Mute (
/showthread.php?tid=414603)
Mute -
DerickClark - 10.02.2013
Its not showing the player's name
Код:
// Mutes a player (he cannot talk anymore)
COMMAND:mute(playerid, params[])
{
// Setup local variables
new Msg[128], Name[24], AdminName[24], Reason[128], OtherPlayer;
// Send the command to all admins so they can see it
SendAdminText(playerid, "/mute", params);
// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
// Check if the player's admin-level is at least 1
if (APlayerData[playerid][PlayerLevel] >= 1)
{
if (sscanf(params, "us[128]", OtherPlayer, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/mute <OtherPlayer> <Reason>\"");
else
{
// Check if the otherplayer is online
if (IsPlayerConnected(OtherPlayer))
{
// Get the player-names
GetPlayerName(playerid, AdminName, sizeof(AdminName));
GetPlayerName(OtherPlayer, Name, sizeof(Name));
// Mute the other player
APlayerData[OtherPlayer][Muted] = true;
// Let the other player know that he has been muted
format(Msg, 128, "%s muted %s Reason: %s", AdminName,giveplayername,Reason);
SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg);
// Let the admin know who he has muted
format(Msg, 128, "{00FF00}You have muted {FFFF00}%s", Name);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
// Save the player-stats
PlayerFile_Save(OtherPlayer);
}
else
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}That player isn't online");
}
}
else
return 0;
}
else
return 0;
// Let the server know that this was a valid command
return 1;
}
Re: Mute -
Neil. - 10.02.2013
TRY THIS
pawn Код:
// Mutes a player (he cannot talk anymore)
COMMAND:mute(playerid, params[])
{
// Setup local variables
new Msg[128], Name[24], AdminName[24], Reason[128], OtherPlayer;
// Send the command to all admins so they can see it
SendAdminText(playerid, "/mute", params);
// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
// Check if the player's admin-level is at least 1
if (APlayerData[playerid][PlayerLevel] >= 1)
{
if (sscanf(params, "us[128]", OtherPlayer, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/mute <OtherPlayer> <Reason>\"");
else
{
// Check if the otherplayer is online
if (IsPlayerConnected(OtherPlayer))
{
// Get the player-names
GetPlayerName(playerid, AdminName, sizeof(AdminName));
GetPlayerName(OtherPlayer, Name, sizeof(Name));
// Mute the other player
APlayerData[OtherPlayer][Muted] = true;
// Let the other player know that he has been muted
format(Msg, 128, "%s muted %s Reason: %s", AdminName,Name,Reason);
SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg);
// Let the admin know who he has muted
format(Msg, 128, "{00FF00}You have muted {FFFF00}%s", Name);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
// Save the player-stats
PlayerFile_Save(OtherPlayer);
}
else
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}That player isn't online");
}
}
else
return 0;
}
else
return 0;
// Let the server know that this was a valid command
return 1;
}
Re: Mute -
DerickClark - 10.02.2013
ty it work.