23.01.2019, 19:16
I have a problem, i have a crate system where players near a spawned crate can get weapons or hp/armour.
Problem is, it should destroy the crate object after the player presses ESC on the dialog (to close it) or when a selects a weapon to get, but it doesn't happen.
Only textlabel gets removed, but crate object stays still there:
Problem is, it should destroy the crate object after the player presses ESC on the dialog (to close it) or when a selects a weapon to get, but it doesn't happen.
Only textlabel gets removed, but crate object stays still there:
pawn Code:
case DIALOG_CRATE:
{
if(response)
{
if(listitem == 0) // Combat Shotgun.
{
GivePlayerWeapon(playerid, 27, 32);
SendClientMessage(playerid, COLOR_WHITE,"* You have equiped a {FFA500}Combat Shotgun{FFFFFF}.");
if(IsValidDynamicObject(CrateObject)) DestroyDynamicObject(CrateObject);
DestroyDynamic3DTextLabel(Text3D:dynamiccrate3DText);
CrateObject = 0;
}
if(listitem == 1) // MP5.
{
GivePlayerWeapon(playerid, 29, 32);
SendClientMessage(playerid, COLOR_WHITE,"* You have equiped a {FFA500}MP5{FFFFFF}.");
if(IsValidDynamicObject(CrateObject)) DestroyDynamicObject(CrateObject);
DestroyDynamic3DTextLabel(Text3D:dynamiccrate3DText);
CrateObject = 0;
}
}
if(!response)
{
if(IsValidDynamicObject(CrateObject)) DestroyDynamicObject(CrateObject);
DestroyDynamic3DTextLabel(Text3D:dynamiccrate3DText);
CrateObject = 0;
SendClientMessageTA(-1, "{FFA500}» [CRATE] The crate has been destroyed! Another will respawn soon.");
}
}