Drugs amount...
#9

Quote:
Originally Posted by Macronix
Посмотреть сообщение
Try this:
pawn Код:
CMD:td(playerid,params[])//creating a use weed cmd.
{
    new tmp[128],idx;
    tmp = strtok(params, idx);
    if(!strlen(tmp))
    {
        SendClientMessage(playerid, 0xFFFFFFAA,"USAGE: /td [amount]");
        return 1;
    }
    new amount = strval(tmp);
    if(PlayerInfo[playerid][drugs] > amount)//this will check if the player has the weed or not.
    {
        new Float:Health;//the variable which will store player's health.
        GetPlayerHealth(playerid, Health);//this will get player's health and store it in the variable Health.(new Float:Health).
        SetPlayerHealth(playerid, Health +20);//this will add 20+ health to player's current health.
        PlayerInfo[playerid][drugs] -= amount;//this will minus player's amount of weed because he used some of it.
        SetTimerEx("Usedrugs", 10000, false, "d", playerid);//setting timer for the player for like 10 seconds.
        SendClientMessage(playerid, -1, "You are smoking 1 gram.");//this will send the player a message that he use one gram of weed.
    }
    else
    {
        SendClientMessage(playerid, -1, "You don't have any drugs.");//this error message will appear if he does not have weed to use.
        return 1;
    }
    return 1;
}
But i don't know how your timer callback looks like..
C:\Users\Grand\Desktop\Ultimate Gaming Ground\filterscripts\drugs.pwn(66) : error 017: undefined symbol "strtok"
C:\Users\Grand\Desktop\Ultimate Gaming Ground\filterscripts\drugs.pwn(66) : error 033: array must be indexed (variable "tmp")
C:\Users\Grand\Desktop\Ultimate Gaming Ground\filterscripts\drugs.pwn(65) : warning 203: symbol is never used: "idx"

MY TIME CALL BACK =
pawn Код:
forward Usedrugs(playerid);
public Usedrugs(playerid)
{
    SendClientMessage(playerid, -1,"The Grams you have used are finished.");
    return 1;
}
Reply


Messages In This Thread
Drugs amount... - by RandomDude - 13.07.2013, 14:21
Re: Drugs amount... - by Threshold - 13.07.2013, 15:13
Re: Drugs amount... - by arjanforgames - 13.07.2013, 15:39
Re: Drugs amount... - by JimmyCh - 13.07.2013, 15:46
Re: Drugs amount... - by RandomDude - 14.07.2013, 12:12
AW: Drugs amount... - by Macronix - 14.07.2013, 12:26
Re: Drugs amount... - by JimmyCh - 14.07.2013, 12:26
Respuesta: Drugs amount... - by Xabi - 14.07.2013, 12:34
Re: AW: Drugs amount... - by RandomDude - 14.07.2013, 12:38
Re: Respuesta: Drugs amount... - by RandomDude - 14.07.2013, 12:43

Forum Jump:


Users browsing this thread: 1 Guest(s)