#1

When there is 8+ players at my server, and if you pm someone with id 8+ you pm it so someone that has id 0-7

pawn Code:
// This commands allows the player to send a private message to another player
COMMAND:pm(playerid, params[])
{
    // Setup local variables
    new OtherPlayer, Message[128], Msg1[128], Msg2[128], YourName[24], OtherPlayerName[24];

    // Send the command to all admins so they can see it
    SendAdminText(playerid, "/pm", params);

    // Check if the player has logged in
    if (APlayerData[playerid][LoggedIn] == true)
    {
        if (sscanf(params, "us[128]", OtherPlayer, Message)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/pm <OtherPlayer> <Message>\"");
        else
        {
            // Check if that other player is online
            if (IsPlayerConnected(OtherPlayer))
            {
                // Check if the player isn't muted
                if (APlayerData[playerid][Muted] == false)
                {
                    // Get both names
                    GetPlayerName(playerid, YourName, sizeof(YourName));
                    GetPlayerName(OtherPlayer, OtherPlayerName, sizeof(OtherPlayerName));
                    // Construct the message that is sent to yourself
                    format(Msg1, 128, "{808080}PM to %s{FFFFFF}: %s", OtherPlayerName, Message);
                    // Construct the message that is sent to the other player
                    format(Msg2, 128, "{A0A0A0}PM by %s{FFFFFF}: %s", YourName, Message);
                    // Send the messages
                    SendClientMessage(playerid, 0xFFFFFFFF, Msg1);
                    SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg2);
                }
                else
                    SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You are still muted");
            }
            else
                SendClientMessage(playerid, 0xFF0000FF, "Player is not online");
        }
    }
    else
     return 0;

    // Let the server know that this was a valid command
    return 1;
}
Reply
#2

Quote:
Originally Posted by NathNathii
View Post
When there is 8+ players at my server, and if you pm someone with id 8+ you pm it so someone that has id 0-7
What is that supposed to mean?

Oh and by the way, you can use the same string to send multiple messages...
Reply
#3

You must update includes. Take sscanf2 include + plugin
Reply
#4

Where can i find that?
Reply
#5

Click here
Reply
#6

Quote:
Originally Posted by MiGu3X
View Post
Nothing happens.
Reply
#7

try scan "d" instead of "u"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)