Raised This Month: $ Target: $400
 0% 

Empty an array


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
killergirl
Senior Member
Join Date: Jul 2010
Old 04-27-2011 , 08:03   Empty an array
Reply With Quote #1

I tried to search, but I havent found any respons to my question. I'm trying to empty an array, but I don't know how. I need to give a value, or... I don't know.

eg:
PHP Code:
new g_SelectedAuthId[32]

public function(
id)
{
    
//bla bla
    
    
new szID[32]
    
get_user_authid(targetszIDcharsmax(szID))
    
    if(
is_user_connected(target))
    {
        
copy(g_SelectedAuthId31szID)
    }
}

public 
AnotherFunction(id)
{
    
client_print(0print_chat"%s"g_SelectedAuthId)

killergirl is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-27-2011 , 09:02   Re: Empty an array
Reply With Quote #2

For a string, you can do simply : g_SelectedAuthId[0] = EOS;
__________________
Arkshine is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-27-2011 , 09:17   Re: Empty an array
Reply With Quote #3

For an entire array:

arrayset( theArray , 0 , sizeof( theArray ) )
__________________
Bugsy is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 04-27-2011 , 09:18   Re: Empty an array
Reply With Quote #4

Or you can make this way too

PHP Code:
 
new g_SelectedAuthId[32]

public function(
id)
{
    
//bla bla
    
    
new szID[32]
    
get_user_authid(targetszIDcharsmax(szID))
    
    if(
is_user_connected(target))
    {
        
copy(g_SelectedAuthId31szID)
    }
}

public 
AnotherFunction(id)
{
    
client_print(0print_chat"%s"g_SelectedAuthId)
    
g_SelectedAuthId[0] = 0

Or i am wrong?
.Dare Devil. is offline
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 04-27-2011 , 09:54   Re: Empty an array
Reply With Quote #5

PHP Code:
new g_SelectedAuthId[32]

public function(
id)
{
         
//bla bla

     
g_SelectedAuthId[0]=0
 
     
if(!is_user_connected(target))
          return
         
     new 
szID[32]
     
get_user_authid(targetSelectedAuthIdcharsmax(SelectedAuthId))
}

public 
AnotherFunction(id)
     
client_print(0print_chat"player %d SelectedAuthId: %s"idg_SelectedAuthId[id]) 
__________________


Last edited by SonicSonedit; 04-27-2011 at 09:58.
SonicSonedit is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-27-2011 , 09:59   Re: Empty an array
Reply With Quote #6

SonicSonedit, EOS = '^0' = 0.
__________________
Arkshine is offline
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 04-27-2011 , 10:07   Re: Empty an array
Reply With Quote #7

Arkshine
EOS 3 symbols, 0 is just one
__________________

SonicSonedit is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-27-2011 , 10:13   Re: Empty an array
Reply With Quote #8

Quote:
Originally Posted by SonicSonedit View Post
Arkshine
EOS 3 symbols, 0 is just one
Really?

[/thread]
__________________
Bugsy is offline
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 04-27-2011 , 10:17   Re: Empty an array
Reply With Quote #9

Quote:
Originally Posted by Bugsy View Post
Really?

[/thread]
Deadly serious.
__________________

SonicSonedit is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 04-27-2011 , 10:35   Re: Empty an array
Reply With Quote #10

Why create szID[]?
__________________
hleV 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 04:20.


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