|
Member
|
12-12-2021
, 00:05
Re: Save String Array
|
#6
|
Quote:
Originally Posted by Bugsy
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_szName[ MAX_PLAYERS + 1 ][ MAX_NAME_LENGTH + 1 ];
public fw_spawn( Client ) { get_user_name( Client , g_szName[ Client ] , charsmax( g_szName[] ) ); set_task( 5.0 , "LoadString" , Client ); }
public client_disconnect( Client ) { remove_task( Client ); }
public LoadString( Client ) { if ( equal( g_szName[ Client ] , "XSlayer" )) { client_print( Client , 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.
|
|
|
|