Help with a /pm command
#1

hello guys i have 2 questions regarding pm command

This is my command code:
PHP код:
CMD:pm(playeridparams[])
{
    new 
pIDMessage[60], string[128], string2[128], aMessage[128];
    if(
sscanf(params"us[60]"pIDMessage)) return SendClientMessage(playerid, -1"usage :/Pm [ID] [Message]");
    if(
pID == INVALID_PLAYER_ID) return SendClientMessage(playerid,-1,"ID not found ");
    
format(stringsizeof(string), "Private Message From %s (%d): %s"GetPlayerNameEx(playerid), playeridMessage);
    
format(string2sizeof(string2), "Private Message %s (%d): %s"GetPlayerNameEx(pID), pIDMessage);
    
SendClientMessage(playerid, -1string2);
    
SendClientMessage(pID, -1string);
    
PlayerPlaySound(playerid42020.00.00.0);
    
PlayerPlaySound(pID42020.00.00.0);
    
format(aMessagesizeof aMessage"%s (%d) To %s (%d): %s"GetPlayerNameEx(playerid), playeridGetPlayerNameEx(pID), pIDMessage);
    for(new 
iMAX_PLAYERSi++)
    {
        if(
PlayerInfo[i][pAdmin] >=|| IsPlayerAdmin(i))SendClientMessage(i, -1aMessage);
    }
    return 
1

First question is when a higher admin will send a pm to any players i dont want lower admin to read higher admins pm.

second question is how to make a replay pm command.

Thanks you very much
Reply
#2

PHP код:
new reply[MAX_PLAYERS];

CMD:pm(playeridparams[]) 

    new 
pIDMessage[60], string[128], string2[128], aMessage[128]; 
    if(
sscanf(params"us[60]"pIDMessage)) return SendClientMessage(playerid, -1"usage :/Pm [ID] [Message]"); 
    if(
pID == INVALID_PLAYER_ID) return SendClientMessage(playerid,-1,"ID not found "); 
    
format(stringsizeof(string), "Private Message From %s (%d): %s"GetPlayerNameEx(playerid), playeridMessage); 
    
format(string2sizeof(string2), "Private Message %s (%d): %s"GetPlayerNameEx(pID), pIDMessage); 
    
SendClientMessage(playerid, -1string2); 
    
SendClientMessage(pID, -1string); 
    
PlayerPlaySound(playerid42020.00.00.0); 
    
PlayerPlaySound(pID42020.00.00.0);
    
reply[pID] = playerid;
    
format(aMessagesizeof aMessage"%s (%d) To %s (%d): %s"GetPlayerNameEx(playerid), playeridGetPlayerNameEx(pID), pIDMessage); 
    for(new 
iMAX_PLAYERSi++) 
    { 
        if(
PlayerInfo[i][pAdmin] >=|| IsPlayerAdmin(i))
        {
            if(
PlayerInfo[playerid][pAdmin] < PlayerInfo[i][pAdmin])
            {
                
SendClientMessage(i, -1aMessage); 
            }
        }
    } 
    return 
1;  
}

CMD:r(playeridparams[])  
{
    new 
pID reply[playerid], Message[60], string[128], string2[128], aMessage[128]; 
    if(
sscanf(params"s[60]"Message)) return SendClientMessage(playerid, -1"usage :/r [Message]");

    
// ... Just do the same process with pID, which was already defined on the last message player's sent.    

Reply
#3

Quote:
Originally Posted by Fel486
Посмотреть сообщение
PHP код:
new reply[MAX_PLAYERS];
CMD:pm(playeridparams[]) 

    new 
pIDMessage[60], string[128], string2[128], aMessage[128]; 
    if(
sscanf(params"us[60]"pIDMessage)) return SendClientMessage(playerid, -1"usage :/Pm [ID] [Message]"); 
    if(
pID == INVALID_PLAYER_ID) return SendClientMessage(playerid,-1,"ID not found "); 
    
format(stringsizeof(string), "Private Message From %s (%d): %s"GetPlayerNameEx(playerid), playeridMessage); 
    
format(string2sizeof(string2), "Private Message %s (%d): %s"GetPlayerNameEx(pID), pIDMessage); 
    
SendClientMessage(playerid, -1string2); 
    
SendClientMessage(pID, -1string); 
    
PlayerPlaySound(playerid42020.00.00.0); 
    
PlayerPlaySound(pID42020.00.00.0);
    
reply[pID] = playerid;
    
format(aMessagesizeof aMessage"%s (%d) To %s (%d): %s"GetPlayerNameEx(playerid), playeridGetPlayerNameEx(pID), pIDMessage); 
    for(new 
iMAX_PLAYERSi++) 
    { 
        if(
PlayerInfo[i][pAdmin] >=|| IsPlayerAdmin(i))
        {
            if(
PlayerInfo[playerid][pAdmin] < PlayerInfo[i][pAdmin])
            {
                
SendClientMessage(i, -1aMessage); 
            }
        }
    } 
    return 
1;  
}
CMD:r(playeridparams[])  
{
    new 
pID reply[playerid], Message[60], string[128], string2[128], aMessage[128]; 
    if(
sscanf(params"s[60]"Message)) return SendClientMessage(playerid, -1"usage :/r [Message]");
    
// ... Just do the same process with pID, which was already defined on the last message player's sent.    

Another help if possible, how i can make the code like the admin who sending or reciving a pm will not see this "SendClientMessage(i, -1, aMessage); " i mean the pm which all admins will see
Reply
#4

It's easy, just make another condition.
Код:
    for(new i; i < MAX_PLAYERS; i++) 
    { 
		//Checks if the player receiving the PM isn't the one who is sending
		if( i != playerid ) {
			if(PlayerInfo[i][pAdmin] >=1 || IsPlayerAdmin(i))
			{
				if(PlayerInfo[playerid][pAdmin] < PlayerInfo[i][pAdmin])
				{
					SendClientMessage(i, -1, aMessage); 
				}
			}
		}
    }
Reply
#5

Thanks both of you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)