bugged Sendclientmessage?
#1

i've recently added an agency for ad's, and when someone is out of it, i scripted this:

pawn Код:
for(new i = 0; i < sizeof(BizInfo); i++)
            {
                if(!IsPlayerInRangeOfPoint(playerid,25.0,822.1263,2.8237,1004.1797))
                {
                    SendClientMessage(playerid, COLOR_WHITE, "You are not in an advertising agency or at the desk");
                }
But it ends up bugging your whole screen with

Example: Sorry 4 the spam

You are not in an advertising agency or at the desk
You are not in an advertising agency or at the desk
You are not in an advertising agency or at the desk
And your whole chatbox gets filled up.. any solutions?
Reply
#2

pawn Код:
for(new i = 0; i < sizeof(BizInfo); i++)
            {
                if(!IsPlayerInRangeOfPoint(i,25.0,822.1263,2.8237,1004.1797))
                {
                    SendClientMessage(i, COLOR_WHITE, "You are not in an advertising agency or at the desk");
                }
Reply
#3

variables, obviously

pawn Код:
new
    bool: sendMsg[ MAX_PLAYERS ]
;

public OnPlayerConnect( playerid )
{
    sendMsg[ playerid ] = true;

    return 1;
}

// ...

for(new i = 0; i < sizeof(BizInfo); i++)
            {
                if(!IsPlayerInRangeOfPoint(playerid,25.0,822.1263,2.8237,1004.1797))
                {
                    if ( sendMsg[ playerid ] ) {
                    SendClientMessage(playerid, COLOR_WHITE, "You are not in an advertising agency or at the desk");
                    sendMsg[ playerid ] = false;
                    } }
EDIT: wtf? loop?
Why do you even need that loop?

pawn Код:
if ( !IsPlayerInRangeOfPoint( ... ) )
    return SendClientMessage( playerid, COLOR_WHITE, "You are not in an advertising agency or at the desk." );
Reply
#4

Wrong.
Imagine bizinfo is 25.
It will loop 25 times to check if he's in range of point, if he is, send 25 times.
So I'd just do
pawn Код:
if(!IsPlayerInRangeOfPoint(playerid,25.0,822.1263,2.8237,1004.1797))
                {
                    SendClientMessage(playerid, COLOR_WHITE, "You are not in an advertising agency or at the desk");
                }
Reply
#5

Quote:
Originally Posted by Basicz
Посмотреть сообщение
variables, obviously

pawn Код:
new
    bool: sendMsg[ MAX_PLAYERS ]
;

public OnPlayerConnect( playerid )
{
    sendMsg[ playerid ] = true;

    return 1;
}

// ...

for(new i = 0; i < sizeof(BizInfo); i++)
            {
                if(!IsPlayerInRangeOfPoint(playerid,25.0,822.1263,2.8237,1004.1797))
                {
                    if ( sendMsg[ playerid ] ) {
                    SendClientMessage(playerid, COLOR_WHITE, "You are not in an advertising agency or at the desk");
                    sendMsg[ playerid ] = false;
                    } }
Try it.
No, I don't see how would that help.
His mistake was, doing a loop but still using the player's id.
Reply
#6

You got the weird thing.

HIS MISTAKE WAS : Running an unused loop.
Reply
#7

Quote:
Originally Posted by Basicz
Посмотреть сообщение
You got the weird thing.

HIS MISTAKE WAS : Running an unused loop.
So what did I just explained?
Reply
#8

Quote:
Originally Posted by Basicz
Посмотреть сообщение
You got the weird thing.

HIS MISTAKE WAS : Running an unused loop.
Yes.
And why did you just make some vars to send a message?
Reply
#9

Sorry for being off topic,

@ FireCat,
Sorry, didn't see your post, and I was talking to [MWR]Blood.

@ [MWR]Blood
I misunderstood it. I didn't see he runs a unused loop. Sorry.
Reply
#10

Quote:
Originally Posted by [MWR]Blood
Посмотреть сообщение
pawn Код:
for(new i = 0; i < sizeof(BizInfo); i++)
            {
                if(!IsPlayerInRangeOfPoint(i,25.0,822.1263,2.8237,1004.1797))
                {
                    SendClientMessage(i, COLOR_WHITE, "You are not in an advertising agency or at the desk");
                }
Thank you. + rep.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)