SA-MP Forums Archive
Drug and Animation Systems - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Drug and Animation Systems (/showthread.php?tid=299421)



Drug and Animation Systems - viosteaua98 - 25.11.2011

i need a drug system where i need command /takedrugs [/td]
Where health increase for ex: i have almost 10 hp health so i /td 10 hp 20hp 30hp.......to 100hp


Sit animations ex: /sit 8 for stop it enter
ex: /dance 3 enter stop


Re: Drug and Animation Systems - Rob_Maate - 25.11.2011

pawn Код:
if(strcmp(cmdtext, "/td", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(Drugs[playerid] > 1) //or whatever your variable for storing drugs is
            {
                new Float:health;
                GetPlayerHealth(playerid, health);
                SetPlayerHealth(playerid, health + 10.0);
                SendClientMessage(playerid, COLOR_GREY, "  You used 1g of your drugs.");
                Drugs[playerid] -= 1;
               
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   You dont have any drugs.");
            }
        }//not connected
        return 1;
    }



Re: Drug and Animation Systems - viosteaua98 - 25.11.2011

how can i give player 500 drugs?
and when player type /td he will take 5g not 1g


Re: Drug and Animation Systems - Rob_Maate - 25.11.2011

Use this... I haven't tested it so I'm not sure if it will compile
Also I have left out some parts where you will need to fill in your own variables.

But this command will allow you to give any player any amount of drugs, including negative amounts.

pawn Код:
if(strcmp(cmdtext, "/givedrugs", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(/*<insert your variable for checking admin level>*/)
            {
                tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /givedrugs [PlayerID/PartOfName][Amount]");
                return 1;
            }
            new playa;
            new drugamount;
            new result[64];
            playa = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            drugamount = strval(tmp);
            if(playa != INVALID_PLAYER_ID)
                    {
                        format(string, sizeof(string), "You were given %dg of drugs by an administrator.", drugamount);
                    SendClientMessage(playa, COLOR_LIGHTGREEN, string);
                        Drugs[playerid] += drugamount;

                }
               
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   Not Authorized.");
            }
        }//not connected
        return 1;
    }



Re: Drug and Animation Systems - Rob_Maate - 25.11.2011

This one will take 5g each time the player used /td

pawn Код:
{
        if(IsPlayerConnected(playerid))
        {
            if(Drugs[playerid] > 1) //or whatever your variable for storing drugs is
            {
                new Float:health;
                GetPlayerHealth(playerid, health);
                SetPlayerHealth(playerid, health + 10.0);
                SendClientMessage(playerid, COLOR_GREY, "  You used 1g of your drugs.");
                Drugs[playerid] -= 5;
               
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   You dont have any drugs.");
            }
        }//not connected
        return 1;
    }