Download

Send a Message from client to server

Hello Guys i try to send a message from client to server ,when i sent a message from a client i received that separated, each client have a array , but i don’t want this i want common array for clients .
on the screenshot u see i have 2 separate client but my array show me online player : 1 but it should be 2 !
i hope u understand me :slight_smile:
thank you for regarding.

.CPP


TArray<int32> last_Online_players;
        TArray<int32> Client_ID_on_status_checking = { 1 };
        
        
        void UChecking_Offline::SetSomeBool(const TArray<int32>& awdd)
        {
        	
        
        }
        
         bool UChecking_Offline::ServerSetSomeBool_Validate(const TArray<int32>& awdd)
        {
        	
        	return true;
        }
        
        void UChecking_Offline::ServerSetSomeBool_Implementation(const TArray<int32>& awdd)
        {
        	
        	
        	
        	
        		if (last_Online_players.Find(Client_ID)) last_Online_players.Add(Client_ID);
        		
        	
        	SetSomeBool(last_Online_players);
        }
        
        
        
        
        
        
       
        
        void UChecking_Offline::Clinet_Joined()
        {
        	void ServerSetSomeBool_Implementation(const TArray<int32>& awdd);
        	{
        		
        	
        		
        		if (last_Online_players.Find(Client_ID)) last_Online_players.Add(Client_ID);
        
        		
        		FString NewString = FString::FromInt(last_Online_players.Num());
        		UE_LOG(LogTemp, Log, TEXT("online players: %s"), *NewString);
        		GEngine->AddOnScreenDebugMessage(-1, 0.5f, FColor::Yellow, "online players :"+ FString::FromInt(last_Online_players.Num()));
        	
        		
        	}

HEADER


class ALPHA_BP_C_API UChecking_Offline : public UBlueprintFunctionLibrary
    {
    	GENERATED_BODY()
    		
    public:
    		UFUNCTION(BluePrintCallable, Category = "Offline Checking")
    	    static void Clinet_Joined();
    		UFUNCTION(BluePrintCallable, Category = "Offline Checking")
    			static void All_Online_Players();
    		UFUNCTION(BluePrintCallable, Category = "Offline Checking")
    			static void Status_checking();
    	
    		 bool awdd;
    
    		void SetSomeBool(const TArray<int32>&  awdd);
    
    		UFUNCTION(reliable, server, WithValidation)
    		 void ServerSetSomeBool(const TArray<int32>&  awdd);
    		
    };

Untitled.jpg
BP.JPG

https://www.youtube.com/watch?v=OFQ6UQxj1jc&list=PLrxECjMS9SuyhkAV47A2Ee2i3kgo0PbGm watch this tutorial to understand networking : )

Thank u dude.