ACMD:mute(playerid, params[])
{
if (pInfo[playerid][Adminlevel] < 1) return 0;
new giveplayerid, reason[128], string[120], minutes, pname1[MAX_PLAYER_NAME], pname2[MAX_PLAYER_NAME];
if(sscanf(params, "uds[50]", giveplayerid, minutes, reason)) return SCM(playerid, orange, "--- /mute <ID> <Minutes> <Reason> ---");
if(ID == IPI)return SCM(playerid, red, "Player is not connected!");
GetPlayerName(playerid, pname1, sizeof(pname1));
GetPlayerName(giveplayerid, pname2, sizeof(pname2));
format(string, sizeof(string), "%s %s has muted %s for %d minutes: %s", AdminLevelName(playerid), pname1, pname2 , minutes, reason);
SCMToAll(red, string);
new calc = minutes*60;
Mute[giveplayerid] = calc;
return 1;
}
ACMD:kick(playerid, params[])
{
new reason[128], string[120], pname1[MAX_PLAYER_NAME], pname2[MAX_PLAYER_NAME], giveplayerid;
if(sscanf(params, "uds[50]", reason, giveplayerid)) return SCM(playerid, orange, "--- /kick <ID> <Reason> ---");
if(ID == IPI)return SCM(playerid, red, "Player is not connected!");
GetPlayerName(playerid, pname1, sizeof(pname1));
GetPlayerName(giveplayerid, pname2, sizeof(pname2));
format(string, sizeof(string), "%s %s has kicked %s for %s", AdminLevelName(playerid), pname1, pname2, reason);
SCMToAll(red, string);
SetTimerEx("KickTimer", 1000, false, "d", playerid);
return 1;
}
ACMD:mute(playerid, params[]) { if (pInfo[playerid][Adminlevel] < 1) return 0; new giveplayerid, reason[128], string[120], minutes, pname1[MAX_PLAYER_NAME], pname2[MAX_PLAYER_NAME]; if(sscanf(params, "uds[50]", giveplayerid, minutes, reason)) return SCM(playerid, orange, "--- /mute <ID> <Minutes> <Reason> ---"); if(ID == IPI)return SCM(playerid, red, "Player is not connected!"); GetPlayerName(playerid, pname1, sizeof(pname1)); GetPlayerName(giveplayerid, pname2, sizeof(pname2)); format(string, sizeof(string), "%s %s has muted %s for %d minutes: %s", AdminLevelName(playerid), pname1, pname2 , minutes, reason); SCMToAll(red, string); new calc = minutes*60; Mute[giveplayerid] = calc; MutedTimes[giveplayerid] += 1; return 1; }
ACMD:kick(playerid, params[]) { new reason[128], string[120], pname1[MAX_PLAYER_NAME], pname2[MAX_PLAYER_NAME], giveplayerid; if(sscanf(params, "uds[50]", reason, giveplayerid)) return SCM(playerid, orange, "--- /kick <ID> <Reason> ---"); if(ID == IPI)return SCM(playerid, red, "Player is not connected!"); GetPlayerName(playerid, pname1, sizeof(pname1)); GetPlayerName(giveplayerid, pname2, sizeof(pname2)); format(string, sizeof(string), "%s %s has kicked %s for %s", AdminLevelName(playerid), pname1, pname2, reason); SCMToAll(red, string); SetTimerEx("KickTimer", 1000, false, "d", playerid); KickedTimes[giveplayerid] +=1; return 1; }
enum INFO
{
Muted, // example
}
new pInfo[MAX_PLAYERS][INFO];
ACMD:mute(playerid, params[])
{
if (pInfo[playerid][Adminlevel] < 1) return 0;
new giveplayerid, reason[128], string[120], minutes, pname1[MAX_PLAYER_NAME], pname2[MAX_PLAYER_NAME];
if(sscanf(params, "uds[50]", giveplayerid, minutes, reason)) return SCM(playerid, orange, "--- /mute <ID> <Minutes> <Reason> ---");
if(ID == IPI)return SCM(playerid, red, "Player is not connected!");
GetPlayerName(playerid, pname1, sizeof(pname1));
GetPlayerName(giveplayerid, pname2, sizeof(pname2));
format(string, sizeof(string), "%s %s has muted %s for %d minutes: %s", AdminLevelName(playerid), pname1, pname2 , minutes, reason);
SCMToAll(red, string);
new calc = minutes*60;
Mute[giveplayerid] = calc;
pInfo[playerid][Muted] = 1; // this variable, we'll save it's value later, at OnPlayerDisconnect, put it in the command here.
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(/* Path of your save file , example: "Users/%s.ini" */);
INI_SetTag(File, "Whatever");
INI_WriteInt(File, "Muted", pInfo[playerid][Muted]);
INI_Close(File);
return 1;
}
INI_WriteInt(File, "Muted", 0);
INI_Int("Muted", pInfo[playerid][Muted]);
public OnPlayerConnect(playerid)
{
if(pInfo[playerid][Muted] == 1)
{
SendClientMessage(playerid, -1, "You were muted! , you are kicked for avoiding the muted.");
SetTimerEx("KickTimer", 1000, false, "d", playerid);
}
return 1;
}
public OnPlayerConnect(playerid)
{
if(pInfo[playerid][Muted] == 1)
{
SendClientMessage(playerid, -1, "You were muted! , you are kicked for avoiding the muted.");
SetTimerEx("KickTimer", 1000, false, "d", playerid);
}
return 1;
}
if(pInfo[playerid][Muted] == 1)
{
SendClientMessage(playerid, -1, "You're muted ask an administrator to unmute you via /ask");
Mute[giveplayerid] = calc;
}
pawn Код:
Well if he going to put this code he can use it instead of ban command. If the player muted and he tried to connect everytime the server will kick him. Try to understand the code before you post it. And i suggest to make it like Save the mintues of the mutes and if the player evaded it the mintues of the mutes will be automatically save at the player .ini file and when the player spawn we can make it like. pawn Код:
|
well, I know what I am posting, actually, he didn't mention that he wanted that, He just wanted to know how to save player mute variable value, only.
|
public OnPlayerConnect(playerid)
{
if(pInfo[playerid][Muted] == 1)
{
SendClientMessage(playerid, -1, "You were muted! , you are kicked for avoiding the muted.");
[B] SetTimerEx("KickTimer", 1000, false, "d", playerid);
[/B] }
return 1;
}