Buydrugs help
#1

The variable is
pawn Код:
enum pInfo
{
    drugs//the variable that will store the player's amount of drugs he have.
}
Here is the code to check how much drugs you have
pawn Код:
CMD:dinv(playerid,params[])//creating a checkweed cmd.
{
    new string[128];//this is the variable which will store the info of the message we will send to the player.
    format(string,sizeof(string),"You have %d drugs on you!",PlayerInfo[playerid][drugs]);//formating the message we will send to the player the info of his drugs.
    SendClientMessage(playerid,-1,string);//sending the formated message.
    return 1;
}
I want to make a little code to /buydrugs amount
Can someone help?
Thanks!
Reply
#2

look at this.
Reply
#3

pawn Код:
CMD:buydrugs(playerid. params[])
{
    new amount;
    if(sscanf(params,"i",amount)) return SendClientMessage(playerid, -1, "USAGE:/buydrugs (Amount)");
   
    if(amount > 0)
    {
        new str[128];
        PlayerInfo[playerid][drugs] = amount;
        GivePlayerMoney(playerid, -( amount * 10)); // change 10 for the price of 1 drug
        format(str, sizeof(str), " You have Bought %d Drugs", amount);
    }
}
Reply
#4

thanks mahdi499
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)