SA-MP Forums Archive
+1 for help,repeat sendclientmessage - 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: +1 for help,repeat sendclientmessage (/showthread.php?tid=647167)



+1 for help,repeat sendclientmessage - Longover - 30.12.2017

Hello!
I'm have a big problem:
When im type /oplace is repeat message a million times
WTF?
Why?
Message:
Код:
{98AFC7}Evenimentul GIFTBOX a fost pornit de catre admin %s! [/GIFTBOX]
Full code:
Код:
dcmd_oplace(playerid, params[])
{
	#pragma unused params
	if(AccountInfo[playerid][aLevel] <= 9) return SCM(playerid, ERROR, "Trebuie sa fii admin 10 pentru a putea pune un giftbox");
	else if(IsPlayerConnected(playerid) == 0) return SCM(playerid, ERROR, "Trebuie sa fii conectat pentru a putea porni giftbox");
 	else
	{
	    new Float:x, Float:y, Float:z, Float:a, name[60], stringgb[200];
	    GetPlayerFacingAngle(playerid, a);
	    GetPlayerName(playerid, name, 60);
	    GetPlayerPos(playerid, Float:x, Float:y, Float:z);
        CreateObject(19056, x, y, z, 0, 0, 0);
        GiftStarted = true;
        Create3DTextLabel("{FFA500}GIFTBOX!\n{00FF00}Scrie /getgift pentru a\n{00FF00}primi un {FF00FF}CADOU!", 0x008080FF, x, y, z, 0, 0, 0);
		format(stringgb, 200, "{98AFC7}Evenimentul GIFTBOX a fost pornit de catre admin %s! [/GIFTBOX]", name);
		SendClientMessageToAll(COLOR_LIGHTCYAN, stringgb);
		for(new i=0; i< MAX_PLAYERS; i++)
		AccountInfo[i][GiftHours] = 3;
        }
	return 1;
}
SCM = SendClientMessage

+1 FOR HELP!

(sorry for my bad english)


Re: +1 for help,repeat sendclientmessage - Ritzy2K - 30.12.2017

Код:
dcmd_oplace(playerid, params[])
{
	if(AccountInfo[playerid][aLevel] <= 9) return SCM(playerid, ERROR, "Trebuie sa fii admin 10 pentru a putea pune un giftbox");

	 if(IsPlayerConnected(playerid) == 0) return SCM(playerid, ERROR, "Trebuie sa fii conectat pentru a putea porni giftbox");

	    new Float:x, Float:y, Float:z, Float:a, name[26], stringgb[126];
	    GetPlayerFacingAngle(playerid, Float:a);
	    GetPlayerName(playerid, name, 30);
	    GetPlayerPos(playerid, Float:x, Float:y, Float:z);
            CreateObject(19056, x, y, z, 0, 0, 0);
            GiftStarted = true;
            Create3DTextLabel("{FFA500}GIFTBOX!\n{00FF00}Scrie /getgift pentru a\n{00FF00}primi un 
            {FF00FF}CADOU!", 0x008080FF, x, y, z, 0, 0, 0);
	     format(stringgb, 200, "{98AFC7}Evenimentul GIFTBOX a fost pornit de catre admin %s! [/GIFTBOX]", 
             name);
		SendClientMessageToAll(COLOR_LIGHTCYAN, stringgb);

		for(new i=0; i< MAX_PLAYERS; i++)
               {
		    AccountInfo[i][GiftHours] = 3;
               }
	return 1;
}
I guess the braces with for loop should help. Anyway, I cleaned the code a little.