05.01.2012, 11:31
hi, I made in my server if player something says him heard only who is around and of course I made /me and /shout cmds for can hear all, I add timer in cmd for not spamming in main chat and show him how much time left when he can again use this cmds but I not getting countdown, I get countup
all work except the time which left to use this command
pawn Код:
new metimer
enum pooInfo
{
pMe,
};
new ShitInfo[MAX_PLAYERS][pooInfo];
public OnGameModeInit()
{
metimer = SetTimer("Shout",1000,1);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/me", true, 3)) if(Logged[playerid] == 1)
{
new string[256];
new str[256];
if(ShitInfo[playerid][pMe] > 1)
{
format(string, 256, "( ! ) You have to wait %d seconds before shout or action", (20-(ShitInfo[playerid][pMe])));
SendClientMessage(playerid, c_r, string); return 1;
}
if(cmdtext[3] == 0)
{
SendClientMessage(playerid, COLOR_YELLOW, "( ! ) /me <message>");
return 1;
}
else
{
format(str, sizeof(str), "( ! ) %s: %s",PlayerName(playerid) , cmdtext[4]);
SendClientMessageToAll(GetPlayerColor(playerid), str);
ShitInfo[playerid][pMe] = 20;
}
return 1;
}
return 1;
}
forward Shout(playerid);
public Shout(playerid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(ShitInfo[i][pMe] >=1)
{
ShitInfo[i][pMe] --;
}
}
}
return 1;
}
all work except the time which left to use this command