Raised This Month: $32 Target: $400
 8% 

Solved Clear the arrays on plugin_end?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 03-19-2018 , 09:42   Clear the arrays on plugin_end?
Reply With Quote #1

I keep the names and steam-id of the players that connect in the em
PHP Code:
enum uUserData
{    
    
szName[MAX_PLAYERS],
....
}

g_iPlayerSteam[MAX_PLAYERS 1][MAX_PLAYERS 3]

new 
g_dUserData[MAX_PLAYERS 1][uUserData
do I need to clear the array in the plugin_end, or in the map change will clear the values ​themselves?

Last edited by iceeedr; 04-28-2018 at 00:47.
iceeedr is offline
Send a message via Skype™ to iceeedr
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 03-19-2018 , 10:29   Re: Clear the arrays on plugin_end?
Reply With Quote #2

All plugins are reloaded after map change. So no, you don't have to.
__________________
klippy is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 03-19-2018 , 10:53   Re: Clear the arrays on plugin_end?
Reply With Quote #3

Quote:
Originally Posted by KliPPy View Post
All plugins are reloaded after map change. So no, you don't have to.
Thanks for explanation.
iceeedr is offline
Send a message via Skype™ to iceeedr
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 03-20-2018 , 01:30   Re: Clear the arrays on plugin_end?
Reply With Quote #4

you only need to clear cellarrays
__________________
retired chump
DjSoftero is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 03-20-2018 , 09:12   Re: Clear the arrays on plugin_end?
Reply With Quote #5

Quote:
Originally Posted by DjSoftero View Post
you only need to clear cellarrays
Sorry but my english is not of the best kkk, please give me an example of cellarray.
iceeedr is offline
Send a message via Skype™ to iceeedr
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-20-2018 , 10:16   Re: Clear the arrays on plugin_end?
Reply With Quote #6

Quote:
Originally Posted by DjSoftero View Post
you only need to clear cellarrays
You need to destroy them, not clear them.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 03-20-2018 , 10:42   Re: Clear the arrays on plugin_end?
Reply With Quote #7

Quote:
Originally Posted by OciXCrom View Post
You need to destroy them, not clear them.

PHP Code:
new WeaponSlots[] =
{
    
0,
    
2,    //CSW_P228
    
0,
    
1,    //CSW_SCOUT
    
4,    //CSW_HEGRENADE
    
1,    //CSW_XM1014
    
5,    //CSW_C4
    
1,    //CSW_MAC10
    
1,    //CSW_AUG
    
4,    //CSW_SMOKEGRENADE
    
2,    //CSW_ELITE
    
2,    //CSW_FIVESEVEN
    
1,    //CSW_UMP45
    
1,    //CSW_SG550
    
1,    //CSW_GALIL
    
1,    //CSW_FAMAS
    
2,    //CSW_USP
    
2,    //CSW_GLOCK18
    
1,    //CSW_AWP
    
1,    //CSW_MP5NAVY
    
1,    //CSW_M249
    
1,    //CSW_M3
    
1,    //CSW_M4A1
    
1,    //CSW_TMP
    
1,    //CSW_G3SG1
    
4,    //CSW_FLASHBANG
    
2,    //CSW_DEAGLE
    
1,    //CSW_SG552
    
1,    //CSW_AK47
    
3,    //CSW_KNIFE
    
1    //CSW_P90
}

new 
MaxBPAmmo[] =
{
    
0,
    
52,    //CSW_P228
    
0,
    
90,    //CSW_SCOUT
    
1,    //CSW_HEGRENADE
    
32,    //CSW_XM1014
    
1,    //CSW_C4
    
100,    //CSW_MAC10
    
90,    //CSW_AUG
    
1,    //CSW_SMOKEGRENADE
    
120,    //CSW_ELITE
    
100,    //CSW_FIVESEVEN
    
100,    //CSW_UMP45
    
90,    //CSW_SG550
    
90,    //CSW_GALIL
    
90,    //CSW_FAMAS
    
100,    //CSW_USP
    
120,    //CSW_GLOCK18
    
30,    //CSW_AWP
    
120,    //CSW_MP5NAVY
    
200,    //CSW_M249
    
32,    //CSW_M3
    
90,    //CSW_M4A1
    
120,    //CSW_TMP
    
90,    //CSW_G3SG1
    
2,    //CSW_FLASHBANG
    
35,    //CSW_DEAGLE
    
90,    //CSW_SG552
    
90,    //CSW_AK47
    
0,    //CSW_KNIFE
    
100    //CSW_P90
}

enum uUserData
{    
    
szName[MAX_PLAYERS],
    
iKills,
    
bool:bFirstSpawn,
    
bool:bIsReady,
    
bool:bIsSelected,
    
SpecName[MAX_PLAYERS]
}

enum bBool
{
    
bMD3,
    
bReady,
    
bWaitingForPlayers,
    
bPlayerTRSelected,
    
bPlayerCTSelected
}

enum iNums
{
    
iRounds,
    
iTempo,
    
iCTsPlacar,
    
iTRsPlacar,
    
iCTsPlacarOT,
    
iTRsPlacarOT,
    
iRRs,
    
iChamarTR,
    
iChamarCT,
    
iOwnerID,
    
iCaptainTR,
    
iCaptainCT,
    
iMiadoCountDown,
    
iOverTimeCountDown,
    
iBestFragFirstH,
    
iBestFragSecH,
    
iFirstHalfKill,
    
iSecHalfKill
}

new 
g_dUserData[MAX_PLAYERS 1][uUserData]
new 
g_iNums[iNums]
new 
g_bBooleans[bBool
Ocix, in the above examples, does any of them need to be destroyed?
iceeedr is offline
Send a message via Skype™ to iceeedr
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-20-2018 , 10:49   Re: Clear the arrays on plugin_end?
Reply With Quote #8

None of the examples are using cellarray, so you can't possibly "destroy" them.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 03-20-2018 , 10:53   Re: Clear the arrays on plugin_end?
Reply With Quote #9

4 sure, I just asked to have no doubts, I had already researched on but I still had some doubts because of the "translation". Thanks again for all the help.
iceeedr is offline
Send a message via Skype™ to iceeedr
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-20-2018 , 21:53   Re: Clear the arrays on plugin_end?
Reply With Quote #10

Typically, if a thing requires some sort of "create" function then you should use the complementary function to destroy it when you are done with it. So, if you create the thing at the beginning of the plugin then you should destroy it at the end of the plugin.

Normal arrays aren't "created", they are declared. CellArrays (Dynamic Arrays) and CellTries (Tries) are created at run-time and thus need destroyed when they are no longer used.
__________________
fysiks is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:50.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode