SA-MP Forums Archive
SendClientMessage Help, man! - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SendClientMessage Help, man! (/showthread.php?tid=179604)



SendClientMessage Help, man! - sekol - 27.09.2010

So i'm trying to make my own turf script, and if i fail to stay in point for 30 secs it should send a message "Noob Failed" And it does but it spams me this text 15 times!
Код:
/////Above this i have a function that calls this timer if player entered defined point////////
forward SAMSITEcheck(playerid);
public SAMSITEcheck(playerid)
{
	new timer1;
	SAMSITECheckDelay += 2;
	timer1 = SetTimerEx("SAMSITEcheck", 2000, false, "d", playerid);
	if(SAMSITECheckDelay == 30)
	{
	    GangZoneStopFlashForAll(SAMSITE);
	    if(gTeam[playerid] == EA)
	    {
	        SAMSITEO = 1;
	        SAMSITECheckDelay = 0;
		}
  		if(gTeam[playerid] == AE)
	    {
	        SAMSITEO = 2;
	        SAMSITECheckDelay = 0;
		}
		if(gTeam[playerid] == USA)
	    {
	        SAMSITEO = 3;
	        SAMSITECheckDelay = 0;
		}
		if(gTeam[playerid] == SA)
	    {
	        SAMSITEO = 4;
	        SAMSITECheckDelay = 0;
		}
	}
	if(!IsPlayerInRangeOfPoint(playerid, 3.0, -782.4177, 2417.32, 15))
	{
 	    KillTimer(timer1);
	    SendClientMessage(playerid, COLOR_RED, "Noob :D Failed");///I get this MSG spamed.
	}
}



Re: SendClientMessage Help, man! - Las Venturas CNR - 27.09.2010

Return 1;?
A few of my scripts have spammed some shit or
have not worked at all due to a return not being there...


Re: SendClientMessage Help, man! - sekol - 27.09.2010

Код:
	if(!IsPlayerInRangeOfPoint(playerid, 3.0, -782.4177, 2417.32, 15))
	{
 	    KillTimer(timer1);
	    SendClientMessage(playerid, COLOR_RED, "Noob :D Failed");///I get this MSG spamed.
	}
         return 1;
}
Even with return it spams


Re: SendClientMessage Help, man! - mmrk - 27.09.2010

Because player isnt in range of point
Quote:

'' !IsPlayerInRangeOfPoint ''

Timer checks that, and if your not in range of point it will spam that text..


Re: SendClientMessage Help, man! - Conroy - 27.09.2010

pawn Код:
forward SAMSITEcheck(playerid);
new RecievedFailMessage[MAX_PLAYERS];
public SAMSITEcheck(playerid)
{
    new timer1;
    SAMSITECheckDelay += 2;
    timer1 = SetTimerEx("SAMSITEcheck", 2000, false, "d", playerid);
    if(SAMSITECheckDelay == 30) {
        GangZoneStopFlashForAll(SAMSITE);
        if(gTeam[playerid] == EA) {
            SAMSITEO = 1;
            SAMSITECheckDelay = 0;
            return 1;
        }
        if(gTeam[playerid] == AE) {
            SAMSITEO = 2;
            SAMSITECheckDelay = 0;
            return 1;
        }
        if(gTeam[playerid] == USA) {
            SAMSITEO = 3;
            SAMSITECheckDelay = 0;
            return 1;
        }
        if(gTeam[playerid] == SA) {
            SAMSITEO = 4;
            SAMSITECheckDelay = 0;
            return 1;
        }
    }
    if(!IsPlayerInRangeOfPoint(playerid, 3.0, -782.4177, 2417.32, 15) && !RecievedFailMessage[playerid]) {
        KillTimer(timer1);
        SendClientMessage(playerid, COLOR_RED, "Noob :D Failed");
        RecievedFailMessage[playerid] = 1;
        return 1;
    } else RecievedFailMessage[playerid] = 0;
}



Re: SendClientMessage Help, man! - willsuckformoney - 27.09.2010

maybe your timer makes it spam?


Re: SendClientMessage Help, man! - Conroy - 27.09.2010

Quote:
Originally Posted by willsuckformoney
Посмотреть сообщение
maybe your timer makes it spam?
Of course it is. I fixed it for him in my previous post. Checking a variable, doing some code and changing the variable stops the spam of code. Then changing it back if the conditions are different.


Re: SendClientMessage Help, man! - sekol - 28.09.2010

It still spams me this text....