Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

[HELP]/Givedrug

$
0
0
Instead of using /givedrug (giving a person) I want to /givedrug [playerid] [ammount] [price] (giving a person drugs as that player buy it) basically like a /selldrug cmd. How do I do it here's the code below.

Code:

CMD:givedrug(playerid, params[])
{
    new
        give[24], id, amount, string[128];

    if(sscanf(params, "is[24]d", id, give, amount)) return SendClientMessage(playerid, COLOR_GREY, "[SERVER] /givedrug [playerid] (beer, cigarette, lsd, marijuana, cocaine, meth, ecstasy, seeds, heroin, crack) [amount]");
    if(!strcmp(give, "lsd", true))
    {
                  new Float:x, Float:y, Float:z;
                GetPlayerPos(id, x, y, z);
            if(!IsPlayerInRangeOfPoint(playerid, 7.0, x, y, z)) return SCM(playerid, COLOR_LIGHTRED, "You are not close to that player.");
            if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_LIGHTRED, "That player is not connected.");
            if (amount > PlayerInfo[playerid][dLSD]) return SendClientMessage(playerid, COLOR_LIGHTRED, "You do not have that much LSD.");
            if (playerid == id) return SendClientMessage(playerid, COLOR_LIGHTRED,"You can't give yourself LSD.");

            PlayerInfo[id][dLSD] += amount;
            PlayerInfo[playerid][dLSD] -= amount;
            format(string, sizeof(string), "You have received %dg LSD from %s.",amount, GetName(playerid));
            SendClientMessage(id, COLOR_WHITE, string);
            format(string, sizeof(string), "%s gives a baggie to %s.", GetName(playerid), GetName(id));
            ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            new string2[128];
            format(string2, sizeof(string2), "* %s gives a baggie to %s.", GetName(playerid), GetName(id));
            SetPlayerChatBubble(playerid, string2, COLOR_PURPLE, 100.0, 10000);
            format(string, sizeof(string), "You have given %s %dg of LSD.",GetName(id),amount);
            SendClientMessage(playerid, COLOR_WHITE, string);
    }


Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>