clacki
دوشنبه 03 آذر 1393, 22:08 عصر
سلام خسته نباشید.
در کد مورد نظر خط 74 و خط 60 فایل مربوطه رو چک میکنه که اگه ThirdPerson مساوی 1 نباشه هیچ عملی انجام نده تا اینکه توی فایل مربوطه ThirdPerson مساوی 1 کنیم تا کاری تایین شده انجام بشه.
حالا من میخوام که این شرط بردارم کلآ.
به زبان ساده : اصلا نیاد چک کنه که ThirdPerson مساوی 1 هست یا نه. کاری که باید انجام بده رو انجام بده.
لطفآ دوستان کد تغییر بدن تا ببینم چطور این کار کردن.
خیلی ممنون
using Addon;
using System;
namespace st0re
{
public class thirdPerson : CPlugin
{
public int tdbin = 0;
public override void OnServerLoad()
{
if (!(this.GetServerCFG("st0re", "ThirdPerson", "1") == "1"))
return;
this.tdbin = 1;
}
public override void OnMapChange()
{
if (this.GetServerCFG("st0re", "ThirdPerson", "1") == "1")
{
this.tdbin = 1;
this.td_activate();
}
base.OnMapChange();
}
public override void OnFastRestart()
{
if (this.GetServerCFG("st0re", "ThirdPerson", "1") == "1")
{
this.tdbin = 1;
this.td_activate();
}
base.OnFastRestart();
}
public override void OnPlayerConnect(ServerClient Client)
{
if (this.GetServerCFG("st0re", "ThirdPerson", "1") == "1")
{
this.tdbin = 1;
this.td_activate();
}
base.OnPlayerConnect(Client);
}
public override ChatType OnSay(string Message, ServerClient Client)
{
try
{
if (Message.ToLower() == "!3d")
{
if (this.tdbin == 0)
this.TellClient(Client.ClientNum, "^0PM^2: ^7ThirdPerson mod is ^1Disabled", true);
else if (this.tdbin == 1)
this.TellClient(Client.ClientNum, "^0PM^2: ^7ThirdPerson mod is ^2Enabled", true);
}
else if (Message.ToLower() == "!3d on")
{
if (this.GetServerCFG("st0re", "ThirdPerson", "1") == "0")
this.TellClient(Client.ClientNum, "^0PM^2: ^7ThirdPerson mod is ^1Disabled^7 ,You can ^2Enabled ^7in ^3sv_config", true);
else if (this.GetServerCFG("st0re", "ThirdPerson", "1") == "1")
{
if (this.tdbin != 1)
{
this.tdbin = 1;
this.check_td_state();
this.ServerSay("^7ThirdPerson mod ^1Enabled", true);
}
}
}
else if (Message.ToLower() == "!3d off")
{
if (this.GetServerCFG("st0re", "ThirdPerson", "1") == "0")
this.TellClient(Client.ClientNum, "^0PM^2: ^7ThirdPerson mod is ^1Disabled^7 ,You can ^2Enabled ^7in ^3sv_config", true);
else if (this.GetServerCFG("st0re", "ThirdPerson", "1") == "1" && this.tdbin != 0)
{
this.tdbin = 0;
this.check_td_state();
this.ServerSay("^7ThirdPerson mod ^1Disabled", true);
}
}
}
catch (Exception ex)
{
this.TellClient(Client.ClientNum, ex.Message, true);
}
return base.OnSay(Message, Client);
}
public void td_activate()
{
this.SetDvar("camera_thirdPerson", "1");
this.tdbin = 1;
}
public void td_deactivate()
{
this.SetDvar("camera_thirdPerson", "0");
this.tdbin = 0;
}
public void check_td_state()
{
if (this.tdbin == 0)
{
this.td_deactivate();
}
else
{
if (this.tdbin != 1)
return;
this.td_activate();
}
}
}
}
در کد مورد نظر خط 74 و خط 60 فایل مربوطه رو چک میکنه که اگه ThirdPerson مساوی 1 نباشه هیچ عملی انجام نده تا اینکه توی فایل مربوطه ThirdPerson مساوی 1 کنیم تا کاری تایین شده انجام بشه.
حالا من میخوام که این شرط بردارم کلآ.
به زبان ساده : اصلا نیاد چک کنه که ThirdPerson مساوی 1 هست یا نه. کاری که باید انجام بده رو انجام بده.
لطفآ دوستان کد تغییر بدن تا ببینم چطور این کار کردن.
خیلی ممنون
using Addon;
using System;
namespace st0re
{
public class thirdPerson : CPlugin
{
public int tdbin = 0;
public override void OnServerLoad()
{
if (!(this.GetServerCFG("st0re", "ThirdPerson", "1") == "1"))
return;
this.tdbin = 1;
}
public override void OnMapChange()
{
if (this.GetServerCFG("st0re", "ThirdPerson", "1") == "1")
{
this.tdbin = 1;
this.td_activate();
}
base.OnMapChange();
}
public override void OnFastRestart()
{
if (this.GetServerCFG("st0re", "ThirdPerson", "1") == "1")
{
this.tdbin = 1;
this.td_activate();
}
base.OnFastRestart();
}
public override void OnPlayerConnect(ServerClient Client)
{
if (this.GetServerCFG("st0re", "ThirdPerson", "1") == "1")
{
this.tdbin = 1;
this.td_activate();
}
base.OnPlayerConnect(Client);
}
public override ChatType OnSay(string Message, ServerClient Client)
{
try
{
if (Message.ToLower() == "!3d")
{
if (this.tdbin == 0)
this.TellClient(Client.ClientNum, "^0PM^2: ^7ThirdPerson mod is ^1Disabled", true);
else if (this.tdbin == 1)
this.TellClient(Client.ClientNum, "^0PM^2: ^7ThirdPerson mod is ^2Enabled", true);
}
else if (Message.ToLower() == "!3d on")
{
if (this.GetServerCFG("st0re", "ThirdPerson", "1") == "0")
this.TellClient(Client.ClientNum, "^0PM^2: ^7ThirdPerson mod is ^1Disabled^7 ,You can ^2Enabled ^7in ^3sv_config", true);
else if (this.GetServerCFG("st0re", "ThirdPerson", "1") == "1")
{
if (this.tdbin != 1)
{
this.tdbin = 1;
this.check_td_state();
this.ServerSay("^7ThirdPerson mod ^1Enabled", true);
}
}
}
else if (Message.ToLower() == "!3d off")
{
if (this.GetServerCFG("st0re", "ThirdPerson", "1") == "0")
this.TellClient(Client.ClientNum, "^0PM^2: ^7ThirdPerson mod is ^1Disabled^7 ,You can ^2Enabled ^7in ^3sv_config", true);
else if (this.GetServerCFG("st0re", "ThirdPerson", "1") == "1" && this.tdbin != 0)
{
this.tdbin = 0;
this.check_td_state();
this.ServerSay("^7ThirdPerson mod ^1Disabled", true);
}
}
}
catch (Exception ex)
{
this.TellClient(Client.ClientNum, ex.Message, true);
}
return base.OnSay(Message, Client);
}
public void td_activate()
{
this.SetDvar("camera_thirdPerson", "1");
this.tdbin = 1;
}
public void td_deactivate()
{
this.SetDvar("camera_thirdPerson", "0");
this.tdbin = 0;
}
public void check_td_state()
{
if (this.tdbin == 0)
{
this.td_deactivate();
}
else
{
if (this.tdbin != 1)
return;
this.td_activate();
}
}
}
}