A single SendClientMessage SPAMMING
#1

Hello, I just made a single sendclientmessage, it's spamming the chat, also, since its a robbery system, its supposed to give me money, it gives me money around 10 times or more..



here's the code
Код:
new RandMoney = random(369);
	    GivePlayerMoney(playerid, RandMoney);
		new msg[128], sName[24];
		GetPlayerName(playerid, sName, 24);
		format(msg, 128, "%s(%d) has robbed $%d.", sName, playerid, RandMoney);
		SendClientMessageToAll(-1, msg);

and this is how it spams..


Код:
[19:26:58] HELLO

[19:26:58] TerminatedTERM(0) has robbed $343.

[19:26:58] HELLO

[19:26:58] TerminatedTERM(0) has robbed $304.

[19:26:58] HELLO

[19:26:59] TerminatedTERM(0) has robbed $39.

[19:26:59] HELLO

[19:26:59] TerminatedTERM(0) has robbed $248.

[19:26:59] HELLO

[19:26:59] TerminatedTERM(0) has robbed $289.

[19:26:59] HELLO

[19:26:59] TerminatedTERM(0) has robbed $252.

[19:26:59] HELLO

[19:26:59] TerminatedTERM(0) has robbed $111.

[19:26:59] HELLO

[19:26:59] TerminatedTERM(0) has robbed $153.

[19:26:59] HELLO

[19:26:59] TerminatedTERM(0) has robbed $208.

[19:26:59] HELLO

[19:26:59] TerminatedTERM(0) has robbed $208.

[19:26:59] HELLO

[19:26:59] TerminatedTERM(0) has robbed $88.

[19:26:59] HELLO

[19:26:59] TerminatedTERM(0) has robbed $130.

[19:26:59] HELLO
It's just a small example, it spams the chat even more..




Please help



EDIT: NOT GETTING ANY WARNING WHILE COMPILING THE GAMEMODE..
Reply
#2

Under what callback is this code?
Reply
#3

Код:
new RandMoney = random(369);
	    GivePlayerMoney(playerid, RandMoney);
		new msg[128], sName[24];
		GetPlayerName(playerid, sName, 24);
		format(msg, 128, "%s(%d) has robbed $%d.", sName, playerid, RandMoney);
		SendClientMessageToAll(-1, msg);
                break;
try this
Reply
#4

I think a return 0 would do the trick.
Reply
#5

error 024: "break" or "continue" is out of context


and @Mike, it's a command, and i've used like 6-7 SetTimers, for updating the textdraw..

That was the LAST TIMER.
Reply
#6

Show us the code for the timer.
Reply
#7

Does return 0 work?
Reply
#8

returning a value is working..



And it is still spamming, I haven't even used any other SendClientMessage in the whole command, still it's spamming..





EDIT: I'm using LOOP for checking if IsPlayerInRangeOfObject, they are 23 in total, and it is SPAMMING the chat 23 number of times...
Reply
#9

Код:
enum BodyOfSafe //the only body of the safe, doors and
{
	Float:SafeX,
	Float:SafeY,
	Float:SafeZ,
	Float:SafeRX,
	Float:SafeRY,
	Float:SafeRZ,
	worldid,
	interiorid,
};
new Float:safebody[][BodyOfSafe] =
{
    {382.546600, -56.539268, 1000.957580, 0.000000, 0.000000, 0.000000, 10, 1}, //BURGERSHOT
    {768.734619, -16.605970, 1000.065368, 0.000000, 0.000000, 0.000000, 6, 2}, //GYM

and then a LOOP
Код:
for(new i = 0; i < sizeof(safebody); i++)
	{
	if (IsPlayerInRangeOfPoint(playerid, 2.0, safebody[i][SafeX], safebody[i][SafeY], safebody[i][SafeZ]))
Reply
#10

Well i've experienced such problem in the past with a property system.Lemme see the code and figure it out if i can
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)