Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- forward drugupdate(playerid);
- forward drugended(playerid);
- CMD:takedrugs(playerid,params[])
- {
- new amount,str1[128];
- if(var[playerid][LoginCheck] == 0) return SendClientMessage(playerid,COLOR_RED,"You Must Login Before Using Any Command.");
- if(blocktd == 1) return SendClientMessage(playerid,COLOR_RED,"The Command /takedrugs Has Been Disabled By The Administration.");
- if(var[playerid][Spawned] == 0) return SendClientMessage(playerid,COLOR_RED,""DEAD_ERROR"");
- if(pInfo[playerid][Jailed] >= 1) return SendClientMessage(playerid,COLOR_RED,"You Cannot Use This Command In Jail.");
- if(var[playerid][aduty] == 1) return SendClientMessage(playerid,COLOR_RED,"You Cannot Use This Command While You Are An Admin On Duty.");
- if(var[playerid][Frozen] == 1) return SendClientMessage(playerid,COLOR_RED,""FROZEN_ERROR"");
- if(IsSpecing[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,"You Cannot Use This Command While You Are Spectating.");
- if(sscanf(params,"d",amount)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /takedrugs (Amount)");
- if(pInfo[playerid][Drugs] < amount)
- {
- format(str1,sizeof(str1),"You Do Not Have %d Grams Drugs. You Are Carrying %d Grams Of Drugs.",amount,pInfo[playerid][Drugs]);
- SendClientMessage(playerid,COLOR_RED,str1);
- return 1;
- }
- if(var[playerid][ODWarn] == 1) return SendClientMessage(playerid,COLOR_RED,"You Cannot Take Drugs While You Are Suffering From A Drug Overdose.");
- else
- {
- KillTimer(drugkill[playerid]);
- KillTimer(drugend[playerid]);
- pInfo[playerid][Drugs] -=amount;
- pInfo[playerid][OnDrugs]+=amount;
- str1,sizeof(str1),"You Are Now On Drugs. %d Grams Remaining.",pInfo[playerid][Drugs]);
- SendClientMessage(playerid,COLOR_LIGHTBLUE,str1);
- GameTextForPlayer(playerid,"~w~On Drugs",5000,3);
- ApplyAnimation(playerid,"SMOKING","M_smk_in",4,0,0,0,0,0,0);
- SetPlayerChatBubble(playerid, "On Drugs", COLOR_YELLOW, 100.0, 5000);
- drugkill[playerid] = SetTimerEx("drugupdate",3*1000,true,"i",playerid);
- drugend[playerid] = SetTimerEx("drugended",pInfo[playerid][OnDrugs]*3*1000,false,"i",playerid);
- }
- return 1;
- }
- public drugupdate(playerid)
- {
- pInfo[playerid][OnDrugs] --;
- new Float:Health[MAX_PLAYERS];
- GetPlayerHealth(playerid,Health[playerid]);
- if(Health[playerid] > 98.0)
- {
- SetPlayerHealth(playerid,98.0);
- return 1;
- }
- else if(Health[playerid] < 98.0)
- {
- SetPlayerHealth(playerid,Health[playerid] + 5.0);
- GetPlayerHealth(playerid,Health[playerid]);
- if(Health[playerid] > 98.0)
- {
- SetPlayerHealth(playerid,98.0);
- }
- }
- return 1;
- }
- public drugended(playerid)
- {
- KillTimer(drugkill[playerid]);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement