what is wrong?
#1

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
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
Reply
#2

nobody can't help me?
Reply
#3

Ok , try this.

Shout:


Код:
	if(strcmp(cmd, "/shout", true) == 0 || strcmp(cmd, "/s", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
            if(PlayerInfo[playerid][pMuted] == 1)
			{
				format(string, sizeof(string), "You can not speak, you have been silenced for %d seconds.",PlayerInfo[playerid][pMuteTime]);
				SendClientMessage(playerid, COLOR_LIGHTRED, string);
				return 1;
			}
	        if(gPlayerLogged[playerid] == 0)
	        {
	            SCM(playerid, COLOR_GREY, "   You havent logged in yet !");
	            return 1;
	        }
			GetPlayerName(playerid, sendername, sizeof(sendername));
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
			new result[64];
			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
			{
				result[idx - offset] = cmdtext[idx];
				idx++;
			}
			if(FindIP(result))
  	        {
	 		    new advertiser[MAX_PLAYER_NAME];
	 		    GetPlayerName(playerid, advertiser, sizeof(advertiser));
	   		    format(string, sizeof(string), "[AdmWarning]: %s[ID: %d] a facut reclama si a primit ban!",advertiser,playerid);
	   		    ABroadCast(COLOR_LIGHTRED,string,1);
	   		    Ban(playerid);
	   		    return 1;
            }
			result[idx - offset] = EOS;
			if(!strlen(result))
			{
				SCM(playerid, COLOR_GRAD2, "USAGE: (/s)hout [local chat]");
				return 1;
			}
			result[0] = toupper(result[0]);
			format(string, sizeof(string), "%s Shouts: %s!!", sendername, result);
			ProxDetector(30.0, playerid, string,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_FADE1,COLOR_FADE2);
			printf("%s", string);
			new y,m,d;
		    new h,mi,s;
  		    getdate(y,m,d);
 	   	 	gettime(h,mi,s);
   		    format(string, sizeof(string), "(%d/%d/%d)[%d:%d:%d][Shout] %s: %s",d,m,y,h,mi,s, sendername, result);
   		    ChatLog(string);
		}
		return 1;
	}
/me

Код:
	if(strcmp(cmd, "/me", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
            if(PlayerInfo[playerid][pMuted] == 1)
			{
				format(string, sizeof(string), "You can not speak, you have been silenced for %d seconds.",PlayerInfo[playerid][pMuteTime]);
				SendClientMessage(playerid, COLOR_LIGHTRED, string);
				return 1;
			}
	        if(gPlayerLogged[playerid] == 0)
	        {
	            SCM(playerid, COLOR_GREY, "   You havent logged in yet !");
	            return 1;
	        }
			GetPlayerName(playerid, sendername, sizeof(sendername));
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
			new result[64];
			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
			{
				result[idx - offset] = cmdtext[idx];
				idx++;
			}
			if(FindIP(result))
  	        {
	 		    new advertiser[MAX_PLAYER_NAME];
	 		    GetPlayerName(playerid, advertiser, sizeof(advertiser));
	   		    format(string, sizeof(string), "[AdmWarning]: %s[ID: %d] a facut reclama si a primit ban!",advertiser,playerid);
	   		    ABroadCast(COLOR_LIGHTRED,string,1);
	   		    Ban(playerid);
	   		    return 1;
            }
			result[idx - offset] = EOS;
			if(!strlen(result))
			{
				SCM(playerid, COLOR_GRAD2, "USAGE: /me [action]");
				return 1;
			}
			result[0] = toupper(result[0]);
			format(string, sizeof(string), "* %s %s", sendername, result);
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			printf("%s", string);
			new y,m,d;
		    new h,mi,s;
  		    getdate(y,m,d);
 	   	 	gettime(h,mi,s);
   		    format(string, sizeof(string), "(%d/%d/%d)[%d:%d:%d][Me] %s: %s",d,m,y,h,mi,s, sendername, result);
   		    ChatLog(string);
		}
		return 1;
	}
This wil work!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)