31.12.2015, 06:58
So yeah,I've been trying to make a chemical system which is basically a drug system.
In this system when I use crack I get a 5 second timer where I can use chemicals which give me even more armor.
The problem is that I can only use chemicals once within that 5 second timer.
Can someone help me?
Here's the code
This is my use chems code below
Here is all the New,Forward,and Public
Pls Don't bash me about my bad coding skills,I've been learning it only for a few days
In this system when I use crack I get a 5 second timer where I can use chemicals which give me even more armor.
The problem is that I can only use chemicals once within that 5 second timer.
Can someone help me?
Here's the code
Код:
CMD:usecrack(playerid,params[]) //Where I use crack// { GetPlayerArmour(playerid, Armour); if(crack < 2) { SendClientMessage(playerid, COLOR_RED, "You don't have enough crack"); return 1; } else if(Armour > 99) { SendClientMessage(playerid, COLOR_RED, "You have enough armour"); return 1; } else { crack -= 2; SendClientMessage(playerid, COLOR_GREEN, "You've used some crack"); SetPlayerArmour(playerid, Armour+10); SetTimerEx("Chem", 5000, false, "i", playerid); ChemTimer = 1; return 1; } }
Код:
CMD:usechems(playerid, params[]) { if(chems < 2) { SendClientMessage(playerid, COLOR_RED, "You don't have enough chems"); return 1; } else if(ChemTimer == 0) { SendClientMessage(playerid, COLOR_RED, "You need to use crack first inorder to use chems"); return 1; } else if(Armour > 99) { SendClientMessage(playerid, COLOR_RED, "You have enough armour"); return 1; } else { chems -= 2; SendClientMessage(playerid, COLOR_RED, "You've used some chems"); SetPlayerArmour(playerid, Armour+20); return 1; } }
Код:
new pot,crack,chems; new Float:Armour; forward Chem(playerid); new ChemTimer; public Chem(playerid) { ChemTimer = 0; return 1; }