command not working.
#1

Hi there ! I have a showpms command but it's not working. Every time I type /showpms it says that I'm listening ot the PM's on the server but I'm not-.. this is how my command looks like .
Код:
	
if(strcmp(cmd, "/showpms", true) == 0)
	{
	if (PlayerInfo[playerid][pAdministrator] >= 1)
	     {
                  if(AscultaPM[playerid] == 0)
              {
                   SendClientMessage(playerid, COLOR_YELLOW, "Acum asculti PM-urile de pe server.");
                   AscultaPM[playerid] = 0;
			}
			if(AscultaPM[playerid] == 1)
            {
                   SendClientMessage(playerid, COLOR_YELLOW, "Acum nu mai asculti PM-urile de pe servr.");
                   AscultaPM[playerid] = 1;
			}
	    }
    }
Btw, don't blame me that im using strcmp-.. It's IBP.

And this is were I'm defining it.

Код:
new AscultaPM[MAX_PLAYERS] = 0;
Reply
#2

Try this

Код:
if(strcmp(cmd, "/showpms", true) == 0)
	{
	if (PlayerInfo[playerid][pAdministrator] >= 1)
	     {
                  if(AscultaPM[playerid] == 0)
              {
                   SendClientMessage(playerid, COLOR_YELLOW, "Acum asculti PM-urile de pe server.");
                   AscultaPM[playerid] = 1;
			}
			if(AscultaPM[playerid] == 1)
            {
                   SendClientMessage(playerid, COLOR_YELLOW, "Acum nu mai asculti PM-urile de pe servr.");
                   AscultaPM[playerid] = 0;
			}
	    }
    }
Reply
#3

Still not working. Now it sends me the SendClientMessages..
Reply
#4

Of course it won't work...You need to edit the /pm command too.
Reply
#5

lel-.. of course it's edited. Just gimme' 5 minutes, I tried something.

No.. not working..
That's the /showpms command now .

Код:
	if(strcmp(cmd, "/showpms", true) == 0)
	{
		if (PlayerInfo[playerid][pAdministrator] >= 1)
		{
			if(AscultaPM[playerid] == 0)
 			{
 				SendClientMessage(playerid, COLOR_YELLOW, "Acum asculti PM-urile de pe server.");
   				AscultaPM[playerid] = 1;
			}
			if(AscultaPM[playerid] == 1)
   			{
    			SendClientMessage(playerid, COLOR_YELLOW, "Acum nu mai asculti PM-urile de pe servr.");
     			AscultaPM[playerid] = 0;
			}
		}
	}
And that's the /PM command-..

Код:
	if(strcmp(cmd, "/pm", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(Muted[playerid])
			{
				SendClientMessage(playerid, COLOR_LIGHTRED, "Ai mute.");
				return 1;
			}
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "{FFFFFF}Folosire{696969}: /pm [playerid/partofname] [text]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if(IsPlayerConnected(giveplayerid))
			{
			    if(giveplayerid != INVALID_PLAYER_ID)
			    {
					GetPlayerName(playerid, sendername, sizeof(sendername));
					GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
					if(PMsEnabled[giveplayerid] == 0)
			        {
			            SendClientMessage(playerid, COLOR_LIGHTRED, "Playerul are inchise PM-urile.");
			            return 1;
			        }
					new length = strlen(cmdtext);
					while ((idx < length) && (cmdtext[idx] <= ' '))
					{
						idx++;
					}
					new offset = idx;
					new result[256];
					while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
					{
						result[idx - offset] = cmdtext[idx];
						idx++;
					}
					result[idx - offset] = EOS;
					if(!strlen(result))
					{
						SendClientMessage(playerid, COLOR_GRAD2, "{FFFFFF}Folosire{696969}: /pm [playerid/partofname] [text]");
						return 1;
					}
					if(Muted[playerid] == 1)
					{
					    SendClientMessage(playerid, COLOR_LIGHTRED, "Ai mute.");
					    return 1;
					}
					if(BlockPMPerson[giveplayerid][playerid] == 1)
					{
					    SendClientMessage(playerid, COLOR_LIGHTRED, "Userul are PM-ul blocat!");
					    return 1;
					}
		     		new str[128];
					if(strlen(result) > MAXLEN)
					{
					    new pos = MAXLEN;
					    //while(result[--pos] < ' ') {}
					    if(pos < MAXLEN-1) pos = MAXLEN;
					    format(str, sizeof(str), "(( PM de la %s(ID:%d): %.*s ... ))", sendername, playerid, pos, (result));
						SendClientMessage(giveplayerid, COLOR_PMIN, str);
						format(str, sizeof(str), "(( PM de la %s(ID:%d): ... %s ))", sendername, playerid, (result)[pos]);
						SendClientMessage(giveplayerid, COLOR_PMIN, str);
						format(str, sizeof(str), "(( PM trimis catre %s(ID:%d): %.*s ... ))", giveplayer, giveplayerid, pos, (result));
						SendClientMessage(playerid, COLOR_PMOUT, str);
						format(str, sizeof(str), "(( PM trimis catre %s(ID:%d): ... %s ))", giveplayer, giveplayerid, (result)[pos]);
						SendClientMessage(playerid, COLOR_PMOUT, str);
						printf("%s",str);
						for(new i = 0; i<MAX_PLAYERS; i++)
                        {
                            if(AscultaPM[i] == 1)
                            {
						       format(str, sizeof(str), "[SHOW-PMS] Mesaj de la %s pentru %s: %s", giveplayer, sendername, (result));
						       SendClientMessage(i, COLOR_PMIN, str);
			                }
                        }
						// PM log
						format(str, sizeof(str), "(( PM trimis catre %s[catre %s]: %.*s ... ))", giveplayer, sendername, pos, (result));
						PMLog(str);
						format(str, sizeof(str), "(( PM trimis catre %s[catre:%s]: ... %s ))", giveplayer, sendername, (result)[pos]);
						PMLog(str);
					}
					else
					{
					    format(str, sizeof(str), "(( PM de la %s(ID:%d): %s ))", sendername, playerid, (result));
						SendClientMessage(giveplayerid, COLOR_PMIN, str);
						format(str, sizeof(str), "(( PM trimis catre %s(ID:%d): %s ))", giveplayer, giveplayerid, (result));
						SendClientMessage(playerid, COLOR_PMOUT, str);
						printf("%s",str);
						// PM log
						format(str, sizeof(str), "(( PM de la %s[pentru: %s]: %s ))", giveplayer, sendername, (result));
						PMLog(str);
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_LIGHTRED, "Playerul nu este activ.");
			}
		}
		return 1;
	}
Btw, don't you think that the /showpms command should return a value ? ?
Reply
#6

It is hard to understand your code but if this is the part where it's supposed to show the message to admins then change this
Код:
format(str, sizeof(str), "(( PM de la %s(ID:%d): %s ))", sendername, playerid, (result));
						SendClientMessage(giveplayerid, COLOR_PMIN, str);
						format(str, sizeof(str), "(( PM trimis catre %s(ID:%d): %s ))", giveplayer, giveplayerid, (result));
						SendClientMessage(playerid, COLOR_PMOUT, str);
						printf("%s",str);
						// PM log
						format(str, sizeof(str), "(( PM de la %s[pentru: %s]: %s ))", giveplayer, sendername, (result));
						PMLog(str);
To this

Код:
format(str, sizeof(str), "(( PM de la %s(ID:%d): %s ))", sendername, playerid, (result));
						SendClientMessage(i, COLOR_PMIN, str);
						format(str, sizeof(str), "(( PM trimis catre %s(ID:%d): %s ))", giveplayer, giveplayerid, (result));
						SendClientMessage(i, COLOR_PMOUT, str);
						printf("%s",str);
						// PM log
						format(str, sizeof(str), "(( PM de la %s[pentru: %s]: %s ))", giveplayer, sendername, (result));
						PMLog(str);
And I never used strcmp for commands before so IDK if you should return something or not. Probably not but you could return 1 if you want.
Reply
#7

Hmm-.. still not working,
Reply
#8

1, Your code is messy as fuck.
2, Might just be me.. but I see no check for anyone who has "AscultaPM" Turned on / off

In the /pm command...

Add a check so..
Код:
ForEach(Player, I) {
      if(IsPlayerConnected(I)) {
           if(AscultaPM[i] ==  what ever value = on) 
                format(YOUR PM SHIT FROM SENDER TO RECIEVER)
example above


Also
Fixed below
PHP код:
if(strcmp(cmd"/showpms"true) == 0) {
    if(
PlayerInfo[playerid][pAdministrator] >= 1) {
        if(
AscultaPM[playerid] == 0) {
            
SendClientMessage(playeridCOLOR_YELLOW"Acum asculti PM-urile de pe server.");
            
AscultaPM[playerid] = 1;
        }
        if(
AscultaPM[playerid] == 1) {
            
SendClientMessage(playeridCOLOR_YELLOW"Acum nu mai asculti PM-urile de pe servr.");
            
AscultaPM[playerid] = 0;
        }
    }

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)