Failing to pick up loots.
#1

I am occuring a problem with the looting system I'm developing for my server. I can't pick up objects somehow, and I'd be happy if somebody could help me.

Code:
Код:
#define PRESSED						(%0)
#define MAX_LOOTS 					100
new LootObjects[MAX_LOOTS] = { INVALID_OBJECT_ID, ... };
OnGameModeInit:
Код:
	// Objects
	LootObjects[0] = CreateDynamicObject(1210, 254.31627, 4158.11377, 8.95453,   0.00000, 0.00000, 0.00000); // Medkit
	LootObjects[1] = CreateDynamicObject(1484, 247.87740, 4188.77002, 8.90115,   0.00000, 0.00000, 0.00000); // Beer Bottle
    LootObjects[2] = CreateDynamicObject(2806, 247.98601, 4100.01758, 3.42860,   0.00000, 0.00000, 0.00000); // Human Meat
	LootObjects[3] = CreateDynamicObject(2806, 248.70003, 4103.33936, 4.03377,   0.00000, 0.00000, 0.00000); // Human Meat
	LootObjects[4] = CreateDynamicObject(336, 136.25269, 4179.93018, 28.80020,   -50.00000, 0.00000, 0.00000); // Bat in tree
	LootObjects[5] = CreateDynamicObject(1265, 289.96664, 4068.64990, 0.57592,   0.00000, 0.00000, 0.00000); // Bag with: Medkit, bandage
	LootObjects[6] = CreateDynamicObject(2891, 201.18965, 4179.41357, 8.75100,   0.00000, 0.00000, 0.00000); // Bandage
	LootObjects[7] = CreateDynamicObject(1582, 126.10010, 4083.24170, 0.07406,   10.00000, 0.00000, 0.00000); // Stranded Pizza
OnPlayerKeyStateChange
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (newkeys & KEY_YES)
    {
        ShowInventory(playerid);
        return 1;
    }
    if (newkeys & KEY_NO)
    {
        if(IsValidObject(LootObjects[0]) && IsPlayerInRangeOfPoint(playerid,3.0, 254.31627, 4158.11377, 8.95453))
        {
            ApplyAnimation(playerid,"BOMBER","BOM_PLANT_2IDLE",4.1,1,1,1,1,1,1);
            AddItem(playerid,"Small Medkit",1);
            SendClientMessage(playerid, -4, "* Small medical kit added to your inventory.");
            DestroyObject(LootObjects[0]);
        }
    }
	return 1;
}
OnPlayerUseItem (j_inventory_v2)
Код:
public OnPlayerUseItem(playerid,ItemName[])
{
    if(!strcmp(ItemName,"Medkit",true))
    {
        new Float:hp;
        GetPlayerHealth(playerid,hp);
        if(hp>=100)return SendClientMessage(playerid,-1,"* You already have full health!");
        SetPlayerHealth(playerid,100);
        RemoveItem(playerid,ItemName,1);
        return SendClientMessage(playerid,-1,"* You used a medkit.");
    }
    return 0;
}
No errors:
Код:
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Reply


Messages In This Thread
Failing to pick up loots. - by [WA]iRonan - 18.12.2013, 13:45
Re: Failing to pick up loots. - by boomerboom - 18.12.2013, 14:19
Re: Failing to pick up loots. - by Pottus - 18.12.2013, 14:24
Re: Failing to pick up loots. - by [WA]iRonan - 18.12.2013, 14:41
Re: Failing to pick up loots. - by Pottus - 18.12.2013, 14:43
Re: Failing to pick up loots. - by [WA]iRonan - 18.12.2013, 14:55
Re: Failing to pick up loots. - by boomerboom - 18.12.2013, 14:57
Re: Failing to pick up loots. - by [WA]iRonan - 18.12.2013, 14:59
Re: Failing to pick up loots. - by Pottus - 18.12.2013, 15:11

Forum Jump:


Users browsing this thread: 1 Guest(s)