Takedrug problem
#1

Hello,i've done this small /takedrug command,but i need help:

pawn Код:
CMD:td(playerid,params[])
{
    if(PlayerInfo[playerid][pDrug] == 0) return SendClientMessage(playerid,0xFF0000FF,"You dont have any drug! Buy it from refill points.");
    if(PlayerInfo[playerid][pJailed] == 1) return SendClientMessage(playerid, red, "You cannot use this command in jail.");
    if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,red,"You can't take drugs if you are in a vehicle.");
    if(IsRobbing[playerid] == 1) return SendClientMessage(playerid,0xFF0000FF,"You can't take drugs while robbing a place.");
    if(IsBankRobbing[playerid] == 1) return SendClientMessage(playerid,0xFF0000FF,"You can't take drugs while robbing a bank..");
    if(GetPVarInt(playerid,"DrugTime")>GetTickCount())return SendClientMessage(playerid,0xFF0000FF,"Please wait 1 minute before taking drug again.");
    new Float:phealth;
    new string[128];
    GetPlayerHealth(playerid,phealth);
    if(phealth == 90)
    {
        SendClientMessage(playerid,red,"Your health is already full.You don't need to take drugs.");
        return 1;
    }
    SendClientMessage(playerid,yellow,"***Drug Taken***");
    SendClientMessage(playerid,yellow,"***Drug Taken,your health will refill automatically.***");
    SetPlayerHealth(playerid,phealth+5);
    PlayerInfo[playerid][pDrug] --;
    SetPVarInt(playerid,"DrugTime",GetTickCount()+60000);

    format(string,sizeof(string),"3[FOOD EATEN] %s(%d)'s health has increased slightly from taking drugs.",pNick(playerid),playerid);
    IRC_GroupSay(gGroupID,IRC_CHANNEL,string);
    return 1;
}
How to allow players taking their own quantity of drugs?At now,players can use just /td and take 1 gr of drugs,i need to do like: Usage: /td grams

Thank you very much.
Reply
#2

pawn Код:
if(sscanf(params,"d",grams)) return usage /ts grams
else playerinfo[playerid][drugs] - grams,
guess you know how to use it? Cant help you very good right how.
Reply
#3

Yes i know,thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)