20.05.2014, 01:08
Hey guys, what's up? I have a little bit of a problem. I made this little /usecrack command a while ago, but upon testing it again, it works without having any crack. If you don't have any crack than it should just send you the message saying so, but it continues on to actually execute the command and get the player stoned. What is wrong?
PHP код:
CMD:usecrack(playerid, params[])
{
if(UseDrugsTimer[playerid]) return SendClientMessage(playerid,COLOR_GREY,"You must wait 5 seconds!");
if(PlayerCrackStoned[playerid] >= 2)
{
SendClientMessage(playerid, COLOR_RED, "You have used too much crack; therefore you have overdosed!");
SendClientMessage(playerid, COLOR_RED, "You must seek medical attention or you will die!");
CrackDeathTimer[playerid] = SetTimerEx("Crackdeath", 10000, true, "i", playerid);
}
if(PlayerCrackStoned[playerid] >= 0)
{
GameTextForPlayer(playerid, "~p~You begin to feel~n~~g~ The crack high!", 4000, 6);
SetPlayerDrunkLevel(playerid, 15000);
SetPlayerWeather(playerid, 2009);
if(!IsPlayerInAnyVehicle(playerid)) { ApplyAnimation(playerid,"SMOKING","M_smk_drag",4.0,0,0,0,0,0); }
}
if(PlayerDrugInfo[playerid][pCrack] >= 1)
{
new Float:armor;
GetPlayerArmour(playerid, armor);
if(armor > 80) { SetPlayerArmour(playerid, 100.0); }
else { SetPlayerArmour(playerid, armor + 10.0); }
CrackFix[playerid] = SetTimerEx("CFixWeather", 30000, false, "i", playerid);
SendClientMessage(playerid, COLOR_BLUE, "You have used a gram of crack!");
UseDrugsTimer[playerid] = 1; PlayerDrugInfo[playerid][pCrack] -= 1;
SetTimerEx("UseDrugs",5*1000,0,"i",playerid);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_RED, "You don't have any crack left!");
}
return 1;
}