SA-MP Forums Archive
Gift - 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: Gift (/showthread.php?tid=477206)



Gift - magent - 22.11.2013

Hello i want a timer of if it is able to disable the command after using it
here is the code:
Code:
	if(!strcmp(cmdtext, "/g7190", true))
	{
		new string4[658], pName[MAX_PLAYER_NAME];
		GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
		strcat(string4, "Key activated: g7190\n");
		strcat(string4, "\n");
		strcat(string4, "In this key you will have:\n");
		strcat(string4, "\n");
		strcat(string4, "10000$\n");
		strcat(string4, "2 Gold-Bars");
		ShowPlayerDialog(playerid, DIALOG_UPDATES, DIALOG_STYLE_MSGBOX, "Gift:", string4, "Okay", "");
		PlayerInfo[playerid][pCash] += 10000;
		PlayerInfo[playerid][pGoldBars] += 2;
		printf("Key activated: g7190");
		printf("Player: %s", pName);
		SetTimerEx("gKey", 3600, false, "i", playerid);
		return 1;
	}



Re: Gift - RenSoprano - 22.11.2013

pawn Code:
SetTimerEx("giftagain", 1000*60*2, false, "d", playerid); // This is your Timer put it in your command 2 mins countdown 1000 mil seconds x 60 x 2 = 120000 = 2 Mins

forward giftagain(playerid);
public giftagain(playerid);
{
    //Your code here
    return 1;
}
You can read more about Timers here


Re: Gift - magent - 22.11.2013

Thank you m8!