03.12.2013, 12:42
Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if (newkeys & KEY_WALK) { ShowInventory(playerid); return 1; } if (newkeys & KEY_CROUCH) { if(IsValidObject(LootObjects[0]) && IsPlayerInRangeOfPoint(playerid, 10.0, 233.95, 4106.39, 5.69)) { AddItem(playerid,"Beer Bottle", 1); SendClientMessage(playerid, -1, "* Beer bottle added to your inventory."); DestroyObject(LootObjects[0]); } if(IsValidObject(LootObjects[1]) && IsPlayerInRangeOfPoint(playerid, 3.0, 233.95, 4106.39, 5.69)) { AddItem(playerid,"Pork Chop", 1); SendClientMessage(playerid, -1, "* Pork Chop added to your inventory."); DestroyObject(LootObjects[1]); } else { SendClientMessage(playerid, -1, "You are not near an object."); return 1; } } return 1; }