19.08.2010, 22:32
Okay I have made my mute command, it works alright but I dont want to have to type /unmute I want there to be a timer, so I added a timer but I cant get it to work can you help please
and then the timer is
I try testing it on myself, it mutes me and then i wait like 5 minutes and it still doesnt unmute me, if this helps here is the onplayertext thing
anyone tell me why it isnt unmuting me?
Код:
if(strcmp(cmd,"/mute",true) == 0)
{
new tmp[256];
new id;
tmp = strtok(cmdtext, idx);
if(PlayerInfo[playerid][Level] <= 1)
{
SendClientMessage(playerid,RED,"You have to be Level 2 to use this command!");
return 1;
}
if(Logged[playerid] == 0)
{
SendClientMessage(playerid,BRIGHTRED,"Please login before you use this command!");
return 1;
}
if(!strlen(tmp))
{
SendClientMessage(playerid,WHITE,"SERVER: /mute [id]");
return 1;
}
id = strval(tmp);
if(!IsPlayerConnected(id))
{
SendClientMessage(playerid,WHITE,"SERVER: Invalid ID.");
return 1;
}
tmp = strtok(cmdtext, idx);
new string[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
new nname[MAX_PLAYER_NAME];
GetPlayerName(id,nname,sizeof(nname));
format(string,sizeof(string)," * You have muted %s *",nname);
SendClientMessage(playerid,YELLOW,string);
format(string,sizeof(string)," * you have been muted by %s. dont try to speak because you are muted!",name);
SendClientMessage(id,BRIGHTRED,string);
SetTimerEx("MuteTimer", 6000, false, "i", nname);
PlayerInfo[id][Muted] = 1;
return 1;
}
Код:
public MuteTimer(playerid)
{
PlayerInfo[playerid][Muted] = 0;
SendClientMessage(playerid,BRIGHTRED,"You have been unmuted");
return 1;
}
Код:
public OnPlayerText(playerid, text[])
{
if(PlayerInfo[playerid][Muted] == 1)
{
return 0;
}
return 1;
}

