24.09.2013, 09:36
Hello SA-MP community,
Im trying to make a loot system with mapping certain objects such as the M4A1 in a place and when people press the C (or KEY_CROUCH) button they pick up the item that is near them.
The only thing that is going wrong is that the object is not being destroyed after i picked up (picking it up works etc), its being add to my inventory and i get the message that it has been added. so my question is: how do i make it so once the player picked it up the loot object gets destroyed? and also so the is player in range of point gets disabled when the player looted it by pressing the coruch button ©.
(i get no erros by the way)
Thank you for your time!
Im trying to make a loot system with mapping certain objects such as the M4A1 in a place and when people press the C (or KEY_CROUCH) button they pick up the item that is near them.
The only thing that is going wrong is that the object is not being destroyed after i picked up (picking it up works etc), its being add to my inventory and i get the message that it has been added. so my question is: how do i make it so once the player picked it up the loot object gets destroyed? and also so the is player in range of point gets disabled when the player looted it by pressing the coruch button ©.
(i get no erros by the way)
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (newkeys & KEY_WALK)
{
ShowInventory(playerid);
return 1;
}
if (KEY_CROUCH & oldkeys)
{
if(IsPlayerInRangeOfPoint(playerid, 1.0, 2384.59448, -1674.36279, 13.74557)) //co ords of where the M4A1 loot is located
{
AddItem(playerid,"M4A1",1);
SendClientMessage(playerid, COLOR_GREEN, "* 1 M4A1 has been added to your inventory");
DestroyObject(356); //the M4A1 object ID
}
else
{
return 1;
}
}
return 1;
}