Destroying object
#7

Quote:
Originally Posted by SymonClash
View Post
Repeat useless code many times? Where?
He wanted to say, you could write it like this:

PHP Code:
case DIALOG_CRATE:
{
    if(
IsValidDynamicObject(CrateObject)) DestroyDynamicObject(CrateObject);
    
DestroyDynamic3DTextLabel(Text3D:dynamiccrate3DText);
    
CrateObject 0;
    if(!
response) return SendClientMessageTA(-1"{FFA500}» [CRATE] The crate has been destroyed! Another will respawn soon.");
    switch(
listitem)
    {
        case 
0GivePlayerWeapon(playerid2732), SendClientMessage(playeridCOLOR_WHITE,"* You have equiped a {FFA500}Combat Shotgun{FFFFFF}.");
        case 
1GivePlayerWeapon(playerid2932), SendClientMessage(playeridCOLOR_WHITE,"* You have equiped a {FFA500}MP5{FFFFFF}.");
    }

Anyway, i think your problem is, that you overwrite your CrateObject.

Because if you Create the new object the old isnt destroyed and gets overrided.

So, you can solve this, by an array of CrateObjects or by destroying the old one, before you create a new one


PS:
For constant arrays, use stock const:

PHP Code:
stock const Float:g_CrateSpawns[][3] =
{
    {
821.9344,-1868.2295,6.7148}
    {
1281.3082,-2000.0718,58.2978},
    {
1800.3622,-2180.2473,13.5547},
    {
1647.9771,-2102.3044,13.5547}
}; 
Reply


Messages In This Thread
Destroying object - by SymonClash - 23.01.2019, 19:16
Re: Destroying object - by Kane - 24.01.2019, 07:23
Re: Destroying object - by SymonClash - 24.01.2019, 09:40
Re: Destroying object - by Kaliber - 24.01.2019, 11:02
Re: Destroying object - by codExpert - 24.01.2019, 12:28
Re: Destroying object - by SymonClash - 24.01.2019, 13:03
Re: Destroying object - by Kaliber - 24.01.2019, 13:09
Re: Destroying object - by SymonClash - 24.01.2019, 13:11
Re: Destroying object - by Kasichok - 24.01.2019, 13:14
Re: Destroying object - by Kaliber - 24.01.2019, 13:35

Forum Jump:


Users browsing this thread: 1 Guest(s)