Jump to content

[Resource Manager] Lua + C# بدون تشفير


Recommended Posts

سلام عليكم

يوم اقدام لكم مود عباره انها تقدر تشغل مودات عن طريق برنامج

مميزات مو:

1- تقدر توقف لوق و تشغله عن طريق ملف اسمه config.ini

لو كتبت true بيشتغل لوق

لو false العكس

2-تقدر تشغل و توقف مودات من برنامج

3- تقدر تشوف لوق من ملف log.log

function getinfos ()
local open2 = fileOpen("config.ini")
texts = fileRead(open2,100)
fileClose(open2)
text = string.sub(""..texts.."", 7, 10)
return text
end 

function typeinlog (str)
 tr = getinfos ()
if tr == "true" then 
local open = fileOpen("log.log")
fileRead(open,1500000)
fileWrite(open,"["..os.date("%H:%M:%S").."]:"..str.."\n")
fileFlush(open)
fileClose(open)
else
outputServerLog("Note:log.log dont work you must set true in file config.ini")
end 
end 

function getnames()
names = ""
   local Table = getResources() 
     for k, v in ipairs(Table) do
	 if v then 
                names = names .. " " .. getResourceName(v)  .. " "
				else 
				names = "false"
		end
		end
		return names
		end





function start (res)
local name = getResourceFromName(res)
if name then 
startResource(name)
outputChatBox("[Resource Manager] Has Been Start Resource "..getResourceName(name).."",root,0,255,0,true)
typeinlog("Has Been Start Resource "..getResourceName(name).."")
return "Has Been Start Resource "..getResourceName(name)..""
else
return "there is error"
end
end



function stop (ress)
local name = getResourceFromName(ress)
if name then 
stopResource(name)
outputChatBox("[Resource Manager] Has Been Stop Resource "..getResourceName(name).."",root,0,255,0,true)
return "Has Been Stop Resource "..getResourceName(name)..""
else
return "there is error"
end
end

C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MTA_SDK;

namespace Resource
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            MTA server = new MTA("ip",port, "username", "passworld");
            MTA_LuaArgs luaArgs = new MTA_LuaArgs();
            string returned = server.CallFunction("resourcemmf", "getnames", luaArgs);

            foreach (string ppr in returned.ToString().Split(' '))
            {
                if (ppr != "")
                    listBox1.Items.Add(ppr);
            }

        }

        private void button1_Click(object sender, EventArgs e)
        {
            MTA server = new MTA("ip",port, "username", "passworld");
        MTA_LuaArgs luaArgs = new MTA_LuaArgs("" + listBox1.Text + "");
            string returned = server.CallFunction("resourcemmf", "start", luaArgs);
            MessageBox.Show("" + returned + "");
        }

        private void button2_Click(object sender, EventArgs e)
        {
         MTA server = new MTA("ip",port, "username", "passworld");
        MTA_LuaArgs luaArgs = new MTA_LuaArgs("" + listBox1.Text + "");
            string returned = server.CallFunction("resourcemmf", "stop", luaArgs);
            MessageBox.Show("" + returned + "");
        }
    }
}

رابط تحميل :

https://up.top4top.net/downloadf-1165vrya31-zip.html

 

صوره ل برنامج

p_116524cbf1.png

ان شاء الله عجبتكم الفكره : )

  • Like 1
  • Thanks 1
Link to comment

شغل ممتاز

10 / 10

بس ما تحس ان ممكن يجي اي حد يطرش حقوقة وينسب المود له ؟؟

17 minutes ago, Master_MTA said:

ممتاز صراحة وانتظرني قريبا

داخل بال c#

عشان  علي بروجيكت لازم اسلمه بالجامعه c#

+_+

بالتوفيق لك يا صاحبي

:)

 

Edited by KillerX
  • Like 2
Link to comment
43 minutes ago, Kareem Amer said:

بالتوفيق مود جميل ^_^

مشكور

 

1 hour ago, KillerX said:

بس ما تحس ان ممكن يجي اي حد يطرش حقوقة وينسب المود له ؟؟

عادي مافيه شي في نهايه لعبه يعني

1 hour ago, Master_MTA said:

ممتاز صراحة وانتظرني قريبا

داخل بال c#

عشان  علي بروجيكت لازم اسلمه بالجامعه c# 

+_+

مشكور و موفق ان شاء لله

1 hour ago, DABL said:

=") كـ شغلك إبداع .

واصصل ولا توقف

@Ahmed Ly

تسلم و شكرا لك ❤️

  • Like 1
Link to comment
  • 2 months later...

رااائـع جـدااً ...

لـكن ي ريت لو نسقت لـوحة حقت اللتشـغيل والإطفـاء .....

ع العـموم شـغل راائـع 
بـ توفـيق :P 

Link to comment
13 minutes ago, +Source|> said:

المشكله مو عارف اشغلها

كل شيء مشروح بالمقطع, وراجع ردود الموضوع لأن فيه ناس واجهوا مشاكل ممكن تكون مثل مشكلتك

  • Like 2
Link to comment
  • 10 months later...

UPDATE 

تمت اضافة فكشن restart و  ريرفش

وتم اصلاح بعض تحقيقات 


function getinfos ()
  local open2 = fileOpen("config.ini")
  texts = fileRead(open2,100)
  fileClose(open2)
  text = string.sub(""..texts.."", 7, 10)
  return text
  end 
  
  function typeinlog (str)
   tr = getinfos ()
  if tr == "true" then 
  local open = fileOpen("log.log")
  fileRead(open,1500000)
  fileWrite(open,"["..os.date("%H:%M:%S").."]:"..str.."\n")
  fileFlush(open)
  fileClose(open)
  else
  outputServerLog("Note:log.log dont work you must set true in file config.ini")
  end 
  end 
  
  function getnames()
  names = ""
     local Table = getResources() 
       for k, v in ipairs(Table) do
     if v then 
                  names = names .. " " .. getResourceName(v)  .. " "
          else 
          names = "false"
      end
      end
      return names
      end
  
  
  
  
  
  function start (res)
  local name = getResourceFromName(res)
  if name then 
    if getResourceState (name)  == "stopping" then 
  startResource(name)
  outputChatBox("[Resource Manager] Has Been Start Resource "..getResourceName(name).."",root,0,255,0,true)
  typeinlog("Has Been Start Resource "..getResourceName(name).."")
  return "Has Been Start Resource "..getResourceName(name)..""
  else
  return "that is running aready"
  end
  end
end
  
  
  function stop (ress)
  local name = getResourceFromName(ress)
  if name then 
   if getResourceState (name)  == "running" then 
  stopResource(name)
  outputChatBox("[Resource Manager] Has Been Stop Resource "..getResourceName(name).."",root,0,255,0,true)
  typeinlog("Has Been Start Resource "..getResourceName(name).."")
  return "Has Been Stop Resource "..getResourceName(name)..""
  else
  return "that resource dont running to stoping it"
  end
  end
end

  function restart (sss)
    local nameresource = getResourceFromName(sss)
    if nameresource  then 
      if getResourceState (nameresource)  == "running" then 
      restartResource(nameresource) 
      outputChatBox("[Resource Manager] Has Been Stop Resource "..getResourceName(nameresource).."",root,0,255,0,true)
      typeinlog("Has Been Start Resource "..getResourceName(nameresource).."")
      return "Has Been Restart Resource"
      else  
      return "that resource dont running"
    end
  end
end 

  
  

مثال ع C# 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MTA_SDK;

namespace WindowsFormsApp2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            MTA server = new MTA("localhost",22005, "username","passworld");
            MTA_LuaArgs luaArgs = new MTA_LuaArgs();
            string returned = server.CallFunction("cshare","getnames", luaArgs);

            foreach (string ppr in returned.ToString().Split(' '))
            {
                if (ppr != "")
                    listBox1.Items.Add(ppr);
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MTA server = new MTA("localhost",22005, "username", "passworld");
            MTA_LuaArgs luaArgs = new MTA_LuaArgs("" + listBox1.Text + "");
            string returned = server.CallFunction("cshare", "restart", luaArgs);
            MessageBox.Show("" + returned + "");
        }

        private void button2_Click(object sender, EventArgs e)
        {
            listBox1.Items.Clear();
            MTA server = new MTA("localhost", 22005, "username", "passworld");
            MTA_LuaArgs luaArgs = new MTA_LuaArgs();
            string returned = server.CallFunction("cshare", "getnames", luaArgs);

            foreach (string ppr in returned.ToString().Split(' '))
            {
                if (ppr != "")
                    listBox1.Items.Add(ppr);
            }
        }
    }
}

config.ini

log = true

 

شرح  خاص ب C# SDK 

 

Edited by Ahmed Ly
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...