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

Unable to give items

$
0
0
So, I can give every item except for Xanax, any idea why?
PHP Code:

CMD:give(playeridparams[])
{
    new 
playeramountitem[128], str[128];
    if(
sscanf(params"usi"playeritemamount)) return SendClientMessage(playeridCOLOR_GRAY"/give [playerid] [item] [quantity]");
    {
        if(
amount <= 0) return SendErrorMessage(playerid"Invalid amount.");
        if(
player == playerid) return SendErrorMessage(playerid"Invalid Player");
        if(
IsInRangeOfPlayer(playeridplayer5))
        {
            if(!
strcmp(item"VehicleRadio"true))
            {
                if(
Inventory[playerid][VehicleRadio] >= amount)
                {
                    
TakeInventoryItem(playeridVRADIOamount);
                    
GiveInventoryItem(playerVRADIOamount);

                }
                else 
SendErrorMessage(playerid"You don't have this item.");
                return 
1;
            }

            else if(!
strcmp(item"Weapon"true))
            {

            }

            else if(!
strcmp(item"Screwdriver"true))
            {
                if(
Inventory[playerid][Screwdriver] >= amount)
                {
                    
TakeInventoryItem(playeridSCREWDRIVERamount);
                    
GiveInventoryItem(playerSCREWDRIVERamount);

                }
                else 
SendErrorMessage(playerid"You don't have this item.");
                }
                else if(!
strcmp(item"Marijuana"true))
            {
                if(
Inventory[playerid][Marijuana] >= amount)
                {
                    
TakeInventoryItem(playeridMARIJUANAamount);
                    
format(strsizeof(str), "%s passes Marijuana to %s. "GetRoleplayName(playerid), GetRoleplayName(player));
                    
SetPlayerChatBubble(playeridstrCOLOR_RPRange_Short7000);
                    
GiveInventoryItem(playerMARIJUANAamount);
                }
                    else if(!
strcmp(item"Xanax"true))
            {
                if(
Inventory[playerid][Xanax] >= amount)
                {
                    
TakeInventoryItem(playeridXANAXamount);
                    
format(strsizeof(str), "%s passes Xanax to %s. "GetRoleplayName(playerid), GetRoleplayName(player));
                    
SetPlayerChatBubble(playeridstrCOLOR_RPRange_Short7000);
                    
GiveInventoryItem(playerXANAXamount);
                }
                else 
SendErrorMessage(playerid"You don't have this item.");

                return 
1;
                }
            }
        }
        else 
SendErrorMessage(playerid"You are too far away from this player.");

    }
    return 
1;



Viewing all articles
Browse latest Browse all 18226

Trending Articles