Advertisement
SigWar

Kick plyers by SigWar

Apr 8th, 2021
632
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.93 KB | None | 0 0
  1. //! KICK SURVIVOR PLAYERS
  2.     override void InvokeOnConnect(PlayerBase player, PlayerIdentity identity)
  3.     {
  4.         //Print("INVOKE EXECUTADA");
  5.         bool playerNameIsSurvivor = false;
  6.         string characterName = player.GetIdentity().GetName();
  7.         characterName.ToLower();
  8.        
  9.         // Check if have survivor in name
  10.         if ( characterName.Contains("survivor") )
  11.         {
  12.             playerNameIsSurvivor = true;
  13.             Print("Survior Detectado");
  14.         }
  15.        
  16.         //Send playuer messages
  17.         if ( playerNameIsSurvivor )
  18.         {
  19.            
  20.             GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(SurvivorDetected, 15000, true, player);
  21.         }
  22.        
  23.         super.InvokeOnConnect(player, identity);
  24.     }
  25.    
  26.     // Player Messages
  27.     protected void SurvivorDetected(PlayerBase player)
  28.     {
  29.  
  30.         if (!player){
  31.             return;
  32.         }
  33.  
  34.         sendPlayerMessage(player, "É PROIBIDO O USO DO NOME 'Survivor'.");
  35.         sendPlayerMessage(player, "Troque no launcher oficial na Aba 'Parametros' opção 'Nome do Perfil'");
  36.         sendPlayerMessage(player, "VOCÊ SERA DESCONECTADO EM 5 MINUTOS");
  37.         GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(UVDisconnectPlayer, 300000, true, player);
  38.         GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(SurvivorDetected);
  39.        
  40.     }
  41.  
  42.     // Kick player function
  43.     protected void UVDisconnectPlayer(PlayerBase player)
  44.     {
  45.  
  46.         if (!player){
  47.             return;
  48.         }
  49.  
  50.         PlayerIdentity Identidade = player.GetIdentity();
  51.         PlayerDisconnected(player, Identidade, Identidade.GetId());
  52.         GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(UVDisconnectPlayer);
  53.         Print("Player: " + Identidade.GetName() + " Desconectado por nome SURVIVOR" );
  54.  
  55.     }
  56.    
  57.     // Send Message function
  58.     protected void sendPlayerMessage(PlayerBase player, string message)    
  59.     {
  60.         if (!player){
  61.             return;
  62.         }
  63.        
  64.         if((player) && (message != ""))
  65.         {
  66.             Param1<string> Msgparam;
  67.             Msgparam = new Param1<string>(message);
  68.             GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, player.GetIdentity());
  69.  
  70.         }
  71.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement