/** * Cmd_Drop_f * * Drop an inventory item. */ public static void Drop_f(edict_t ent) { int index; gitem_t it; string s; s = Cmd.Args(); it = GameItems.FindItem(s); if (it == null) { SV_GAME.PF_cprintfhigh(ent, "unknown item: " + s + "\n"); return; } if (it.drop == null) { SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "Item is not dropable.\n"); return; } index = GameItems.ITEM_INDEX(it); if (0 == ent.client.pers.inventory[index]) { SV_GAME.PF_cprintfhigh(ent, "Out of item: " + s + "\n"); return; } it.drop.drop(ent, it); }
public static void PlayerList_f(edict_t ent) { Int32 i; String st; String text; edict_t e2; text = ""; for (i = 0; i < GameBase.maxclients.value; i++) { e2 = GameBase.g_edicts[1 + i]; if (!e2.inuse) { continue; } st = "" + (GameBase.level.framenum - e2.client.resp.enterframe) / 600 + ":" + ((GameBase.level.framenum - e2.client.resp.enterframe) % 600) / 10 + " " + e2.client.ping + " " + e2.client.resp.score + " " + e2.client.pers.netname + " " + (e2.client.resp.spectator ? " (spectator)" : "") + "\\n"; if (text.Length + st.Length > 1024 - 50) { text += "And more...\\n"; SV_GAME.PF_cprintfhigh(ent, "" + text + ""); return; } text += st; } SV_GAME.PF_cprintfhigh(ent, text); }
public static void Players_f(edict_t ent) { Int32 i; Int32 count; String small; String large; Int32[] index = new Int32[256]; count = 0; for (i = 0; i < GameBase.maxclients.value; i++) { if (GameBase.game.clients[i].pers.connected) { index[count] = i; count++; } } index = index.OrderBy(p => p, Cmd.PlayerSort).ToArray(); large = ""; for (i = 0; i < count; i++) { small = GameBase.game.clients[index[i]].ps.stats[Defines.STAT_FRAGS] + " " + GameBase.game.clients[index[i]].pers.netname + "\\n"; if (small.Length + large.Length > 1024 - 100) { large += "...\\n"; break; } large += small; } SV_GAME.PF_cprintfhigh(ent, large + "\\n" + count + " players\\n"); }
public static void Use_f(edict_t ent) { Int32 index; gitem_t it; String s; s = Cmd.Args(); it = GameItems.FindItem(s); Com.Dprintln("using:" + s); if (it == null) { SV_GAME.PF_cprintfhigh(ent, "unknown item: " + s + "\\n"); return; } if (it.use == null) { SV_GAME.PF_cprintfhigh(ent, "Item is not usable.\\n"); return; } index = GameItems.ITEM_INDEX(it); if (0 == ent.client.pers.inventory[index]) { SV_GAME.PF_cprintfhigh(ent, "Out of item: " + s + "\\n"); return; } it.use.Use(ent, it); }
/** * Cmd_Wave_f */ public static void Wave_f(edict_t ent) { int i; i = Lib.atoi(Cmd.Argv(1)); // can't wave when ducked if ((ent.client.ps.pmove.pm_flags & pmove_t.PMF_DUCKED) != 0) { return; } if (ent.client.anim_priority > Defines.ANIM_WAVE) { return; } ent.client.anim_priority = Defines.ANIM_WAVE; switch (i) { case 0: SV_GAME.PF_cprintfhigh(ent, "flipoff\n"); ent.s.frame = M_Player.FRAME_flip01 - 1; ent.client.anim_end = M_Player.FRAME_flip12; break; case 1: SV_GAME.PF_cprintfhigh(ent, "salute\n"); ent.s.frame = M_Player.FRAME_salute01 - 1; ent.client.anim_end = M_Player.FRAME_salute11; break; case 2: SV_GAME.PF_cprintfhigh(ent, "taunt\n"); ent.s.frame = M_Player.FRAME_taunt01 - 1; ent.client.anim_end = M_Player.FRAME_taunt17; break; case 3: SV_GAME.PF_cprintfhigh(ent, "wave\n"); ent.s.frame = M_Player.FRAME_wave01 - 1; ent.client.anim_end = M_Player.FRAME_wave11; break; case 4: default: SV_GAME.PF_cprintfhigh(ent, "point\n"); ent.s.frame = M_Player.FRAME_point01 - 1; ent.client.anim_end = M_Player.FRAME_point12; break; } }
/** * Cmd_Players_f */ public static void Players_f(edict_t ent) { int i; int count; string small; string large; var index = new int[256]; count = 0; for (i = 0; i < GameBase.maxclients.value; i++) { if (GameBase.game.clients[i].pers.connected) { index[count] = i; count++; } } // sort by frags Array.Sort(index, 0, count - 1, Cmd.PlayerSort); // print information large = ""; for (i = 0; i < count; i++) { small = GameBase.game.clients[index[i]].ps.stats[Defines.STAT_FRAGS] + " " + GameBase.game.clients[index[i]].pers.netname + "\n"; if (small.Length + large.Length > 1024 - 100) { // can't print all of them in one packet large += "...\n"; break; } large += small; } SV_GAME.PF_cprintfhigh(ent, large + "\n" + count + " players\n"); }
public static void InvDrop_f(edict_t ent) { gitem_t it; Cmd.ValidateSelectedItem(ent); if (ent.client.pers.selected_item == -1) { SV_GAME.PF_cprintfhigh(ent, "No item to drop.\\n"); return; } it = GameItemList.itemlist[ent.client.pers.selected_item]; if (it.drop == null) { SV_GAME.PF_cprintfhigh(ent, "Item is not dropable.\\n"); return; } it.drop.Drop(ent, it); }
public static void God_f(edict_t ent) { String msg; if (GameBase.deathmatch.value != 0 && GameBase.sv_cheats.value == 0) { SV_GAME.PF_cprintfhigh(ent, "You must run the server with '+set cheats 1' to enable this command.\\n"); return; } ent.flags ^= Defines.FL_GODMODE; if (0 == (ent.flags & Defines.FL_GODMODE)) { msg = "godmode OFF\\n"; } else { msg = "godmode ON\\n"; } SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, msg); }
public static void Notarget_f(edict_t ent) { String msg; if (GameBase.deathmatch.value != 0 && GameBase.sv_cheats.value == 0) { SV_GAME.PF_cprintfhigh(ent, "You must run the server with '+set cheats 1' to enable this command.\\n"); return; } ent.flags ^= Defines.FL_NOTARGET; if (0 == (ent.flags & Defines.FL_NOTARGET)) { msg = "notarget OFF\\n"; } else { msg = "notarget ON\\n"; } SV_GAME.PF_cprintfhigh(ent, msg); }
public static void Noclip_f(edict_t ent) { String msg; if (GameBase.deathmatch.value != 0 && GameBase.sv_cheats.value == 0) { SV_GAME.PF_cprintfhigh(ent, "You must run the server with '+set cheats 1' to enable this command.\\n"); return; } if (ent.movetype == Defines.MOVETYPE_NOCLIP) { ent.movetype = Defines.MOVETYPE_WALK; msg = "noclip OFF\\n"; } else { ent.movetype = Defines.MOVETYPE_NOCLIP; msg = "noclip ON\\n"; } SV_GAME.PF_cprintfhigh(ent, msg); }
public void unicast(edict_t ent, bool reliable) { SV_GAME.PF_Unicast(ent, reliable); }
public bool inPHS(float[] p1, float[] p2) { return(SV_GAME.PF_inPHS(p1, p2)); }
public void error(int level, string err) { SV_GAME.PF_error(level, err); }
public void sound(edict_t ent, int channel, int soundindex, float volume, float attenuation, float timeofs) { SV_GAME.PF_StartSound(ent, channel, soundindex, volume, attenuation, timeofs); }
public void cprintf(edict_t ent, int printlevel, string s) { SV_GAME.PF_cprintf(ent, printlevel, s); }
// some fractional bits public void WriteDir(float[] pos) { SV_GAME.PF_WriteDir(pos); }
public void WriteString(string s) { SV_GAME.PF_WriteString(s); }
public void WriteByte(int c) { SV_GAME.PF_WriteByte(c); }
public void WriteShort(int c) { SV_GAME.PF_WriteShort(c); }
public virtual void Dprintf(string s) { SV_GAME.PF_dprintf(s); }
public void WritePosition(float[] pos) { SV_GAME.PF_WritePos(pos); }
public virtual void Centerprintf(edict_t ent, string s) { SV_GAME.PF_centerprintf(ent, s); }
public void dprintf(string s) { SV_GAME.PF_dprintf(s); }
public virtual void Configstring(int num, string string_renamed) { SV_GAME.PF_Configstring(num, string_renamed); }
public void centerprintf(edict_t ent, string s) { SV_GAME.PF_centerprintf(ent, s); }
public virtual void Error(int level, string err) { SV_GAME.PF_error(level, err); }
// config strings hold all the index strings, the lightstyles, // and misc data like the sky definition and cdtrack. // All of the current configstrings are sent to clients when // they connect, and changes are sent to all connected clients. public void configstring(int num, string @string) { SV_GAME.PF_Configstring(num, @string); }
public virtual void Setmodel(edict_t ent, string name) { SV_GAME.PF_setmodel(ent, name); }
public void setmodel(edict_t ent, string name) { SV_GAME.PF_setmodel(ent, name); }
public virtual bool InPHS(float[] p1, float[] p2) { return(SV_GAME.PF_inPHS(p1, p2)); }