SA-MP Forums Archive
cmd with settimerex - 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: cmd with settimerex (/showthread.php?tid=601998)



cmd with settimerex - Deny1 - 29.02.2016

Код:
CMD:getgift(playerid, params[])
{
	for(new i=0;i<sizeof(GiftInfo);i++)
	{
		if(IsPlayerInRangeOfPoint(playerid,5,GiftInfo[i][pokX],GiftInfo[i][pokY],GiftInfo[i][pokZ]))
		{
		    if(IsValidDynamicObject(GiftObj[i]))
		    {
	            DestroyDynamic3DTextLabel(PLabel[i]);
			    DestroyDynamicObject(GiftObj[i]);
			    SetTimerEx("MakeGift", 600000, false,"i",i);
		 		new money = random(5000);
				GiveHimScore(playerid, money);
				new string[128];
				format(string, 264, "%s is take gift and get {FFFFFF}%d$",             PlayerName(playerid), money);
				SCMToAll(-1, string);
   			  } 
		}
	}
	}
	return 1;
}
This is my getgift cmd how to make with settimerex to player can use she every 10 minutes only


Re: cmd with settimerex - sampkinq - 29.02.2016

My English is bad, I might have misunderstood.

Код:
CMD:getgift(playerid, params[])
{
if(GetPVarInt(playerid, "CommandBlock") > GetTickCount()) return SendClientMessage(playerid, 0xFF0000FF,"You have to wait 10 minutes to use this command again.");
SetPVarInt(playerid, "CommandBlock", GetTickCount() + 600000);

	for(new i=0;i<sizeof(GiftInfo);i++)
	{
		if(IsPlayerInRangeOfPoint(playerid,5,GiftInfo[i][pokX],GiftInfo[i][pokY],GiftInfo[i][pokZ]))
		{
		    if(IsValidDynamicObject(GiftObj[i]))
		    {
	            DestroyDynamic3DTextLabel(PLabel[i]);
			    DestroyDynamicObject(GiftObj[i]);
			    SetTimerEx("MakeGift", 600000, false,"i",i);
		 		new money = random(5000);
				GiveHimScore(playerid, money);
				new string[128];
				format(string, 264, "%s is take gift and get {FFFFFF}%d$",             PlayerName(playerid), money);
				SCMToAll(-1, string);
   			  } 
		}
	}
	}
	return 1;
}



Re: cmd with settimerex - Deny1 - 29.02.2016

i want with timer..