Question about this command
#2

PHP код:
CMD:usecrack(playeridparams[]) 

    if(
PlayerDrugInfo[playerid][pCrack] = 0) return SendClientMessage(playeridCOLOR_RED"You don't have any crack left!"); 
    if(
UseDrugsTimer[playerid]) return SendClientMessage(playerid,COLOR_GREY,"You must wait 5 seconds!"); 
    if(
PlayerCrackStoned[playerid] >= 2
    { 
        
SendClientMessage(playeridCOLOR_RED"You have used too much crack; therefore you have overdosed!"); 
        
SendClientMessage(playeridCOLOR_RED"You must seek medical attention or you will die!"); 
        
CrackDeathTimer[playerid] = SetTimerEx("Crackdeath"10000true"i"playerid); 
    } 
    if(
PlayerCrackStoned[playerid] >= 0
    { 
        
GameTextForPlayer(playerid"~p~You begin to feel~n~~g~ The crack high!"40006); 
        
SetPlayerDrunkLevel(playerid15000); 
        
SetPlayerWeather(playerid2009); 
        if(!
IsPlayerInAnyVehicle(playerid)) { ApplyAnimation(playerid,"SMOKING","M_smk_drag",4.0,0,0,0,0,0); } 
    } 
    new 
Float:armor
    
GetPlayerArmour(playeridarmor); 
    if(
armor 80) { SetPlayerArmour(playerid100.0); } 
    else { 
SetPlayerArmour(playeridarmor 10.0); } 
    
CrackFix[playerid] = SetTimerEx("CFixWeather"30000false"i"playerid); 
    
SendClientMessage(playeridCOLOR_BLUE"You have used a gram of crack!"); 
    
UseDrugsTimer[playerid] = 1PlayerDrugInfo[playerid][pCrack] -= 1
    
SetTimerEx("UseDrugs",5*1000,0,"i",playerid);  
    return 
1

Moved a check to see if they have any crack on them to the top. And it returns a message if they have none which will end the command right there and not do anything else.
Reply


Messages In This Thread
Question about this command - by K9IsGodly - 20.05.2014, 01:08
Re: Question about this command - by Nathan_Taylor - 20.05.2014, 01:11
Re: Question about this command - by K9IsGodly - 20.05.2014, 01:38

Forum Jump:


Users browsing this thread: 1 Guest(s)