Chatting with ClientMessages.
#1

Hello, everyone.

Basically, the script should send a ClientMessage to everyone in the radius of the player who "spoke" (so-to-speak). However, no messages pop up. I couldn't try this with multiple people, as I haven't port forwarded, and I haven't multiple computers. I do this so I have a little more control of how the message is styled.

No syntax errors or warnings.

P.S. - I haven't an idea if there is a method to see how many players are connected in total, so I have a variable which iterates up, or down, when a user [(dis)connects].


pawn Код:
#include <a_samp>

new players = 0;

public OnPlayerConnect(playerid) {
    players++;
}

public OnPlayerDisconnect(playerid) {
    players--;
}

public OnPlayerText(playerid, text[]) {
    new name[256], message[256];
    new Float:x, Float:y, Float:z;

    GetPlayerName(playerid, name, sizeof(name));
    format(message, sizeof(message), "%s says, \"%s\"",  name, text);
   
    for (new id = 0; id >= players; id++) {
        if (IsPlayerConnected(id) && IsPlayerInRangeOfPoint(id, 20.0, x, y, z)) {
            SendClientMessage(id, -1, message);
        }
    }
   
    return 0;
}
Reply


Messages In This Thread
Chatting with ClientMessages. - by SHRP - 01.01.2013, 09:08
Re: Chatting with ClientMessages. - by [HiC]TheKiller - 01.01.2013, 09:32
Re: Chatting with ClientMessages. - by SHRP - 01.01.2013, 09:47
Re: Chatting with ClientMessages. - by SHRP - 01.01.2013, 11:27

Forum Jump:


Users browsing this thread: 2 Guest(s)