Перейти к содержимому
View in the app

A better way to browse. Learn more.

Zloplay community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Опубликовано:

Hello

 

I'm currently creating an infected server with alot of map-edits.

But there is a problem... with all the map editing (adding crates, flags,...) people get stuck alot.

 

Is there some kind of way to help them? (Yes, I can give them bouncing betties so they can knife it to commit suicide, but on some maps the infected are really underpowered because of this.)

 

Would there be some kind of script that allows you to:

- kill yourself

- teleport you to a spot on the map by typing !home

- any other options?

 

 

Thank you very much

 

Syphon

Опубликовано:
  • Автор

If suicide would be the option, then yes, they would become infected.

And i'm kinda really bad with scripting... as in "monkey see, monkey do..." xD

 

Could you give me a link to some information about a teleporting script or suicide script?

Опубликовано:

Here's some code from (I think) dukip

float X, Y, Z = 0; //Creates 3 floats to store variables.


entity.Call("notifyonplayercommand", "save", "+actionslot 6"); //Saves position if action key 6 is pressed.
entity.Call("notifyonplayercommand", "load", "+actionslot 7"); //Loads position if action key 7 is pressed.

entity.OnNotify("save", (player) =>
{
X = (player.Origin.X); //Saves the X position
Y = (player.Origin.Y); //Saves Y position
Z = (player.Origin.Z); //Saves Z (height) position
entity.Call("playlocalsound","ui_mp_nukebomb_timer"); //Plays the nuke sound on saving
entity.Call("iprintln",	"^1Position Saved To: ^2" +  player.Origin); //Tells the player their position was saved.
});

entity.OnNotify("load", (player) =>
{
if (X != 0 && Y != 0 && Z != 0)
{
//If X, Y And Z doesn't equal 0 then set the position of the player from stored values, plays the Copycat sound and then tells they where they were loaded to.
entity.Call("setorigin",new Vector3(X, Y, Z));
entity.Call("playlocalsound", "copycat_steal_class");
entity.Call("iprintln", "^1Position Loaded To: ^6" + player.Origin);
}
else
{
	entity.Call("iprintln", "Save a position ^1first!");
}
});

 

I modded it just a little bit.

You can change it to call the functions for saving and loading by using OnSay();

Опубликовано:
  • Автор

Wow, This is quite amazing.

Would it be possible to let this script read which map it is and set a 'static' location, which you can use to teleport when you're stuck?

 

for example: (i don't know how to code though)

 

float X, Y, Z = 0; //Creates 3 floats to store variables.

entity.Call("notifyonplayercommand", "load", "+actionslot 7"); //Loads position if action key 7 is pressed.

  if entity.map = mp_dome
  {
  entity.Call("setorigin",new Vector3(+100, +100, 100));                               //edit these coordinates to change location
  entity.Call("iprintln", "^1Position Loaded To: ^6 Standard spawn location);          // message display
  }

  if entity.map = mp_bravo
   {...
   ...
   }

  //add other functions for different maps

  Else
  { 
  Sorry, the admin did not set a respawn location for this map, please contact the admin.
  }
});

 

If you'd give me an example for 1 map, I would be happy to write locations for all the maps :D

 

Also please excuse me for my weak knowledge of programming

Опубликовано:

Look through here:

(DUKIP's code)

п»їп»їusing System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using InfinityScript;

namespace DUKIP
{
   public class MapEdit : BaseScript
   {
       private Entity _airdropCollision;
       private Random _rng = new Random();
       private string _mapname;
       public MapEdit()
           : base()
       {
           Entity care_package = Call("getent", "care_package", "targetname");
           _airdropCollision = Call("getent", care_package.GetField("target"), "targetname");
           _mapname = Call("getdvar", "mapname");
           Call("precachemodel", getAlliesFlagModel(_mapname));
           Call("precachemodel", getAxisFlagModel(_mapname));
           Call("precachemodel", "prop_flag_neutral");
           Call("precacheshader", "waypoint_flag_friendly");
           Call("precacheshader", "compass_waypoint_target");
           Call("precacheshader", "compass_waypoint_bomb");
           Call("precachemodel", "weapon_scavenger_grenadebag");
           Call("precachemodel", "weapon_oma_pack");
           //Call("setdvar", "mapedit_allowcheats", "1");

           if (File.Exists("scripts\\maps\\" + _mapname + ".txt"))
               loadMapEdit(_mapname);

           PlayerConnected += new Action(player =>
           {
               if (Call("getdvarint", "mapedit_allowcheats") == 1 && (player.GetField("name") == "TheApadayo" || player.GetField("name") == "DidUknowiPwn"))
                   player.Call("notifyonplayercommand", "fly", "+frag");
               player.SetField("attackeddoor", 0); // debounce timer
               player.SetField("repairsleft", 0); // door repairs remaining

               // usable notifications
               player.Call("notifyonplayercommand", "triggeruse", "+activate");
               player.OnNotify("triggeruse", (ent) => HandleUseables(player));

               UsablesHud(player);
               player.OnNotify("fly", (ent) =>
               {
                   if (player.GetField("sessionstate") != "spectator")
                   {
                       player.Call("allowspectateteam", "freelook", true);
                       player.SetField("sessionstate", "spectator");
                       player.Call("setcontents", 0);
                   }
                   else
                   {
                       player.Call("allowspectateteam", "freelook", false);
                       player.SetField("sessionstate", "playing");
                       player.Call("setcontents", 100);
                   }
               });
           });
       }

       public override void OnSay(Entity player, string name, string message)
       {
           //if (Call("getdvarint", "mapedit_allowcheats") != 1) return;
           // stop idiots from cheating
           string[] commands = { "viewpos", "cash", "credits", "player", "zombie" };
           if (commands.Contains(message) && !(player.GetField("name") == "TheApadayo" || player.GetField("name") == "DidUknowiPwn"))
           {
               player.Call("iprintlnbold", "Stop Cheating Idiot...");
               return;
           }

           switch (message)
           {
               case "viewpos":
                   print("({0}, {1}, {2})", player.Origin.X, player.Origin.Y, player.Origin.Z);
                   break;
               case "cash":
                   player.SetField("cash", player.GetField("cash") + 500);
                   break;
               case "credits":
                   player.SetField("credits", player.GetField("credits") + 500);
                   break;
               case "player":
                   player.SetField("team", "allies");
                   player.SetField("sessionteam", "allies");
                   break;
               case "zombie":
                   player.SetField("team", "axis");
                   player.SetField("sessionteam", "axis");
                   break;
           }
           if (message.StartsWith("sound"))
           {
               player.Call("playlocalsound", message.Split(' ')[1]);
           }
           if (message.StartsWith("model"))
           {
               Call("precachemodel", message.Split(' ')[1]);
               Entity ent = Call("spawn", "script_model", new Parameter(player.Origin));
               ent.Call("setmodel", message.Split(' ')[1]);
               ent.SetField("angles", new Parameter(player.GetField("angles")));
           }
           /*if (message.StartsWith("health"))
           {
               player.Call("iprintlnbold", "Health is at: ^1" + player.Health + "^0/^1" + player.GetField("maxhp"));
           }*/
       }

       public void CreateRamp(Vector3 top, Vector3 bottom)
       {
           float distance = top.DistanceTo(bottom);
           int blocks = (int)Math.Ceiling(distance / 30);
           Vector3 A = new Vector3((top.X - bottom.X) / blocks, (top.Y - bottom.Y) / blocks, (top.Z - bottom.Z) / blocks);
           Vector3 temp = Call("vectortoangles", new Parameter(top - bottom));
           Vector3 BA = new Vector3(temp.Z, temp.Y + 90, temp.X);
           for (int b = 0; b <= blocks; b++)
           {
               spawnCrate(bottom + (A * , BA);
           }
       }

       public static List usables = new List();
       public void HandleUseables(Entity player)
       {
           foreach (Entity ent in usables)
           {
               if (player.Origin.DistanceTo(ent.Origin) < ent.GetField("range"))
               {
                   switch (ent.GetField("usabletype"))
                   {
                       case "door":
                           usedDoor(ent, player);
                           break;
                       default:
                           break;
                   }
               }
           }
       }

       public static void runOnUsable(Func func, string type)
       {
           foreach (Entity ent in usables)
           {
               if (ent.GetField("usabletype") == type)
               {
                   func.Invoke(ent);
               }
           }
       }

       public static void notifyUsables(string notify)
       {
           foreach (Entity usable in usables)
           {
               usable.Notify(notify);
           }
       }

       public void UsablesHud(Entity player)
       {
           HudElem message = HudElem.CreateFontString(player, "hudbig", 0.6f);
           message.SetPoint("CENTER", "CENTER", 0, -50);
           OnInterval(100, () =>
           {
               bool _changed = false;
               foreach (Entity ent in usables)
               {
                   if (player.Origin.DistanceTo(ent.Origin) < ent.GetField("range"))
                   {
                       switch (ent.GetField("usabletype"))
                       {
                           case "door":
                               message.SetText(getDoorText(ent, player));
                               break;
                           default:
                               message.SetText("");
                               break;
                       }
                       _changed = true;
                   }
               }
               if (!_changed)
               {
                   message.SetText("");
               }
               return true;
           });
       }

       public string getDoorText(Entity door, Entity player)
       {
           int hp = door.GetField("hp");
           int maxhp = door.GetField("maxhp");
           if (player.GetField("sessionteam") == "allies")
           {
               switch (door.GetField("state"))
               {
                   case "open":
                       if(player.CurrentWeapon == "defaultweapon_mp")
                           return "Door is Open. Press ^3[{+activate}] ^7to repair it. (" + hp + "/" + maxhp + ")";
                       return "Door is Open. Press ^3[{+activate}] ^7to close it. (" + hp + "/" + maxhp + ")";
                   case "close":
                       if (player.CurrentWeapon == "defaultweapon_mp")
                           return "Door is Closed. Press ^3[{+activate}] ^7to repair it. (" + hp + "/" + maxhp + ")";
                       return "Door is Closed. Press ^3[{+activate}] ^7to open it. (" + hp + "/" + maxhp + ")";
                   case "broken":
                       if (player.CurrentWeapon == "defaultweapon_mp")
                           return "Door is Broken. Press ^3[{+activate}] ^7to repair it. (" + hp + "/" + maxhp + ")";
                       return "^1Door is Broken.";
               }
           }
           else if (player.GetField("sessionteam") == "axis")
           {
               switch (door.GetField("state"))
               {
                   case "open":
                       return "Door is Open.";
                   case "close":
                       return "Press ^3[{+activate}] ^7to attack the door.";
                   case "broken":
                       return "^1Door is Broken";
               }
           }
           return "";
       }

       public void MakeUsable(Entity ent, string type, int range)
       {
           ent.SetField("usabletype", type);
           ent.SetField("range", range);
           usables.Add(ent);
       }

       public void CreateDoor(Vector3 open, Vector3 close, Vector3 angle, int size, int height, int hp, int range)
       {
           double offset = (((size / 2) - 0.5) * -1);
           Entity center = Call("spawn", "script_model", new Parameter(open));
           for (int j = 0; j < size; j++)
           {
               Entity door = spawnCrate(open + (new Vector3(0, 30, 0) * (float)offset), new Vector3(0, 0, 0));
               door.Call("setModel", "com_plasticcase_enemy");
               door.Call("enablelinkto");
               door.Call("linkto", center);
               for (int h = 1; h < height; h++)
               {
                   Entity door2 = spawnCrate(open + (new Vector3(0, 30, 0) * (float)offset) - (new Vector3(70, 0, 0) * h), new Vector3(0, 0, 0));
                   door2.Call("setModel", "com_plasticcase_enemy");
                   door2.Call("enablelinkto");
                   door2.Call("linkto", center);
               }
               offset += 1;
           }
           center.SetField("angles", new Parameter(angle));
           center.SetField("state", "open");
           center.SetField("hp", hp);
           center.SetField("maxhp", hp);
           center.SetField("open", new Parameter(open));
           center.SetField("close", new Parameter(close));

           MakeUsable(center, "door", range);
       }

       private void repairDoor(Entity door, Entity player)
       {
           if (player.GetField("repairsleft") == 0) return; // no repairs left on weapon

           if (door.GetField("hp") < door.GetField("maxhp"))
           {
               door.SetField("hp", door.GetField("hp") + 1);
               player.SetField("repairsleft", player.GetField("repairsleft") - 1);
               player.Call("iprintlnbold", "Repaired Door! (" + player.GetField("repairsleft") + " repairs left)");
               // repair it if broken and close automatically
               if (door.GetField("state") == "broken")
               {
                   door.Call(33399, new Parameter(door.GetField("close")), 1); // moveto
                   AfterDelay(300, () =>
                   {
                       door.SetField("state", "close");
                   });
               }
           }
           else
           {
               player.Call("iprintlnbold", "Door has full health!");
           }
       }

       private void usedDoor(Entity door, Entity player)
       {
           if (!player.IsAlive) return;
           // has repair weapon. do repair door
           if (player.CurrentWeapon.Equals("defaultweapon_mp"))
           {
               repairDoor(door, player);
               return;
           }
           if (door.GetField("hp") > 0)
           {
               if (player.GetField("sessionteam") == "allies")
               {
                   if (door.GetField("state") == "open")
                   {
                       door.Call(33399, new Parameter(door.GetField("close")), 1); // moveto
                       AfterDelay(300, () =>
                       {
                           door.SetField("state", "close");
                       });
                   }
                   else if (door.GetField("state") == "close")
                   {
                       door.Call(33399, new Parameter(door.GetField("open")), 1); // moveto
                       AfterDelay(300, () =>
                       {
                           door.SetField("state", "open");
                       });
                   }
               }
               else if (player.GetField("sessionteam") == "axis")
               {
                   if (door.GetField("state") == "close")
                   {
                       if (player.GetField("attackeddoor") == 0)
                       {
                           int hitchance = 0;
                           switch (player.Call("getstance"))
                           {
                               case "prone":
                                   hitchance = 20;
                                   break;
                               case "couch":
                                   hitchance = 45;
                                   break;
                               case "stand":
                                   hitchance = 90;
                                   break;
                               default:
                                   break;
                           }
                           if (_rng.Next(100) < hitchance)
                           {
                               door.SetField("hp", door.GetField("hp") - 1);
                               player.Call("iprintlnbold", "HIT: " + door.GetField("hp") + "/" + door.GetField("maxhp"));
                           }
                           else
                           {
                               player.Call("iprintlnbold", "^1MISS");
                           }
                           player.SetField("attackeddoor", 1);
                           player.AfterDelay(1000, (e) => player.SetField("attackeddoor", 0));
                       }
                   }
               }
           }
           else if (door.GetField("hp") == 0 && door.GetField("state") != "broken")
           {
               if (door.GetField("state") == "close")
                   door.Call(33399, new Parameter(door.GetField("open")), 1f); // moveto
               door.SetField("state", "broken");
           }
       }

       public Entity CreateWall(Vector3 start, Vector3 end)
       {
           float D = new Vector3(start.X, start.Y, 0).DistanceTo(new Vector3(end.X, end.Y, 0));
           float H = new Vector3(0, 0, start.Z).DistanceTo(new Vector3(0, 0, end.Z));
           int blocks = (int)Math.Round(D / 55, 0);
           int height = (int)Math.Round(H / 30, 0);

           Vector3 C = end - start;
           Vector3 A = new Vector3(C.X / blocks, C.Y / blocks, C.Z / height);
           float TXA = A.X / 4;
           float TYA = A.Y / 4;
           Vector3 angle = Call("vectortoangles", new Parameter(C));
           angle = new Vector3(0, angle.Y, 90);
           Entity center = Call("spawn", "script_origin", new Parameter(new Vector3(
               (start.X + end.X) / 2, (start.Y + end.Y) / 2, (start.Z + end.Z) / 2)));
           for (int h = 0; h < height; h++)
           {
               Entity crate = spawnCrate((start + new Vector3(TXA, TYA, 10) + (new Vector3(0, 0, A.Z) * h)), angle);
               crate.Call("enablelinkto");
               crate.Call("linkto", center);
               for (int i = 0; i < blocks; i++)
               {
                   crate = spawnCrate(start + (new Vector3(A.X, A.Y, 0) * i) + new Vector3(0, 0, 10) + (new Vector3(0, 0, A.Z) * h), angle);
                   crate.Call("enablelinkto");
                   crate.Call("linkto", center);
               }
               crate = spawnCrate(new Vector3(end.X, end.Y, start.Z) + new Vector3(TXA * -1, TYA * -1, 10) + (new Vector3(0, 0, A.Z) * h), angle);
               crate.Call("enablelinkto");
               crate.Call("linkto", center);
           }
           return center;
       }
       public Entity CreateFloor(Vector3 corner1, Vector3 corner2)
       {
           float width = corner1.X - corner2.X;
           if (width < 0) width = width * -1;
           float length = corner1.Y - corner2.Y;
           if (length < 0) length = length * -1;

           int bwide = (int)Math.Round(width / 50, 0);
           int blength = (int)Math.Round(length / 30, 0);
           Vector3 C = corner2 - corner1;
           Vector3 A = new Vector3(C.X / bwide, C.Y / blength, 0);
           Entity center = Call("spawn", "script_origin", new Parameter(new Vector3(
               (corner1.X + corner2.X) / 2, (corner1.Y + corner2.Y) / 2, corner1.Z)));
           for (int i = 0; i < bwide; i++)
           {
               for (int j = 0; j < blength; j++)
               {
                   Entity crate = spawnCrate(corner1 + (new Vector3(A.X, 0, 0) * i) + (new Vector3(0, A.Y, 0) * j), new Vector3(0, 0, 0));
                   crate.Call("enablelinkto");
                   crate.Call("linkto", center);
               }
           }
           return center;
       }

       private int _flagCount = 0;

       public void CreateElevator(Vector3 enter, Vector3 exit)
       {
           Entity flag = Call("spawn", "script_model", new Parameter(enter));
           flag.Call("setModel", getAlliesFlagModel(_mapname));
           Entity flag2 = Call("spawn", "script_model", new Parameter(exit));
           flag2.Call("setModel", getAxisFlagModel(_mapname));

           int curObjID = 31 - _flagCount++;
           Call(431, curObjID, "active"); // objective_add
           Call(435, curObjID, new Parameter(flag.Origin)); // objective_position
           Call(434, curObjID, "compass_waypoint_bomb"); // objective_icon

           OnInterval(100, () =>
           {
               foreach (Entity player in getPlayers())
               {
                   if (player.Origin.DistanceTo(enter) <= 50)
                   {
                       player.Call("setorigin", new Parameter(exit));
                   }
               }
               return true;
           });
       }

       public void CreateHiddenTP(Vector3 enter, Vector3 exit)
       {
           Entity flag = Call("spawn", "script_model", new Parameter(enter));
           flag.Call("setModel", "weapon_scavenger_grenadebag");
           Entity flag2 = Call("spawn", "script_model", new Parameter(exit));
           flag2.Call("setModel", "weapon_oma_pack");
           OnInterval(100, () =>
           {
               foreach (Entity player in getPlayers())
               {
                   if (player.Origin.DistanceTo(enter) <= 50)
                   {
                       player.Call("setorigin", new Parameter(exit));
                   }
               }
               return true;
           });
       }

       // maybe someday
       /*private void realElevator(Vector3 bottom, Vector3 top)
       {
           Entity center = Call("spawn", "script_origin", new Parameter(bottom));
           Entity floor = CreateFloor(new Vector3(bottom.X - 200, bottom.Y - 150, bottom.Z),
               new Vector3(bottom.X + 200, bottom.Y + 150, bottom.Z));
           floor.Call("enablelinkto");
           floor.Call("linkto", center);
           Entity cieling = CreateFloor(new Vector3(bottom.X - 200, bottom.Y - 150, bottom.Z),
               new Vector3(bottom.X + 200, bottom.Y + 150, bottom.Z + 300));
           cieling.Call("enablelinkto");
           cieling.Call("linkto", center);
       }*/

       public Entity spawnModel(string model, Vector3 origin, Vector3 angles)
       {
           Entity ent = Call("spawn", "script_model", new Parameter(origin));
           ent.Call("setmodel", model);
           ent.SetField("angles", new Parameter(angles));
           return ent;
       }

       public Entity spawnCrate(Vector3 origin, Vector3 angles)
       {
           Entity ent = Call("spawn", "script_model", new Parameter(origin));
           ent.Call("setmodel", "com_plasticcase_friendly");
           ent.SetField("angles", new Parameter(angles));
           ent.Call(33353, _airdropCollision); // clonebrushmodeltoscriptmodel
           return ent;
       }
       public Entity[] getSpawns(string name)
       {
           return Call("getentarray", name, "classname");
       }
       public void removeSpawn(Entity spawn)
       {
           spawn.Call("delete");
       }
       public void createSpawn(string type, Vector3 origin, Vector3 angle)
       {
           Entity spawn = Call("spawn", type, new Parameter(origin));
           spawn.SetField("angles", new Parameter(angle));
       }

       private static void print(string format, params object[] p)
       {
           Log.Write(LogLevel.All, format, p);
       }

       private void loadMapEdit(string mapname)
       {
           try
           {
               StreamReader map = new StreamReader("scripts\\maps\\" + mapname + ".txt");
               while (!map.EndOfStream)
               {
                   string line = map.ReadLine();
                   if (line.StartsWith("//") || line.Equals(string.Empty))
                   {
                       continue;
                   }
                   string[] split = line.Split(':');
                   if (split.Length < 1)
                   {
                       continue;
                   }
                   string type = split[0];
                   switch (type)
                   {
                       case "crate":
                           split = split[1].Split(';');
                           if (split.Length < 2) continue;
                           spawnCrate(parseVec3(split[0]), parseVec3(split[1]));
                           break;
                       case "ramp":
                           split = split[1].Split(';');
                           if (split.Length < 2) continue;
                           CreateRamp(parseVec3(split[0]), parseVec3(split[1]));
                           break;
                       case "elevator":
                           split = split[1].Split(';');
                           if (split.Length < 2) continue;
                           CreateElevator(parseVec3(split[0]), parseVec3(split[1]));
                           break;
                       case "HiddenTP":
                           split = split[1].Split(';');
                           if (split.Length < 2) continue;
                           CreateHiddenTP(parseVec3(split[0]), parseVec3(split[1]));
                           break;
                       case "door":
                           split = split[1].Split(';');
                           if (split.Length < 7) continue;
                           CreateDoor(parseVec3(split[0]), parseVec3(split[1]), parseVec3(split[2]), int.Parse(split[3]), int.Parse(split[4]), int.Parse(split[5]), int.Parse(split[6]));
                           break;
                       case "wall":
                           split = split[1].Split(';');
                           if (split.Length < 2) continue;
                           CreateWall(parseVec3(split[0]), parseVec3(split[1]));
                           break;
                       case "floor":
                           split = split[1].Split(';');
                           if (split.Length < 2) continue;
                           CreateFloor(parseVec3(split[0]), parseVec3(split[1]));
                           break;
                       /*case "realelevator":
                           split = split[1].Split(';');
                           if (split.Length < 2) continue;
                           realElevator(parseVec3(split[0]), parseVec3(split[1]));
                           break;*/
                       case "model":
                           split = split[1].Split(';');
                           if (split.Length < 3) continue;
                           spawnModel(split[0], parseVec3(split[1]), parseVec3(split[2]));
                           break;
                       default:
                           print("Unknown MapEdit Entry {0}... ignoring", type);
                           break;
                   }
               }
           }
           catch (Exception e)
           {
               print("error loading mapedit for map {0}: {1}", mapname, e.Message);
           }
       }

       private Vector3 parseVec3(string vec3)
       {
           vec3 = vec3.Replace(" ", string.Empty);
           if (!vec3.StartsWith("(") && !vec3.EndsWith(")")) throw new IOException("Malformed MapEdit File!");
           vec3 = vec3.Replace("(", string.Empty);
           vec3 = vec3.Replace(")", string.Empty);
           String[] split = vec3.Split(',');
           if (split.Length < 3) throw new IOException("Malformed MapEdit File!");
           return new Vector3(float.Parse(split[0]), float.Parse(split[1]), float.Parse(split[2]));
       }

       private string getAlliesFlagModel(string mapname)
       {
           switch (mapname)
           {
               case "mp_alpha":
               case "mp_dome":
               case "mp_exchange":
               case "mp_hardhat":
               case "mp_interchange":
               case "mp_lambeth":
               case "mp_radar":
               case "mp_cement":
               case "mp_hillside_ss":
               case "mp_morningwood":
               case "mp_overwatch":
               case "mp_park":
               case "mp_qadeem":
               case "mp_restrepo_ss":
               case "mp_terminal_cls":
               case "mp_roughneck":
               case "mp_boardwalk":
               case "mp_moab":
               case "mp_nola":
                   return "prop_flag_delta";
               case "mp_bootleg":
               case "mp_bravo":
               case "mp_carbon":
               case "mp_mogadishu":
               case "mp_village":
               case "mp_shipbreaker":
                   return "prop_flag_pmc";
               case "mp_paris":
                   return "prop_flag_gign";
               case "mp_plaza2":
               case "mp_seatown":
               case "mp_underground":
               case "mp_aground_ss":
               case "mp_courtyard_ss":
               case "mp_italy":
               case "mp_meteora":
                   return "prop_flag_sas";
           }
           return "";
       }
       private string getAxisFlagModel(string mapname)
       {
           switch (mapname)
           {
               case "mp_alpha":
               case "mp_bootleg":
               case "mp_dome":
               case "mp_exchange":
               case "mp_hardhat":
               case "mp_interchange":
               case "mp_lambeth":
               case "mp_paris":
               case "mp_plaza2":
               case "mp_radar":
               case "mp_underground":
               case "mp_cement":
               case "mp_hillside_ss":
               case "mp_overwatch":
               case "mp_park":
               case "mp_restrepo_ss":
               case "mp_terminal_cls":
               case "mp_roughneck":
               case "mp_boardwalk":
               case "mp_moab":
               case "mp_nola":
                   return "prop_flag_speznas";
               case "mp_bravo":
               case "mp_carbon":
               case "mp_mogadishu":
               case "mp_village":
               case "mp_shipbreaker":
                   return "prop_flag_africa";
               case "mp_seatown":
               case "mp_aground_ss":
               case "mp_courtyard_ss":
               case "mp_meteora":
               case "mp_morningwood":
               case "mp_qadeem":
               case "mp_italy":
                   return "prop_flag_ic";
           }
           return "";
       }

       private Entity[] getPlayers()
       {
           List players = new List();
           for (int i = 0; i < 17; i++)
           {
               Entity entity = Call("getentbynum", i);
               if (entity != null)
               {
                   if (entity.IsPlayer)
                   {
                       players.Add(entity);
                   }
               }
           }
           return players.ToArray();
       }
   }
}

 

This should help you alot. Look at how the map names are used.

Опубликовано:
  • Автор

Well I have to say, this really isn't easy

 

A question: if

_mapname = Call("getdvar", "mapname");

reads out the map, how can I let the script check if the map is in the list?

 

        _mapname = Call("getdvar", "mapname");
               case "mp_alpha":

or

        _mapname = Call("getdvar", "mapname");
               IF _mapname = "mp_alpha":

 

I'm kinda unfamiliar with this language, the only thing I program are Beckhoff PLC's xD

 

What I have now (though it doesn't work):

 

float X, Y, Z = 0; //Creates 3 floats to store variables.

namespace Teleportscript
{
   public class Teleportscript : BaseScript
   {
       private string _mapname;
       public Teleportscript()
           : base()
   {
       _mapname = Call("getdvar", "mapname");
//locations of every map
               case "mp_alpha":

               case "mp_dome":
entity.OnNotify("load", (player) =>
{
  entity.Call("setorigin",new Vector3(-43, 1154, -291));
  entity.Call("playlocalsound", "copycat_steal_class");
  entity.Call("iprintln", "^1Position Loaded To: ^6" + player.Origin);
  }
               case "mp_exchange":
               case "mp_hardhat":
               case "mp_interchange":
               case "mp_lambeth":
               case "mp_radar":
               case "mp_cement":
               case "mp_hillside_ss":
               case "mp_morningwood":
               case "mp_overwatch":
               case "mp_park":
               case "mp_qadeem":
               case "mp_restrepo_ss":
               case "mp_terminal_cls":
               case "mp_roughneck":
               case "mp_boardwalk":
               case "mp_moab":
               case "mp_nola":
               case "mp_bootleg":
               case "mp_bravo":
               case "mp_carbon":
               case "mp_mogadishu":
               case "mp_village":
               case "mp_shipbreaker":
               case "mp_paris":
               case "mp_plaza2":
               case "mp_seatown":
               case "mp_underground":
               case "mp_aground_ss":
               case "mp_courtyard_ss":
               case "mp_italy":
               case "mp_meteora":
           }

// end locations
entity.Call("notifyonplayercommand", "load", "+actionslot 7"); //Loads position if action key 7 is pressed.
});

Опубликовано:

Compiles this: https://www.assembla.com/code/qczm-iw5/ ... .cs?rev=69 as a separate script.

Then go to your scripts folder then make a folder called maps then make a text file named mp_alpha.txt in that folder. That will setup making map edits. As for your question make sure to spawn them ABOVE your carepackage. Let's say it's at (100,100,100) and the flag is at (100,100,100) then you will be stuck inside of the care package. For the elevator increase the 3rd number - z axis - by 40 then it becomes -for elevator- (100,100,140). You can look here for examples. https://www.assembla.com/code/qczm-iw5/ ... aps?rev=69

Also I just updated the MapEdit code original Author: TheApadayo.

 

Make sure to reenable the Call setdvar map_edit_allowcheats -remove the //- and disable any code that has an if statement using our name. That will ensure you to get access to the viewpos -views position in server console-. If you can't get it to work I'll send you mine if needed....

Опубликовано:
  • Автор

Hmm, I think you misunderstood me (or I misunderstood you?), I already know how to place elevators and such.

 

The problem is that some infected (which by the way don't have falling damage) jump down holes and so get stuck at that certain spot.

My objective would be to implement a button which the players can press which allows them to teleport to a place that I set for them.

 

Or am I wrong?

Опубликовано:

This:

               case "mp_exchange":
               case "mp_hardhat":
               case "mp_interchange":
               case "mp_lambeth":
               case "mp_radar":
               case "mp_cement":
               case "mp_hillside_ss":
               case "mp_morningwood":
               case "mp_overwatch":
               case "mp_park":
               case "mp_qadeem":
               case "mp_restrepo_ss":
               case "mp_terminal_cls":
               case "mp_roughneck":
               case "mp_boardwalk":
               case "mp_moab":
               case "mp_nola":
               case "mp_bootleg":
               case "mp_bravo":
               case "mp_carbon":
               case "mp_mogadishu":
               case "mp_village":
               case "mp_shipbreaker":
               case "mp_paris":
               case "mp_plaza2":
               case "mp_seatown":
               case "mp_underground":
               case "mp_aground_ss":
               case "mp_courtyard_ss":
               case "mp_italy":
               case "mp_meteora":
           }

Makes no sense at all... I'm surprised that it compiles... What you could do, althought I don't know if it works cause I've never done scripts for iw5m.. is something like this:

 

_mapname = Call("getdvar", "mapname");
switch(_mapname){
               case "mp_exchange":
                         //do sumthing here
                         break;
               case "mp_hardhat":
                         //do sumthing here
                         break;
               case "mp_interchange":
                         //do sumthing here
                         break;
}

 

There're better ways using dictionaries tho.

Опубликовано:
Hmm, I think you misunderstood me (or I misunderstood you?), I already know how to place elevators and such.

 

The problem is that some infected (which by the way don't have falling damage) jump down holes and so get stuck at that certain spot.

My objective would be to implement a button which the players can press which allows them to teleport to a place that I set for them.

 

Or am I wrong?

What do you mean they jump down holes or get stuck in certain spots ._.? Do you have a video or something of it? Because you can get stuck in entities...

 

 

Also try using this code:

        public void CreateElevator(Vector3 enter, Vector3 exit)
       {
           Entity flag = Call("spawn", "script_model", new Parameter(enter));
           flag.Call("setModel", getAlliesFlagModel(_mapname));
           Entity flag2 = Call("spawn", "script_model", new Parameter(exit));
           flag2.Call("setModel", getAxisFlagModel(_mapname));

           int curObjID = 31 - _flagCount++;
           Call(431, curObjID, "active"); // objective_add
           Call(435, curObjID, new Parameter(flag.Origin)); // objective_position
           Call(434, curObjID, "compass_waypoint_bomb"); // objective_icon

           OnInterval(100, () =>
           {
               foreach (Entity player in getPlayers())
               {
                   if (player.Origin.DistanceTo(enter) <= 50)
                   {
                       player.Call("setorigin", new Parameter(exit));
                   }
               }
               return true;
           });
       }

Опубликовано:
  • Автор
This:

...

Makes no sense at all... I'm surprised that it compiles... What you could do, althought I don't know if it works cause I've never done scripts for iw5m.. is something like this:

 

_mapname = Call("getdvar", "mapname");
switch(_mapname){
               case "mp_exchange":
                         //do sumthing here
                         break;
               case "mp_hardhat":
                         //do sumthing here
                         break;
               case "mp_interchange":
                         //do sumthing here
                         break;
}

 

There're better ways using dictionaries tho.

 

Thank you, i will try it.

 

 

Hmm, I think you misunderstood me (or I misunderstood you?), I already know how to place elevators and such.

 

The problem is that some infected (which by the way don't have falling damage) jump down holes and so get stuck at that certain spot.

My objective would be to implement a button which the players can press which allows them to teleport to a place that I set for them.

 

Or am I wrong?

What do you mean they jump down holes or get stuck in certain spots ._.? Do you have a video or something of it? Because you can get stuck in entities...

 

Well for example: You can place the exits of elevators on buildings. And on some edges of these buildings you can just walk off and possibly getting stuck between buildings and only having a little street to move (or commit suicide, if you got explosives).

 

Or for example: One of the elevators that are in the map mp_dome places you on top of a container, however you can not leave from it.

You can walk towards the north, but then you will fall onto an other container and you won't be able to move again. (I already moved this elevator, but it's just an example).

 

 

[EDIT] Now I have to go, thanks for the help

Опубликовано:
  • Автор
If you're trying to teleport people to areas in the map then most of the time there's a barrier called a brushmodel that prevents you from moving while you're in it.

Yes, that is what I mean, but when teleporting people on top of buildings sometimes there isn't a barrier to stop them from walking over the edge, and thus if they walk into a certain direction they will fall onto the street, potentially getting stuck between buildings in a small alley.

 

Example on the map mp_exchange (Though I fixed this by adding a wall, but there are so many other places to get stuck which you can't all block by using walls because it would be so time consuming)

 

http://i.imgur.com/s4GHV.jpg

 

works for you the position?????

IВґvetried to edit some map and I change the x,y,z freezes in the same number.

if you cant work wiht the field IВґd appreciate the position.

Euhm, is your problem different from mine? Cause I don't understand what you are talking about...

If you got the same problem or can't understand how map edit works, i'll explain it if you want to.

If you got a different problem then I think it will be better if you make your own thread.

Опубликовано:

the problem is similar, what happens is that I can not see the other positions to place the elevators or ramps single axle and I get a change of position when I keep going the same axis and does not changue the current position.

your position.dll r21 or r25 works, if Icant share that file IВґd appreciate

Опубликовано:
  • Автор
the problem is similar, what happens is that I can not see the other positions to place the elevators or ramps single axle and I get a change of position when I keep going the same axis and does not changue the current position.

your position.dll r21 or r25 works, if Icant share that file IВґd appreciate

Here you go (see attachment).

Credts go to the maker of the dll, NOT me.

 

use the command !update to look up your coordinates.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Гость
Ответить в тему...

Сейчас на странице 0

  • Нет пользователей, просматривающих эту страницу

Важная информация

Используя этот сайт, вы соглашаетесь Условия использования.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.