Advertisement
Mentosan

RAGE:MP 0.3.7 - CheckClientSide

Aug 18th, 2020
1,906
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.87 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using GTANetworkAPI;
  5. using System.IO;
  6.  
  7. namespace vbzone.Utility
  8. {
  9.     public class CheckClientSide : Script
  10.     {
  11.  
  12.         string error_message_ro = "RO: Nu aveti fisierul 'enable-clientside-cs.txt', iar conexiunea a fost revocata!|Intrati in fisierul unde aveti instalat RAGEMP-ul si adaugati ca fisier .txt `enable-clientside-cs`!";
  13.         string error_message_en = "EN: You don't have the file 'enable-clientside-cs.txt', and the connection has been revoked! | Enter in the root folder of RAGEMP and add as .txt `enable-clientside-cs`!";
  14.         bool activ = false;
  15.  
  16.         [ServerEvent(Event.PlayerConnected)]
  17.         public void CheckClientSide_OnPlayerConnected(Player player)
  18.         {
  19.             if (HavePlayerClientSideEnabled(player) == false && activ == true)
  20.             {
  21.                 string[] msg;
  22.                 msg = error_message_ro.Split('|');
  23.                 foreach (string txt in msg) Globals.Functions.SendClientMessage(player, Globals.Variables.COLOR_RED, txt);
  24.                 msg = error_message_en.Split('|');
  25.                 foreach (string txt in msg) Globals.Functions.SendClientMessage(player, Globals.Variables.COLOR_RED, txt);
  26.                 player.Kick();
  27.             }
  28.         }
  29.  
  30.         public bool HavePlayerClientSideEnabled(Player player)
  31.         {
  32.             string path = @"c:\RAGEMP\enable-clientside-cs.txt";
  33.             if (File.Exists(path)) { }
  34.             else
  35.             {
  36.                 path = @"d:\RAGEMP\enable-clientside-cs.txt";
  37.                 if (File.Exists(path)) { }
  38.                 else
  39.                 {
  40.                     path = @"e:\RAGEMP\enable-clientside-cs.txt";
  41.                     if (File.Exists(path)) { }
  42.                     else return false;
  43.                 }
  44.             }
  45.             return true;
  46.         }
  47.  
  48.     }
  49. }
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement