SA-MP Forums Archive
DestroyObject when /rcon unloadfs MAP ? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: DestroyObject when /rcon unloadfs MAP ? (/showthread.php?tid=214556)



DestroyObject when /rcon unloadfs MAP ? - Yaszine - 21.01.2011

Hey guys

I have little stunting map, so if I load it "/rcon loadfs MAP" it create the objects
But when I unload it, the object still created !

This is it:

pawn Код:
public OnFilterScriptInit()
{
    SendClientMessageToAll(LIGHTGREEN, "Stunting Map Loaded.");
    CreateObject(11539, -706.177063, 1637.122314, 84.878685, 0.0000, 0.0000, 146.2500);
    CreateObject(7474, -736.698425, 1763.900757, 2.589478, 0.0000, 0.0000, 1.7189);
        //Like this line, but a lot :p
    return 0;
}

public OnFilterScriptExit()
{
    SendClientMessageToAll(RED, "Stunting Map Disabled.");
    return 0;//1
}
Then, I have an other MAP, it doesn't works !!

Please I need your idea !
Best regards ~


Re: DestroyObject when /rcon unloadfs MAP ? - Sergei - 21.01.2011

DestroyObject on exit?


Re: DestroyObject when /rcon unloadfs MAP ? - iMonk3y - 21.01.2011

pawn Код:
new Object[2]; //2 stands for the number of objects on your server

public OnFilterScriptInit()
{
    SendClientMessageToAll(LIGHTGREEN, "Stunting Map Loaded.");
    Object[0] = CreateObject(11539, -706.177063, 1637.122314, 84.878685, 0.0000, 0.0000, 146.2500);
    Object[1] = CreateObject(7474, -736.698425, 1763.900757, 2.589478, 0.0000, 0.0000, 1.7189);
        //Like this line, but a lot :p
    return 0;
}

public OnFilterScriptExit()
{
    SendClientMessageToAll(RED, "Stunting Map Disabled.");
    DestroyObject(Object[0]);
    DestroyObject(Object[1]);

    return 0;//1
}



Re : DestroyObject when /rcon unloadfs MAP ? - Yaszine - 21.01.2011

@ iMonk3y
Thank you very much


Re: DestroyObject when /rcon unloadfs MAP ? - admantis - 21.01.2011

A easier and cleaner method is this. No need to change every line and assing them an array.
pawn Код:
//OnFilterScriptExit
{
for(new i = 0; i < MAX_OBJECTS; i++) { DestroyObject(i); } // Change MAX_OBJECTS as needed.
}



Re: DestroyObject when /rcon unloadfs MAP ? - Kwarde - 21.01.2011

Admantis, that'll destroy EVERY objects, from gamemode/other filterscripts too
However if he uses an 'Object[]' you can use that string to delete objects

pawn Код:
for(new i = 0; i < sizeof(Object); i++)
    DestroyObject(Object[i]);
I think that that'll work. I'm not sure, but I think it'll work :P 95% sure 'bout that.