View Single Post
XSlayer
Member
Join Date: Dec 2021
Old 12-12-2021 , 00:05   Re: Save String Array
Reply With Quote #6

Quote:
Originally Posted by Bugsy View Post
I think you're pretty close.
  • The missing part is you need a 2-dimension array so that each players name can be stored. Your current code would make each player overwrite the next.
  • You do not need to use flag 'a' with 1 in set_task() to execute the task once, that is only if you need it triggered/repeated more than once.
  • You want to call remove_task() on client_disconnect, just incase they disconnect between spawn and the 5 second task.

I would recommend you explain what you are trying to accomplish instead of asking questions in code.

PHP Code:
#define MAX_PLAYERS 32
#define MAX_NAME_LENGTH 32

new g_szNameMAX_PLAYERS ][ MAX_NAME_LENGTH ];

public 
fw_spawnClient )
{
    
get_user_nameClient g_szNameClient ] , charsmaxg_szName[] ) );
    
    
set_task5.0 "LoadString" Client );
}

public 
client_disconnectClient 
{
    
remove_taskClient );
}

public 
LoadStringClient )
{
    if ( 
equalg_szNameClient ] , "XSlayer" ))
    {
        
client_printClient print_chat"XSlayer entered the game" );
    }

Thanks! and thanks for explaining the reasons why it didn't work, that helps me learn more and supremache too

Last edited by XSlayer; 12-12-2021 at 00:06.
XSlayer is offline