i work with this init.c but the server crash.
i dont understand why help pleas !!!
void main()
{
Hive ce = CreateHive();
if ( ce )
ce.InitOffline();
Weather weather = g_Game.GetWeather();
weather.GetOvercast().SetLimits( 0.0 , 1.0 );
weather.GetRain().SetLimits( 0.0 , 1.0 );
weather.GetFog().SetLimits( 0.0 , 0.25 );
weather.GetOvercast().SetForecastChangeLimits( 0.0, 0.2 );
weather.GetRain().SetForecastChangeLimits( 0.0, 0.1 );
weather.GetFog().SetForecastChangeLimits( 0.15, 0.45 );
weather.GetOvercast().SetForecastTimeLimits( 1800 , 1800 );
weather.GetRain().SetForecastTimeLimits( 600 , 600 );
weather.GetFog().SetForecastTimeLimits( 1800 , 1800 );
weather.GetOvercast().Set( Math.RandomFloatInclusive(0.0, 0.3), 0, 0);
weather.GetRain().Set( Math.RandomFloatInclusive(0.0, 0.2), 0, 0);
weather.GetFog().Set( Math.RandomFloatInclusive(0.0, 0.1), 0, 0);
weather.SetWindMaximumSpeed(30);
weather.SetWindFunctionParams(0.1, 1.0, 50);
GetGame().GetWorld().SetDate( 2018, 6, 20, 7, 5);
Object obj;
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "13153.000000 18.914499 3276.913086");
obj.SetOrientation("34.000000 0.000000 0.000000");
obj.SetPosition("13153.000000 18.914499 3276.913086");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "13138.000000 18.315378 3286.929443");
obj.SetOrientation("34.000000 0.000000 -4.000014");
obj.SetPosition("13138.000000 18.315378 3286.929443");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "13122.000000 16.444500 3297.549805");
obj.SetOrientation("33.000000 -0.000010 -7.000012");
obj.SetPosition("13122.000000 16.444500 3297.549805");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "13105.249023 14.138500 3308.370117");
obj.SetOrientation("33.000000 0.000000 -6.000000");
obj.SetPosition("13105.249023 14.138500 3308.370117");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "13072.273438 9.930540 3329.108887");
obj.SetOrientation("32.000004 -0.000001 -9.000007");
obj.SetPosition("13072.273438 9.930540 3329.108887");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "13055.427734 6.942865 3339.639893");
obj.SetOrientation("32.000004 0.000000 -8.000007");
obj.SetPosition("13055.427734 6.942865 3339.639893");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "13038.374023 4.417790 3350.342285");
obj.SetOrientation("32.000004 0.000000 -6.000000");
obj.SetPosition("13038.374023 4.417790 3350.342285");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "13021.593750 2.533200 3360.621094");
obj.SetOrientation("31.000004 0.000000 -4.999999");
obj.SetPosition("13021.593750 2.533200 3360.621094");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "13005.000000 0.673482 3370.389893");
obj.SetOrientation("29.999998 -0.000000 -5.999998");
obj.SetPosition("13005.000000 0.673482 3370.389893");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "12851.191406 -1.959980 3458.041992");
obj.SetOrientation("31.000006 0.000000 -7.000000");
obj.SetPosition("12851.191406 -1.959980 3458.041992");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "12988.153320 -0.570049 3380.039063");
obj.SetOrientation("28.999998 0.000000 -1.000000");
obj.SetPosition("12988.153320 -0.570049 3380.039063");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "12970.811523 -0.751803 3389.938721");
obj.SetOrientation("30.000006 0.000000 0.000000");
obj.SetPosition("12970.811523 -0.751803 3389.938721");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "12953.819336 -0.791400 3399.572754");
obj.SetOrientation("28.999998 0.000000 0.000000");
obj.SetPosition("12953.819336 -0.791400 3399.572754");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "12936.460938 -0.763240 3409.207275");
obj.SetOrientation("28.999998 0.000000 0.000000");
obj.SetPosition("12936.460938 -0.763240 3409.207275");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "12919.072266 -0.805380 3418.916992");
obj.SetOrientation("28.999998 0.000000 0.000000");
obj.SetPosition("12919.072266 -0.805380 3418.916992");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "12901.765625 -0.835760 3428.729492");
obj.SetOrientation("29.999998 0.000000 0.000000");
obj.SetPosition("12901.765625 -0.835760 3428.729492");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "12884.500000 -0.842673 3438.728271");
obj.SetOrientation("30.000006 0.000000 0.000000");
obj.SetPosition("12884.500000 -0.842673 3438.728271");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "12867.349609 -0.852833 3448.610107");
obj.SetOrientation("29.999989 0.000000 0.000000");
obj.SetPosition("12867.349609 -0.852833 3448.610107");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "13088.500000 12.177998 3319.107910");
obj.SetOrientation("32.000004 0.000000 -4.999999");
obj.SetPosition("13088.500000 12.177998 3319.107910");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "12833.548828 -3.187357 3468.629883");
obj.SetOrientation("31.000002 0.000000 0.000000");
obj.SetPosition("12833.548828 -3.187357 3468.629883");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "12816.884766 -3.192310 3478.658936");
obj.SetOrientation("31.000004 0.000000 0.000000");
obj.SetPosition("12816.884766 -3.192310 3478.658936");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "12800.048828 -3.220020 3488.800049");
obj.SetOrientation("31.000006 0.000000 0.000000");
obj.SetPosition("12800.048828 -3.220020 3488.800049");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "12783.065430 -3.172760 3498.897461");
obj.SetOrientation("31.000006 0.000000 0.000000");
obj.SetPosition("12783.065430 -3.172760 3498.897461");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "12766.394531 -3.176960 3508.920166");
obj.SetOrientation("31.000006 0.000000 0.000000");
obj.SetPosition("12766.394531 -3.176960 3508.920166");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "12749.346680 -3.101180 3519.050537");
obj.SetOrientation("31.000006 0.000000 0.000000");
obj.SetPosition("12749.346680 -3.101180 3519.050537");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "12732.700195 -3.431210 3529.089111");
obj.SetOrientation("31.000002 -0.000000 -2.000000");
obj.SetPosition("12732.700195 -3.431210 3529.089111");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "12715.935547 -4.093610 3539.174805");
obj.SetOrientation("30.999996 0.000000 -2.000000");
obj.SetPosition("12715.935547 -4.093610 3539.174805");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "12699.500977 -4.721590 3548.677246");
obj.SetOrientation("29.999989 -1.000000 -2.000000");
obj.SetPosition("12699.500977 -4.721590 3548.677246");
obj = GetGame().CreateObject("Land_Wall_Gate_Camp", "12706.487305 6.013762 3550.859619");
obj.SetOrientation("-59.000004 0.000000 0.000000");
obj.SetPosition("12706.487305 6.013762 3550.859619");
obj = GetGame().CreateObject("Land_Ship_Big_BackB", "12688.839844 8.413790 3523.059570");
obj.SetOrientation("-145.000000 0.000000 0.000000");
obj.SetPosition("12688.839844 8.413790 3523.059570");
obj = GetGame().CreateObject("Land_Ship_Big_Castle", "12644.978516 19.211998 3507.927246");
obj.SetOrientation("0.000000 0.000000 0.000000");
obj.SetPosition("12644.978516 19.211998 3507.927246");
obj = GetGame().CreateObject("Land_Ship_Big_BackA", "12586.505859 9.677752 3491.763916");
obj.SetOrientation("0.000000 0.000000 0.000000");
obj.SetPosition("12586.505859 9.677752 3491.763916");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2665.006104 -6.482840 1400.589966");
obj.SetOrientation("-117.999939 0.000001 0.000000");
obj.SetPosition("2665.006104 -6.482840 1400.589966");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2655.979248 -6.498160 1418.059326");
obj.SetOrientation("-117.000015 0.000001 0.000000");
obj.SetPosition("2655.979248 -6.498160 1418.059326");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2647.350098 -6.502970 1434.969971");
obj.SetOrientation("-116.999977 0.000003 0.000000");
obj.SetPosition("2647.350098 -6.502970 1434.969971");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2638.299805 -6.503530 1452.390015");
obj.SetOrientation("-117.999977 0.000000 0.000000");
obj.SetPosition("2638.299805 -6.503530 1452.390015");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2628.928467 -6.461360 1469.640259");
obj.SetOrientation("-118.999992 0.000000 0.000000");
obj.SetPosition("2628.928467 -6.461360 1469.640259");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2619.302979 -6.454780 1486.979736");
obj.SetOrientation("-118.999962 0.000000 0.000000");
obj.SetPosition("2619.302979 -6.454780 1486.979736");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2609.729980 -6.478460 1504.236816");
obj.SetOrientation("-118.999962 0.000000 0.000000");
obj.SetPosition("2609.729980 -6.478460 1504.236816");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2600.340088 -6.477021 1521.543213");
obj.SetOrientation("-117.999977 0.000000 0.000000");
obj.SetPosition("2600.340088 -6.477021 1521.543213");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2581.899414 -6.462080 1534.130005");
obj.SetOrientation("62.000004 -0.000000 0.000000");
obj.SetPosition("2581.899414 -6.462080 1534.130005");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2572.527588 -6.442750 1551.390015");
obj.SetOrientation("61.000015 -0.000000 0.000000");
obj.SetPosition("2572.527588 -6.442750 1551.390015");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2563.029541 -6.428950 1568.526489");
obj.SetOrientation("60.999981 -0.000000 0.000000");
obj.SetPosition("2563.029541 -6.428950 1568.526489");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2553.472900 -6.432560 1585.769165");
obj.SetOrientation("61.000004 -0.000000 0.000000");
obj.SetPosition("2553.472900 -6.432560 1585.769165");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2543.889893 -6.419690 1603.119629");
obj.SetOrientation("61.000015 -0.000001 0.000000");
obj.SetPosition("2543.889893 -6.419690 1603.119629");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2534.219971 -6.432870 1620.199951");
obj.SetOrientation("59.999992 -0.000000 0.000000");
obj.SetPosition("2534.219971 -6.432870 1620.199951");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2524.667480 -6.420120 1636.834595");
obj.SetOrientation("59.999996 -0.000003 0.000000");
obj.SetPosition("2524.667480 -6.420120 1636.834595");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2514.910156 -6.429950 1653.764893");
obj.SetOrientation("60.000008 -0.000000 0.000000");
obj.SetPosition("2514.910156 -6.429950 1653.764893");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2505.116699 -6.422109 1670.810059");
obj.SetOrientation("59.999996 0.000000 0.000000");
obj.SetPosition("2505.116699 -6.422109 1670.810059");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2504.231201 -6.408660 1693.102173");
obj.SetOrientation("-119.999947 0.000000 0.000000");
obj.SetPosition("2504.231201 -6.408660 1693.102173");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2494.169922 -6.424910 1710.160034");
obj.SetOrientation("-120.999947 0.000000 0.000000");
obj.SetPosition("2494.169922 -6.424910 1710.160034");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2483.851563 -6.427920 1727.020630");
obj.SetOrientation("-122.000000 0.000000 0.000000");
obj.SetPosition("2483.851563 -6.427920 1727.020630");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2473.339600 -6.425820 1743.859985");
obj.SetOrientation("-121.999931 0.000003 0.000000");
obj.SetPosition("2473.339600 -6.425820 1743.859985");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2462.809570 -6.430620 1760.719971");
obj.SetOrientation("-121.999931 0.000000 0.000000");
obj.SetPosition("2462.809570 -6.430620 1760.719971");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2452.312744 -6.453650 1777.505005");
obj.SetOrientation("-121.999931 0.000000 0.000000");
obj.SetPosition("2452.312744 -6.453650 1777.505005");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2441.799561 -6.452640 1794.326172");
obj.SetOrientation("-121.999931 0.000000 0.000000");
obj.SetPosition("2441.799561 -6.452640 1794.326172");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2422.530029 -6.454740 1805.589966");
obj.SetOrientation("57.999996 -0.000000 0.000000");
obj.SetPosition("2422.530029 -6.454740 1805.589966");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2412.080078 -6.454741 1822.390015");
obj.SetOrientation("57.999992 -0.000000 0.000000");
obj.SetPosition("2412.080078 -6.454741 1822.390015");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2401.630127 -6.430430 1839.191040");
obj.SetOrientation("57.999981 -0.000000 0.000000");
obj.SetPosition("2401.630127 -6.430430 1839.191040");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2391.132080 -6.446010 1855.973267");
obj.SetOrientation("57.999996 -0.000000 0.000000");
obj.SetPosition("2391.132080 -6.446010 1855.973267");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2380.819824 -6.430320 1872.841064");
obj.SetOrientation("58.999989 -0.000000 0.000000");
obj.SetPosition("2380.819824 -6.430320 1872.841064");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2370.990234 -6.430320 1889.253906");
obj.SetOrientation("59.000000 -0.000000 0.000000");
obj.SetPosition("2370.990234 -6.430320 1889.253906");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2360.930420 -6.418190 1906.000244");
obj.SetOrientation("59.000000 -0.000000 0.000000");
obj.SetPosition("2360.930420 -6.418190 1906.000244");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2350.794189 -6.418190 1922.880005");
obj.SetOrientation("59.000000 -0.000000 0.000000");
obj.SetPosition("2350.794189 -6.418190 1922.880005");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2349.564453 -6.362230 1945.046509");
obj.SetOrientation("-120.999939 0.000000 0.000000");
obj.SetPosition("2349.564453 -6.362230 1945.046509");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2339.550049 -6.385840 1961.760376");
obj.SetOrientation("-120.999939 0.000000 0.000000");
obj.SetPosition("2339.550049 -6.385840 1961.760376");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2329.720459 -6.403370 1978.170898");
obj.SetOrientation("-120.999969 0.000000 0.000000");
obj.SetPosition("2329.720459 -6.403370 1978.170898");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2319.860840 -6.420010 1994.558838");
obj.SetOrientation("-121.000008 0.000000 0.000000");
obj.SetPosition("2319.860840 -6.420010 1994.558838");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2309.500000 -6.422760 2011.441040");
obj.SetOrientation("-121.999962 0.000000 0.000000");
obj.SetPosition("2309.500000 -6.422760 2011.441040");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2299.222168 -6.417800 2027.909790");
obj.SetOrientation("-121.999962 0.000000 0.000000");
obj.SetPosition("2299.222168 -6.417800 2027.909790");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "2288.853027 -6.430641 2044.497925");
obj.SetOrientation("-121.999962 0.000000 0.000000");
obj.SetPosition("2288.853027 -6.430641 2044.497925");
obj = GetGame().CreateObject("Land_Mil_Guardhouse2", "2287.009521 4.504731 2044.115967");
obj.SetOrientation("-31.000006 0.000000 0.000000");
obj.SetPosition("2287.009521 4.504731 2044.115967");
obj = GetGame().CreateObject("Land_Mil_Tower_Small", "2280.605225 6.371360 2038.340454");
obj.SetOrientation("-21.000008 0.000000 0.000000");
obj.SetPosition("2280.605225 6.371360 2038.340454");
obj = GetGame().CreateObject("Land_Ship_Big_FrontA", "2384.925293 16.160421 1993.242920");
obj.SetOrientation("0.000000 0.000000 0.000000");
obj.SetPosition("2384.925293 16.160421 1993.242920");
obj = GetGame().CreateObject("Land_Ship_Big_FrontB", "2360.853027 9.973032 1997.914063");
obj.SetOrientation("0.000000 0.000000 0.000000");
obj.SetPosition("2360.853027 9.973032 1997.914063");
obj = GetGame().CreateObject("Land_Ship_Big_BackA", "2269.009766 9.676602 1998.759155");
obj.SetOrientation("0.000000 0.000000 0.000000");
obj.SetPosition("2269.009766 9.676602 1998.759155");
obj = GetGame().CreateObject("Land_Ship_Big_BackB", "2204.281738 5.840928 2019.575684");
obj.SetOrientation("0.000000 0.000000 0.000000");
obj.SetPosition("2204.281738 5.840928 2019.575684");
obj = GetGame().CreateObject("Land_Ship_Big_Castle", "2225.506592 19.551493 2030.067871");
obj.SetOrientation("-6.000000 0.000000 0.000000");
obj.SetPosition("2225.506592 19.551493 2030.067871");
obj = GetGame().CreateObject("Land_Train_742_Blue", "2289.360107 8.871900 2069.010254");
obj.SetOrientation("-68.000000 0.000000 0.000000");
obj.SetPosition("2289.360107 8.871900 2069.010254");
}
class CustomMission: MissionServer
{
void SetRandomHealth(EntityAI itemEnt)
{
int rndHlt = Math.RandomInt(40,100);
itemEnt.SetHealth("","",rndHlt);
}
override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
{
Entity playerEnt;
playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE");//Creates random player
Class.CastTo(m_player, playerEnt);
GetGame().SelectPlayer(identity, m_player);
return m_player;
}
override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
{
/*
player.RemoveAllItems();
EntityAI item = player.GetInventory().CreateInInventory(topsArray.GetRandomElement());
EntityAI item2 = player.GetInventory().CreateInInventory(pantsArray.GetRandomElement());
EntityAI item3 = player.GetInventory().CreateInInventory(shoesArray.GetRandomElement());
*/
EntityAI itemEnt;
ItemBase itemBs;
itemEnt = player.GetInventory().CreateInInventory("Rag");
itemBs = ItemBase.Cast(itemEnt);
itemBs.SetQuantity(6);
itemEnt = player.GetInventory().CreateInInventory("HuntingKnife");
itemBs = ItemBase.Cast(itemEnt);
itemEnt = player.GetInventory().CreateInInventory("SodaCan_Cola");
itemBs = ItemBase.Cast(itemEnt);
itemEnt = player.GetInventory().CreateInInventory("Apple");
itemBs = ItemBase.Cast(itemEnt);
itemEnt = player.GetInventory().CreateInInventory("Apple");
itemBs = ItemBase.Cast(itemEnt);
itemEnt = player.GetInventory().CreateInInventory("Plum");
itemBs = ItemBase.Cast(itemEnt);
itemEnt = player.GetInventory().CreateInInventory("Plum");
itemBs = ItemBase.Cast(itemEnt);
itemEnt = player.GetInventory().CreateInInventory("Pear");
itemBs = ItemBase.Cast(itemEnt);
itemEnt = player.GetInventory().CreateInInventory("Pear");
itemBs = ItemBase.Cast(itemEnt);
}
bool freecam_active = false;
bool verify_admins = false; // true=verify presence of BI UID in admin list
string cmd_prefix = "/"; // Must be special character
ref TStringArray admins = {"76561198067240060"}; // Add your BI UID or SteamID
bool IsPlayerAnAdmin(PlayerBase player) {
bool found = false;
for ( int i = 0; i < admins.Count(); ++i ) {
if(player.GetIdentity().GetId() == admins[i] || player.GetIdentity().GetPlainId() == admins[i]) { found=true; break; }
}
return found;
}
void SendMessageToPlayer(PlayerBase player, string message) {
Param1<string> param = new Param1<string>( message );
GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, param, true, player.GetIdentity());
}
bool IsPlayer(string name) {
PlayerBase p;
array<Man> players = new array<Man>; GetGame().GetPlayers(players);
for ( int i = 0; i < players.Count(); ++i ) {
p = players.Get(i);
if(p.GetIdentity().GetName() == name) return true;
}
return false;
}
PlayerBase GetPlayer(string name) {
PlayerBase p;
array<Man> players = new array<Man>; GetGame().GetPlayers(players);
for ( int i = 0; i < players.Count(); ++i ) {
p = players.Get(i);
if(p.GetIdentity().GetName() == name) return p;
}
return NULL;
}
override void OnEvent(EventType eventTypeId, Param params) {
int i;
PlayerBase player, temp_player;
array<Man> players = new array<Man>; GetGame().GetPlayers(players);
if(eventTypeId != ChatMessageEventTypeID) { super.OnEvent(eventTypeId,params); return; }
ChatMessageEventParams chat_params = ChatMessageEventParams.Cast( params );
if(chat_params.param1 != 0 || chat_params.param2 == "") { super.OnEvent(eventTypeId,params); return; }
player = GetPlayer(chat_params.param2);
if(player == NULL) { super.OnEvent(eventTypeId,params); return; }
string message = chat_params.param3, prefix, param0, command;
TStringArray tokens = new TStringArray;
message.Replace("` ", "&SPCESC!");
message.Split(" ", tokens); int count = tokens.Count();
for ( i = 0; i < count; ++i ) {
message = tokens[i];
message.Replace("&SPCESC!", " ");
tokens[i] = message;
}
param0 = tokens.Get(0);
param0.ParseStringEx(prefix); if(prefix != cmd_prefix) { super.OnEvent(eventTypeId,params); return; };
param0.ParseStringEx(command);
if(verify_admins && !IsPlayerAnAdmin(player)) { GetGame().AdminLog("[ADMCMD] (Unauthorized) " + player.GetIdentity().GetName() +" ("+player.GetIdentity().GetPlainId()+", "+player.GetIdentity().GetId()+") tried to execute "+ chat_params.param3); return; }
GetGame().AdminLog("[ADMCMD] PLAYER: "+ player.GetIdentity().GetName() +" ("+player.GetIdentity().GetPlainId()+", "+player.GetIdentity().GetId()+") CMD: "+ command);
switch(command) {
case "spawn": {
if(count != 2) { SendMessageToPlayer(player, "/spawn [object]"); return; }
GetGame().CreateObject(tokens[1], player.GetPosition(), false, true );
SendMessageToPlayer(player, "[ObjectSpawn] Object spawned: " + tokens[1]);
break;
}
case "inv": {
if(count != 2) { SendMessageToPlayer(player, "/inv [object]"); return; }
player.GetInventory().CreateInInventory(tokens[1]);
SendMessageToPlayer(player, "[ObjectSpawn] Object spawned in inventory: " + tokens[1]);
break;
}
case "weapon": {
if(count != 2) { SendMessageToPlayer(player, "/weapon [weapon]"); return; }
EntityAI weapon;
switch(tokens[1]) {
case "ump": {
weapon = player.GetHumanInventory().CreateInHands("UMP45");
player.GetInventory().CreateInInventory("Mag_UMP_25Rnd");
break;
}
case "cz61": {
weapon = player.GetHumanInventory().CreateInHands("CZ61");
player.GetInventory().CreateInInventory("Mag_CZ61_20Rnd");
break;
}
case "mp5": {
weapon = player.GetHumanInventory().CreateInHands("MP5K");
weapon.GetInventory().CreateAttachment("MP5k_StockBttstck");
weapon.GetInventory().CreateAttachment("MP5_PRailHndgrd");
player.GetInventory().CreateInInventory("Mag_MP5_30Rnd");
break;
}
case "svd": {
weapon = player.GetHumanInventory().CreateInHands("SVD");
weapon.GetInventory().CreateAttachment("PSO11Optic");
player.GetInventory().CreateInInventory("Mag_SVD_10Rnd");
break;
}
case "mp133": {
weapon = player.GetHumanInventory().CreateInHands("Mp133Shotgun");
player.GetInventory().CreateInInventory("Ammo_12gaPellets");
break;
}
case "mosin": {
weapon = player.GetHumanInventory().CreateInHands("Mosin9130");
weapon.GetInventory().CreateAttachment("PUScopeOptic");
player.GetInventory().CreateInInventory("Ammo_762x54");
break;
}
case "m4": {
weapon = player.GetHumanInventory().CreateInHands("M4A1_Black");
weapon.GetInventory().CreateAttachment("M4_RISHndgrd_Black");
weapon.GetInventory().CreateAttachment("M4_MPBttstck_Black");
weapon.GetInventory().CreateAttachment("BUISOptic");
player.GetInventory().CreateInInventory("Mag_STANAGCoupled_30Rnd");
break;
}
case "akm": {
weapon = player.GetHumanInventory().CreateInHands("AKM");
weapon.GetInventory().CreateAttachment("AK_RailHndgrd");
weapon.GetInventory().CreateAttachment("AK_PlasticBttstck");
player.GetInventory().CreateInInventory("Mag_AKM_30Rnd");
break;
}
case "izh18": {
weapon = player.GetHumanInventory().CreateInHands("Izh18");
player.GetInventory().CreateInInventory("Ammo_762x39");
break;
}
case "fnx": {
weapon = player.GetHumanInventory().CreateInHands("FNX45");
player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd");
break;
}
default: {
SendMessageToPlayer(player, "[WeaponSpawner] " + tokens[1] + " not found");
break;
}
}
break;
}
case "strip": {
if(count != 2) { SendMessageToPlayer(player, "/strip [player]"); return; }
temp_player = GetPlayer(tokens[1]);
if(temp_player == NULL) {
SendMessageToPlayer(player, "[Strip] Can't find player called: '"+tokens[1]+"'");
} else {
temp_player.RemoveAllItems();
SendMessageToPlayer(player, "[Strip] You stripped " + temp_player.GetIdentity().GetName());
SendMessageToPlayer(temp_player, "You have been stripped by an admin");
}
break;
}
case "slap": {
if(count != 2) { SendMessageToPlayer(player, "/slap [player]"); return; }
temp_player = GetPlayer(tokens[1]);
if(temp_player == NULL) {
SendMessageToPlayer(player, "[Slap] Can't find player called: '"+tokens[1]+"'");
} else {
temp_player.SetPosition(temp_player.GetPosition() + "0 3 0");
SendMessageToPlayer(player, "[Slap] You stripped " + temp_player.GetIdentity().GetName());
SendMessageToPlayer(temp_player, "You have been slapped by an admin");
}
break;
}
case "topos": {
if (count < 3) { SendMessageToPlayer(player, "/topos [x] [y] (player)"); return; }
float ATL_Z = GetGame().SurfaceY(tokens[1].ToFloat(), tokens[2].ToFloat());
vector reqpos = Vector(tokens[1].ToFloat(), ATL_Z, tokens[2].ToFloat());
temp_player = player;
if (count == 4) {
temp_player = GetPlayer(tokens[3]);
if (temp_player == NULL) {
SendMessageToPlayer(player, "[Teleport] Can't find player called: '"+tokens[3]+"'"); return;
} else {
SendMessageToPlayer(temp_player, "[Teleport] You've been teleported to " + reqpos + " by admin " + player.GetIdentity().GetName());
}
}
temp_player.SetPosition(reqpos);
SendMessageToPlayer(player, "[Teleport] Target teleported to " + temp_player.GetPosition());
break;
}
case "goto": {
if(count != 2) { SendMessageToPlayer(player, "/goto [player]"); return; }
temp_player = GetPlayer(tokens[1]);
if(temp_player == NULL) {
SendMessageToPlayer(player, "[Teleport] Can't find player called: '"+tokens[1]+"'");
} else {
player.SetPosition(temp_player.GetPosition());
SendMessageToPlayer(player, "[Teleport] You teleported to " + temp_player.GetIdentity().GetName());
}
break;
}
case "allgoto": {
PlayerBase allgoto_target;
if(count != 2) { SendMessageToPlayer(player, "/allgoto [player]"); return; }
allgoto_target = GetPlayer(tokens[1]);
if(allgoto_target == NULL) {
SendMessageToPlayer(player, "[Teleport] Can't find player called: '"+tokens[1]+"'");
} else {
SendMessageToPlayer(player, "[Teleport] You teleported everyone to your location");
for (i = 0; i < players.Count(); i++) {
temp_player = players.Get(i);
SendMessageToPlayer(temp_player, "[Teleport] You have been teleported to player " + allgoto_target.GetIdentity().GetName());
temp_player.SetPosition(allgoto_target.GetPosition());
}
}
break;
}
case "here": {
if(count != 2) { SendMessageToPlayer(player, "/here [player]"); return; }
temp_player = GetPlayer(tokens[1]);
if(temp_player == NULL) {
SendMessageToPlayer(player, "[Teleport] Can't find player called: '"+tokens[1]+"'");
} else {
temp_player.SetPosition(player.GetPosition());
SendMessageToPlayer(temp_player, "[Teleport] You have been teleported to admin " + player.GetIdentity().GetName());
SendMessageToPlayer(player, "[Teleport] You teleported " + temp_player.GetIdentity().GetName() + " to your location");
}
break;
}
case "allhere": {
SendMessageToPlayer(player, "[Teleport] You teleported everyone to your location");
for (i = 0; i < players.Count(); i++) {
temp_player = players.Get(i);
SendMessageToPlayer(temp_player, "[Teleport] You have been teleported to admin " + player.GetIdentity().GetName());
temp_player.SetPosition(player.GetPosition());
}
break;
}
case "time": {
if(count != 3) { SendMessageToPlayer(player, "/time [hour] [minute]"); return; }
GetGame().GetWorld().SetDate( 2018, 1, 7, tokens[1].ToInt(), tokens[2].ToInt());
SendMessageToPlayer(player, "[Servertime] You have set the servertime to " + tokens[1] + ":"+tokens[2]);
break;
}
case "day": {
GetGame().GetWorld().SetDate( 2018, 1, 7, 12, 0);
SendMessageToPlayer(player, "[Servertime] You have set the servertime to daytime");
break;
}
case "night": {
GetGame().GetWorld().SetDate( 2018, 1, 7, 24, 0);
SendMessageToPlayer(player, "[Servertime] You have set the servertime to daytime");
break;
}
case "rain": {
if(count != 2) { SendMessageToPlayer(player, "/rain [value 0-100]"); return; }
float rain = tokens[1].ToFloat() / 100;
GetGame().GetWeather().GetRain().Set(rain, 0, 600);
SendMessageToPlayer(player, "[Weather] You have set Rain to " + tokens[1] + "% ["+rain+"]");
break;
}
case "fog": {
if(count != 2) { SendMessageToPlayer(player, "/rain [value 0-100]"); return; }
float fog = tokens[1].ToFloat() / 100;
GetGame().GetWeather().GetFog().Set(fog, 0, 600);
SendMessageToPlayer(player, "[Weather] You have set Fog to " + tokens[1] + "% ["+fog+"]");
break;
}
case "overcast": {
if(count != 2) { SendMessageToPlayer(player, "/rain [value 0-100]"); return; }
float overcast = tokens[1].ToFloat() / 100;
GetGame().GetWeather().GetOvercast().Set(overcast, 0, 600);
SendMessageToPlayer(player, "[Weather] You have set Overcast to " + tokens[1] + "% ["+overcast+"]");
break;
}
case "kill": {
if(count == 2) {
temp_player = GetPlayer(tokens[1]);
if(temp_player == NULL) {
SendMessageToPlayer(player, "[Kill] Can't find player called: '"+tokens[1]+"'");
} else {
temp_player.SetHealth(0);
SendMessageToPlayer(player, "[Kill] You killed " + temp_player.GetIdentity().GetName());
}
} else {
player.SetHealth(0);
SendMessageToPlayer(player, "[Kill] You killed yourself");
}
break;
}
case "killall": {
SendMessageToPlayer(player, "[Kill] You killed everyone");
for (i = 0; i < players.Count(); i++) {
temp_player = players.Get(i);
if(temp_player.GetIdentity().GetId() == player.GetIdentity().GetId()) continue;
temp_player.SetHealth(0);
}
break;
}
case "heal": {
PlayerBase heal_target;
if(count == 2) {
heal_target = GetPlayer(tokens[1]);
if(heal_target == NULL) {
SendMessageToPlayer(player, "[Heal] Can't find player called: '"+tokens[1]+"'");
} else {
SendMessageToPlayer(player, "[Heal] You healed " + heal_target.GetIdentity().GetName());
}
} else {
heal_target = player;
SendMessageToPlayer(player, "[Heal] You healed yourself");
}
if(heal_target != NULL) {
heal_target.SetHealth(heal_target.GetMaxHealth("", ""));
heal_target.SetHealth("", "Blood", heal_target.GetMaxHealth("", "Blood"));
heal_target.GetStatStamina().Set(1000);
heal_target.GetStatEnergy().Set(1000);
heal_target.GetStatWater().Set(1000);
}
break;
}
case "freecam": {
PlayerBase body = player;
if(freecam_active) {
freecam_active = false;
GetGame().SelectPlayer(player.GetIdentity(), body);
SendMessageToPlayer(player, "[Freecam] Exited");
} else {
freecam_active = true;
GetGame().SelectPlayer(player.GetIdentity(), NULL);
GetGame().SelectSpectator(player.GetIdentity(), "freedebugcamera", player.GetPosition());
SendMessageToPlayer(player, "[Freecam] Entered");
}
break;
}
case "offroad": {
SendMessageToPlayer(player, "[Offroad] Vehicled spawned");
Car v;
float playerAngle = MiscGameplayFunctions.GetHeadingAngle(player);
vector posModifier = Vector(-(3 * Math.Sin(playerAngle)), 0, 3 * Math.Cos(playerAngle));
v = Car.Cast(GetGame().CreateObject( "OffroadHatchback", player.GetPosition() + posModifier));
v.GetInventory().CreateAttachment("SparkPlug");
v.GetInventory().CreateAttachment("EngineBelt");
v.GetInventory().CreateAttachment("CarBattery");
v.GetInventory().CreateAttachment("HatchbackHood");
v.GetInventory().CreateAttachment("HatchbackTrunk");
v.GetInventory().CreateAttachment("HatchbackDoors_CoDriver");
v.GetInventory().CreateAttachment("HatchbackWheel");
v.GetInventory().CreateAttachment("HatchbackWheel");
v.GetInventory().CreateAttachment("HatchbackWheel");
v.GetInventory().CreateAttachment("HatchbackWheel");
v.GetInventory().CreateAttachment("HatchbackWheel"); // spare
break;
}
case "refuel": {
ref array<Object> nearest_objects = new array<Object>;
ref array<CargoBase> proxy_cargos = new array<CargoBase>;
Car toBeFilled;
vector position = player.GetPosition();
GetGame().GetObjectsAtPosition ( position, 10, nearest_objects, proxy_cargos );
for (i = 0; i < nearest_objects.Count(); i++) {
if (nearest_objects[i].IsKindOf("CarScript")) {
SendMessageToPlayer(player, "[Refuel] Found car: '"+nearest_objects[i]+"'");
toBeFilled = Car.Cast(nearest_objects[i]);
float fuelReq = toBeFilled.GetFluidCapacity( CarFluid.FUEL ) - (toBeFilled.GetFluidCapacity( CarFluid.FUEL ) * toBeFilled.GetFluidFraction( CarFluid.FUEL ));
float oilReq = toBeFilled.GetFluidCapacity( CarFluid.OIL ) - (toBeFilled.GetFluidCapacity( CarFluid.OIL ) * toBeFilled.GetFluidFraction( CarFluid.OIL ));
float coolantReq = toBeFilled.GetFluidCapacity( CarFluid.COOLANT ) - (toBeFilled.GetFluidCapacity( CarFluid.COOLANT ) * toBeFilled.GetFluidFraction( CarFluid.COOLANT ));
float brakeReq = toBeFilled.GetFluidCapacity( CarFluid.BRAKE ) - (toBeFilled.GetFluidCapacity( CarFluid.BRAKE ) * toBeFilled.GetFluidFraction( CarFluid.BRAKE ));
toBeFilled.Fill( CarFluid.FUEL, fuelReq );
toBeFilled.Fill( CarFluid.OIL, oilReq );
toBeFilled.Fill( CarFluid.COOLANT, coolantReq );
toBeFilled.Fill( CarFluid.BRAKE, brakeReq );
SendMessageToPlayer(player, "[Refuel] "+fuelReq+"L added, all fluids maxed");
}
}
break;
}
default: {
SendMessageToPlayer(player, "Unknown command: " + command);
break;
}
}
}
};
Mission CreateCustomMission(string path)
{
return new CustomMission();
}