CMD:buygun(playerid, params[]) { if(!IsAtAmmu(playerid)) { SendClientMessage(playerid, COLOR_GRAD2, " You are not in a Ammunation Shop"); return 1; } else { ShowPlayerDialog(playerid, 30001, DIALOG_STYLE_LIST, "Ammunation Shop", "Shotgun (5000)\nMp5 (20000)\nDeagle (35000)\nM4 (75000)\nFullVest (3000)", "Buy", "Cancel"); } return 1; }
Use a timer.
There are some tutorials out there too: https://sampforum.blast.hk/showthread.php?tid=245358 |
This forum requires that you wait 120 seconds between posts. Please try again in 74 seconds. |
Follow a tutorial then? Giving you the raw code won't help you understand it.
^ It's killing me slowly. |
//top of the script new GunBuyCD; forward GunBuyCD(playerid); public GunBuyCD(playerid) { //Add here what do you want of the script to do after 5 seconds expire GunBuyCD = 0; //After the cooldown is over we are setting it to 0 SendClientMessage(playerid, COLOR, "<!>You can now use /buygun!"); return 1; } CMD:buygun(playerid, params[]) { if(GunBuyCD == 0) //If doesnt have cooldown { SetTimerEx("GunBuyCD", 5000, false, "i", playerid); //Setting 5 sec cooldown GunBuyCD = 1; //Setting the cooldown to 1 //GivePlayerWeapon or whatver you want to add here return 1; } else { SendClientMessage(playerid, COLOR_RED, "<!>On a cooldown!"); //Sending message if he/she is on a cooldown } return 1; }