03.07.2017, 21:20
So, I can give every item except for Xanax, any idea why?
PHP код:
CMD:give(playerid, params[])
{
new player, amount, item[128], str[128];
if(sscanf(params, "usi", player, item, amount)) return SendClientMessage(playerid, COLOR_GRAY, "/give [playerid] [item] [quantity]");
{
if(amount <= 0) return SendErrorMessage(playerid, "Invalid amount.");
if(player == playerid) return SendErrorMessage(playerid, "Invalid Player");
if(IsInRangeOfPlayer(playerid, player, 5))
{
if(!strcmp(item, "VehicleRadio", true))
{
if(Inventory[playerid][VehicleRadio] >= amount)
{
TakeInventoryItem(playerid, VRADIO, amount);
GiveInventoryItem(player, VRADIO, amount);
}
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(playerid, SCREWDRIVER, amount);
GiveInventoryItem(player, SCREWDRIVER, amount);
}
else SendErrorMessage(playerid, "You don't have this item.");
}
else if(!strcmp(item, "Marijuana", true))
{
if(Inventory[playerid][Marijuana] >= amount)
{
TakeInventoryItem(playerid, MARIJUANA, amount);
format(str, sizeof(str), "%s passes Marijuana to %s. ", GetRoleplayName(playerid), GetRoleplayName(player));
SetPlayerChatBubble(playerid, str, COLOR_RP, Range_Short, 7000);
GiveInventoryItem(player, MARIJUANA, amount);
}
else if(!strcmp(item, "Xanax", true))
{
if(Inventory[playerid][Xanax] >= amount)
{
TakeInventoryItem(playerid, XANAX, amount);
format(str, sizeof(str), "%s passes Xanax to %s. ", GetRoleplayName(playerid), GetRoleplayName(player));
SetPlayerChatBubble(playerid, str, COLOR_RP, Range_Short, 7000);
GiveInventoryItem(player, XANAX, amount);
}
else SendErrorMessage(playerid, "You don't have this item.");
return 1;
}
}
}
else SendErrorMessage(playerid, "You are too far away from this player.");
}
return 1;
}