07.02.2015, 05:08
Hello, i made anti adv it works perfectly but - i want the player to be muted and he cannot use commands execpt /report.
I tried something like this in my code :-
new Mute[MAX_PLAYERS]; << at the top
And on player text
if(Mute[playerid] == 1)
{
return 0;
}
anyways, i'll just show the code:-
I tried something like this in my code :-
new Mute[MAX_PLAYERS]; << at the top
And on player text
if(Mute[playerid] == 1)
{
return 0;
}
anyways, i'll just show the code:-
PHP код:
public OnPlayerText(playerid, text[])
{
new noinsult;
for(new i = 0; i < sizeof ForbiddenWords; i++)
{
noinsult = strfind(text, ForbiddenWords[i], true);
if(noinsult != -1)
{
for(new x = noinsult; x < noinsult + strlen(ForbiddenWords[i]); x ++)
{
text[x] = '*';
}
}
}
new advword[150],Index;
while(Index < strlen(text))
{
advword = strtok(text,Index);
if(CheckAdv(advword)== 1)
{
new i=strfind(text,advword),j=i+strlen(advword)-1; text[i++]='[';
while(i<j)
{
text[i] = '.';
i++;
}
for(new qzh = 0; qzh <= 12; qzh ++)
{
GetPlayerWeaponData(playerid, qzh, weapons[qzh][0], weapons[qzh][1]);
}
ResetPlayerWeapons(playerid);
GetPlayerPos(playerid, gPos[playerid][0], gPos[playerid][1], gPos[playerid][2]);
SetPlayerPos(playerid, 238.0698,1858.0798,17.8835);
new name[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, name,sizeof(name));
CreateObject(971, 217.26276, 1875.07043, 12.13465, 0.00000, 0.00000, 0.00000);
CreateObject(971, 208.44275, 1875.12671, 12.13465, 0.00000, 0.00000, 0.00000);
CreateObject(971, 226.99435, 1858.85217, 12.13260, 0.00000, 0.00000, -91.00000);
CreateObject(971, 242.75571, 1861.25879, 15.96940, 0.00000, 0.00000, -55.00000);
CreateObject(3524, 230.57623, 1857.48279, 13.68170, 0.00000, 0.00000, -286.00000);
CreateObject(3524, 230.75998, 1858.85315, 13.68170, 0.00000, 0.00000, -286.00000);
CreateObject(3092, 230.97746, 1858.25171, 14.77976, 0.00000, 0.00000, -120.00000);
CreateObject(2908, 230.98877, 1857.39636, 15.71300, -69.44000, 11.00000, 156.00000);
CreateObject(2908, 231.16185, 1858.70996, 15.71300, -69.44000, 11.00000, 156.00000);
CreateObject(3092, 243.30440, 1861.32581, 17.52950, 0.00000, 0.00000, -258.00000);
SendClientMessage(playerid, -1, "{FF0000}You have been jailed by the anti cheat - Reason: Adv");
format(str,sizeof(str), "{FF0000}[ANTI-CHEAT]: %s Has been jailed by the anti cheat - Reason: Adv.", name);
SendClientMessageToAll(-1,str);
SetTimerEx("JailTimer", 60000, false, "i");
Mute[playerid] = 1;
if(Mute[playerid] == 1)
{
SendClientMessage(playerid, -1, "{FF0000}Warning: You're muted, You cannot talk.");
return 0;
}
}
}
SpamTimer[playerid] = SetTimerEx("DecreaseSpam",MAX_DECREASECOUNT*1000,1,"",playerid);
if(PlayerSpam[playerid] < MAX_SPAM)
{
PlayerSpam[playerid] ++;
}
else if(PlayerSpam[playerid] >= MAX_SPAM)
{
new TalkS[120],string[120], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name,sizeof(name));
format(string,sizeof(string), "{FF0000}[ANTI-CHEAT]: %s(ID: %d) has been kicked from the server - Reason: Spam",name, playerid);
SendClientMessageToAll(-1,string);
format(TalkS,sizeof(TalkS), "{FF0000}You have been kicked for spamming.");
ShowPlayerDialog(playerid, DIALOG_ANTI, DIALOG_STYLE_MSGBOX,"{FF0000}ANTI CHEAT",TalkS,"OK","");
PlayerSpam[playerid] = 0;
KillTimer(SpamTimer[playerid]);
SetTimerEx("SpamTimerKick", 1000, false, "i", playerid);
}
return 1;
}
PHP код:
forward JailTimer(playerid);
public JailTimer(playerid)
{
Mute[playerid] = 0;
if(Mute[playerid] == 0)
{
SendClientMessage(playerid, -1, "{FF0000}You have been unmuted.");
return 1;
}
SetPlayerPos(playerid, gPos[playerid][0], gPos[playerid][1], gPos[playerid][2]);
SetPlayerHealth(playerid, 2);
SendClientMessage(playerid, -1, "{FF0000}[ANTI-CHEAT]: Your punishment is not over yet - You have 2 HP now - Survive by your self");
for (new i = 0; i <= 12; i++)
{
GivePlayerWeapon(playerid, weapons[i][0], weapons[i][1]);
}
return 1;
}
PHP код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(Mute[playerid] == 1)
{
SendClientMessage(playerid, -1, "{FF0000}You're jailed, you're muted and you are not allowed to use commands.");
return 0;
}
return 0;
}