SA-MP Forums Archive
A single SendClientMessage SPAMMING - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: A single SendClientMessage SPAMMING (/showthread.php?tid=655494)



A single SendClientMessage SPAMMING - div - 22.06.2018

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..


Re: A single SendClientMessage SPAMMING - Mike861 - 22.06.2018

Under what callback is this code?


Re: A single SendClientMessage SPAMMING - Exhibit - 22.06.2018

Код:
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


Re: A single SendClientMessage SPAMMING - XStormiest - 22.06.2018

I think a return 0 would do the trick.


Re: A single SendClientMessage SPAMMING - div - 22.06.2018

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.


Re: A single SendClientMessage SPAMMING - Exhibit - 22.06.2018

Show us the code for the timer.


Re: A single SendClientMessage SPAMMING - Mike861 - 22.06.2018

Does return 0 work?


Re: A single SendClientMessage SPAMMING - div - 22.06.2018

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...


Re: A single SendClientMessage SPAMMING - div - 22.06.2018

Код:
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]))



Re: A single SendClientMessage SPAMMING - Mike861 - 22.06.2018

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