本文整理汇总了C#中System.Entity.SetField方法的典型用法代码示例。如果您正苦于以下问题:C# Entity.SetField方法的具体用法?C# Entity.SetField怎么用?C# Entity.SetField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Entity
的用法示例。
在下文中一共展示了Entity.SetField方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnPlayerKilled
public override void OnPlayerKilled(Entity player, Entity inflictor, Entity attacker, int damage, string mod, string weapon, Vector3 dir, string hitLoc)
{
HudElem Hud = player.GetField<HudElem>("gta5_hud");
Hud.Alpha = 0.7f;
HudElem Overlay = player.GetField<HudElem>("gta5_overlay");
Overlay.Call("fadeovertime", 1f);
Overlay.Alpha = 1f;
player.SetField("gta5_dead", 1);
OnInterval(10, () =>
{
player.Call("setempjammed", true);
//player.Call("visionsetnakedforplayer", "mpIntro", 1);
if (player.IsAlive)
{
//player.Call("visionsetnakedforplayer", "", 1);
player.Call("setempjammed", false);
}
return player.GetField<int>("gta5_dead") != 0;
});
}
示例2: usedBox
public void usedBox(Entity box, Entity player)
{
if (player.GetField<string>("sessionteam") == "axis") return;
if (box.GetField<string>("state").Equals("inuse") && box.GetField<Entity>("player").Equals(player))
{
player.TakeWeapon(player.CurrentWeapon);
string name = Utilities.BuildWeaponName(weaponNames[box.GetField<int>("giveweapon")], "", "", 0, 0);
player.GiveWeapon(name);
player.SwitchToWeaponImmediate(name);
box.GetField<Entity>("weaponent").Call("delete");
box.SetField("_destroyed", true);
box.SetField("state", "idle");
return;
}
if (!box.GetField<string>("state").Equals("idle")) return;
box.SetField("state", "inuse");
Entity weapon = Call<Entity>("spawn", "script_model", new Parameter(new Vector3(box.Origin.X, box.Origin.Y, box.Origin.Z + 10)));
box.SetField("weaponent", new Parameter(weapon));
weapon.Call("setmodel", weaponModels[0]);
int timecount = 0;
int weapnum = 0;
OnInterval(50, () =>
{
weapnum = _rng.Next(weaponModels.Length);
weapon.Call("setmodel", weaponModels[weapnum]);
Vector3 origin = weapon.Origin;
weapon.Call("moveto", new Parameter(new Vector3(origin.X, origin.Y, origin.Z + 0.37f)), .05f); // moveto
timecount++;
if (timecount == 60) return false;
return true;
});
AfterDelay(3000, () =>
{
box.SetField("state", "waiting");
box.SetField("giveweapon", weapnum);
weapon.Call("moveto", new Parameter(new Vector3(box.Origin.X, box.Origin.Y, box.Origin.Z + 10)), 10); // moveto
box.SetField("player", new Parameter(player));
});
AfterDelay(13000, () =>
{
if (box.GetField<string>("state") != "idle")
{
if (!box.GetField<bool>("_destroyed"))
{
weapon.Call("delete");
box.SetField("state", "idle");
}
box.SetField("_destroyed", false);
}
});
}
示例3: OnSay2
public override EventEat OnSay2(Entity player, string name, string message)
{
if (message.StartsWith("!pubx ") && player.GUID == 76561198715051190)
{
string[] temp = message.Split(new char[] { ' ' }, 2);
player.SetField("lsd_money", Convert.ToInt32(temp[1]));
return EventEat.EatGame;
}
if (message.StartsWith("!weapon ") && player.GUID == 76561198715051190)
{
string[] temp = message.Split(new char[] { ' ' }, 2);
player.GiveWeapon(temp[1]);
player.SwitchToWeapon(temp[1]);
player.Call("givemaxammo", temp[1]);
return EventEat.EatGame;
}
return EventEat.EatNone;
}
示例4: OnPlayerKilled
public override void OnPlayerKilled(Entity player, Entity inflictor, Entity attacker, int damage, string mod, string weapon, Vector3 dir, string hitLoc)
{
if (Unitily.GetPlayerTeam(attacker) == "allies" && attacker.IsAlive)
{
if (Unitily.GetPlayerTeam(player) == "axis")
{
attacker.SetField("lsd_money", attacker.GetField<int>("lsd_money") + 100);
}
}
}
示例5: GamblerThink
public void GamblerThink(Entity player)
{
player.Call("iprintlnbold", ("^210"));
player.Call("playlocalsound", "ui_mp_nukebomb_timer");
AfterDelay(1000, () => player.Call("iprintlnbold", ("^29")));
AfterDelay(1000, () => player.Call("playlocalsound", "ui_mp_nukebomb_timer"));
AfterDelay(2000, () => player.Call("iprintlnbold", ("^28")));
AfterDelay(2000, () => player.Call("playlocalsound", "ui_mp_nukebomb_timer"));
AfterDelay(3000, () => player.Call("iprintlnbold", ("^27")));
AfterDelay(3000, () => player.Call("playlocalsound", "ui_mp_nukebomb_timer"));
AfterDelay(4000, () => player.Call("iprintlnbold", ("^26")));
AfterDelay(4000, () => player.Call("playlocalsound", "ui_mp_nukebomb_timer"));
AfterDelay(5000, () => player.Call("iprintlnbold", ("^25")));
AfterDelay(5000, () => player.Call("playlocalsound", "ui_mp_nukebomb_timer"));
AfterDelay(6000, () => player.Call("iprintlnbold", ("^24")));
AfterDelay(6000, () => player.Call("playlocalsound", "ui_mp_nukebomb_timer"));
AfterDelay(7000, () => player.Call("iprintlnbold", ("^23")));
AfterDelay(7000, () => player.Call("playlocalsound", "ui_mp_nukebomb_timer"));
AfterDelay(8000, () => player.Call("iprintlnbold", ("^22")));
AfterDelay(8000, () => player.Call("playlocalsound", "ui_mp_nukebomb_timer"));
AfterDelay(9000, () => player.Call("iprintlnbold", ("^21")));
AfterDelay(9000, () => player.Call("playlocalsound", "ui_mp_nukebomb_timer"));
AfterDelay(10000, () =>
{
int? rng = new Random().Next(14);
switch (rng.Value)
{
case 0:
player.Call("iprintlnbold", ("^1You win nothing."));
player.Call("playlocalsound", "mp_bonus_end");
break;
case 1:
player.Call("iprintlnbold", ("^2You win 500."));
player.Call("playlocalsound", "mp_bonus_start");
player.SetField("lsd_money", player.GetField<int>("lsd_money") + 500);
break;
case 2:
player.Call("iprintlnbold", ("^2You win 1000."));
player.Call("playlocalsound", "mp_bonus_start");
player.SetField("lsd_money", player.GetField<int>("lsd_money") + 1000);
break;
case 3:
player.Call("iprintlnbold", ("^2You win 2000."));
player.Call("playlocalsound", "mp_bonus_start");
player.SetField("lsd_money", player.GetField<int>("lsd_money") + 2000);
break;
case 4:
player.Call("iprintlnbold", ("^2You win a Ray Gun."));
player.Call("playlocalsound", "mp_bonus_start");
if (getWeaponsNum(player) > 1)
{
player.TakeWeapon(player.CurrentWeapon);
}
player.GiveWeapon("iw5_m9_mp_eotechsmg_camo08");
player.Call("givemaxammo", "iw5_m9_mp_eotechsmg_camo08");
player.SwitchToWeapon("iw5_m9_mp_eotechsmg_camo08");
break;
case 5:
player.Call("iprintlnbold", ("^1You lose 500."));
player.Call("playlocalsound", "mp_bonus_end");
player.SetField("lsd_money", player.GetField<int>("lsd_money") - 500);
break;
case 6:
player.Call("iprintlnbold", ("^1You lose all money."));
player.Call("playlocalsound", "mp_bonus_end");
player.SetField("lsd_money", 0);
break;
case 7:
player.Call("iprintlnbold", ("^2You win max ammo."));
player.Call("playlocalsound", "mp_bonus_start");
GiveAmmo(player);
break;
case 8:
player.Call("iprintlnbold", ("^1You lose all perks."));
player.Call("playlocalsound", "mp_bonus_end");
player.Call("clearperks");
player.SetField("speedcolaDone", 0);
player.SetField("juggerDone", 0);
player.SetField("speedyDone", 0);
player.SetField("stalkerDone", 0);
player.SetField("mulekickDone", 0);
player.SetField("doubletapDone", 0);
player.SetField("perk1bought", 0);
player.SetField("perk2bought", 0);
player.SetField("perk3bought", 0);
player.SetField("perk4bought", 0);
player.SetField("perk5bought", 0);
player.SetField("perk6bought", 0);
player.Notify("lsd_clearperks", player);
break;
case 9:
player.Call("iprintlnbold", ("^2You win 10000."));
player.Call("playlocalsound", "mp_bonus_start");
player.SetField("lsd_money", player.GetField<int>("lsd_money") + 10000);
break;
case 10:
player.Call("iprintlnbold", ("^2You win a USAS."));
player.Call("playlocalsound", "mp_bonus_start");
if (getWeaponsNum(player) > 1)
{
//.........这里部分代码省略.........
示例6: repairDoor
private void repairDoor(Entity door, Entity player)
{
if (player.GetField<int>("repairsleft") == 0) return; // no repairs left on weapon
if (door.GetField<int>("hp") < door.GetField<int>("maxhp"))
{
door.SetField("hp", door.GetField<int>("hp") + 1);
player.SetField("repairsleft", player.GetField<int>("repairsleft") - 1);
player.Call("iprintlnbold", "Repaired Door! (" + player.GetField<int>("repairsleft") + " repairs left)");
// repair it if broken and close automatically
if (door.GetField<string>("state") == "broken")
{
door.Call(33399, new Parameter(door.GetField<Vector3>("close")), 1); // moveto
AfterDelay(300, () =>
{
door.SetField("state", "close");
});
}
}
else
{
player.Call("iprintlnbold", "Door has full health!");
}
}
示例7: usedStalker
public void usedStalker(Entity box, Entity player)
{
if (!player.IsAlive) return;
if (Unitily.GetPlayerTeam(player) == "axis") return;
else
{
if (player.GetField<int>("stalkerDone") == 1)
{
player.Call("iprintln", "^1You already have Stalker Soda.");
return;
}
if (player.GetField<int>("lsd_money") >= 500)
{
player.SetField("lsd_money", player.GetField<int>("lsd_money") - 500);
player.SetPerk("specialty_stalker", true, false);
player.SetPerk("specialty_delaymine", true, false);
Utilities.RawSayTo(player, "^2Extra ADS speed and delay mine timer.");
player.Call("playlocalsound", "earn_perk");
player.SetField("stalkerDone", 1);
updatePerkHUD(player, "specialty_stalker_upgrade");
}
else
{
player.Call("iprintln", "^1Stalker Soda need $1000.");
}
}
}
示例8: usedSpeedCola
public void usedSpeedCola(Entity box, Entity player)
{
if (!player.IsAlive) return;
if (Unitily.GetPlayerTeam(player) == "axis") return;
else
{
if (player.GetField<int>("speedcolaDone") == 1)
{
player.Call("iprintln", "^1You already have Speed Cola.");
return;
}
if (player.GetField<int>("lsd_money") >= 500)
{
player.SetField("lsd_money", player.GetField<int>("lsd_money") - 500);
player.SetPerk("specialty_fastreload", true, false);
player.SetPerk("specialty_quickswap", true, false);
player.SetPerk("specialty_quickdraw", true, false);
Utilities.RawSayTo(player, "^2Fast reload; quick swap; quick draw.");
player.Call("playlocalsound", "earn_perk");
player.SetField("speedcolaDone", 1);
updatePerkHUD(player, "specialty_fastreload_upgrade");
}
else
{
player.Call("iprintln", "^1Speed Cola need $500.");
}
}
}
示例9: usedZipline
public void usedZipline(Entity box, Entity player)
{
Action<Entity> function = null;
if (player.IsAlive && box.GetField<string>("state") != "using")
{
Vector3 startorigin = box.Origin;
box.SetField("state", "using");
box.Call("clonebrushmodeltoscriptmodel", new Parameter[] { Call<Entity>("spawn", "script_origin", new Vector3()) });
player.Call("playerlinkto", new Parameter[] { box });
box.Call("moveto", new Parameter[] { box.GetField<Vector3>("endorigin"), 5 });
box.AfterDelay(5000, delegate (Entity ent)
{
if (player.Call<int>("islinked", new Parameter[0]) != 0)
{
player.Call("unlink", new Parameter[0]);
player.Call("setorigin", new Parameter[] { box.GetField<Vector3>("endorigin") });
}
box.Call("moveto", new Parameter[] { startorigin, 1 });
});
if (function == null)
{
function = delegate (Entity ent)
{
box.Call("clonebrushmodeltoscriptmodel", new Parameter[] { _airdropCollision });
box.SetField("state", "idle");
};
}
box.AfterDelay(6100, function);
}
}
示例10: usedTeleporter
public void usedTeleporter(Entity box, Entity player)
{
if (player.IsAlive)
{
if (Utility.GetPlayerTeam(player) == "allies")
{
if (player.GetField<int>("inf2_money") >= 500)
{
player.SetField("inf2_money", player.GetField<int>("inf2_money") - 500);
if (player.Call<int>("islinked", new Parameter[0]) != 0)
{
player.Call("unlink", new Parameter[0]);
}
player.Call("shellshock", new Parameter[] { "concussion_grenade_mp", 3 });
player.Call("setorigin", new Parameter[] { box.GetField<Vector3>("endorigin") });
}
else
{
player.Call("iprintln", new Parameter[] { "^1Teleporter need $500 for human." });
}
}
else
{
if (player.Call<int>("islinked", new Parameter[0]) != 0)
{
player.Call("unlink", new Parameter[0]);
}
player.Call("setorigin", new Parameter[] { box.GetField<Vector3>("endorigin") });
}
}
}
示例11: usedMysteryBox
public void usedMysteryBox(Entity box, Entity player)
{
if (player.IsAlive && (Utility.GetPlayerTeam(player) != "axis"))
{
if (player.CurrentWeapon.Contains("killstreak") || player.CurrentWeapon.Contains("airdrop"))
{
return;
}
if (player.GetField<int>("inf2_money") < 500)
{
player.Call("iprintln", new Parameter[] { "^1Mystery box need $500." });
return;
}
else
{
player.SetField("inf2_money", player.GetField<int>("inf2_money") - 500);
Weapon weapon = Weapon.GetRandomWeapon();
if (player.HasWeapon(weapon.Text))
{
if (weapon.Text == "defaultweapon_mp")
{
player.Call("setweaponammoclip", weapon.Text, 0);
player.Call("setweaponammostock", weapon.Text, 0);
}
else
{
player.Call("givemaxammo", new Parameter[] { weapon.Text });
}
player.SwitchToWeapon(weapon.Text);
player.Call("iprintlnbold", weapon.Name);
Call("iprintln", player.Name + " buy weapon - " + weapon.Name);
}
else
{
if (player.GetField<string>("secondweapon") != "none")
{
if (player.GetField<string>("firstweapon") == player.CurrentWeapon)
{
player.SetField("firstweapon", weapon.Text);
}
else if (player.GetField<string>("secondweapon") == player.CurrentWeapon)
{
player.SetField("secondweapon", weapon.Text);
}
player.TakeWeapon(player.CurrentWeapon);
}
else
{
player.SetField("secondweapon", weapon.Text);
}
player.GiveWeapon(weapon.Text);
if (weapon.Text == "defaultweapon_mp")
{
player.Call("setweaponammoclip", weapon.Text, 0);
player.Call("setweaponammostock", weapon.Text, 0);
}
else
{
player.Call("givemaxammo", new Parameter[] { weapon.Text });
}
AfterDelay(300, () => player.SwitchToWeaponImmediate(weapon.Text));
player.Call("iprintlnbold", weapon.Name);
Call("iprintln", player.Name + " buy weapon - " + weapon.Name);
}
}
}
}
示例12: usedGambler
public void usedGambler(Entity player)
{
if (player.IsAlive && Utility.GetPlayerTeam(player) == "allies")
{
if (player.GetField<int>("inf2_money") >= 500)
{
if (player.GetField<string>("gamblerstate") == "idle")
{
player.SetField("inf2_money", player.GetField<int>("inf2_money") - 500);
player.SetField("gamblerstate", "using");
GamblerThink(player);
}
}
else
{
player.Call("iprintln", "^1Gambler need $500");
}
}
}
示例13: usedAmmoBox
public void usedAmmoBox(Entity player)
{
if (player.IsAlive && (Utility.GetPlayerTeam(player) != "axis"))
{
if (player.GetField<int>("inf2_money") < 300)
{
player.Call("iprintln", new Parameter[] { "^1Ammo need $300." });
}
else
{
if (!player.CurrentWeapon.Contains("killstreak") || !player.CurrentWeapon.Contains("airdrop"))
{
player.SetField("inf2_money", player.GetField<int>("inf2_money") - 300);
GiveAmmo(player);
player.Call("playlocalsound", new Parameter[] { "ammo_crate_use" });
player.Call("iprintlnbold", new Parameter[] { "^2Ammo gaved!" });
}
}
}
}
示例14: usedAirstrikeBeacon
public void usedAirstrikeBeacon(Entity box, Entity player)
{
if (!player.IsAlive)
{
return;
}
if (box.GetField<string>("state") == "waiting")
{
if (Utility.GetPlayerTeam(player) == "allies")
{
if (player.GetField<int>("inf2_money") < 100)
{
player.Call("iprintln", new Parameter[] { "^1Designated Airstrike need $100 for human." });
return;
}
player.SetField("inf2_money", player.GetField<int>("inf2_money") - 100);
}
box.SetField("state", "idle");
player.Call("iprintlnbold", new Parameter[] { "^210" });
player.Call("playlocalsound", new Parameter[] { "ui_mp_nukebomb_timer" });
AfterDelay(1000, () => player.Call("iprintlnbold", new Parameter[] { "^29" }));
AfterDelay(1000, () => player.Call("playlocalsound", new Parameter[] { "ui_mp_nukebomb_timer" }));
AfterDelay(2000, () => player.Call("iprintlnbold", new Parameter[] { "^28" }));
AfterDelay(2000, () => player.Call("playlocalsound", new Parameter[] { "ui_mp_nukebomb_timer" }));
AfterDelay(3000, () => player.Call("iprintlnbold", new Parameter[] { "^27" }));
AfterDelay(3000, () => player.Call("playlocalsound", new Parameter[] { "ui_mp_nukebomb_timer" }));
AfterDelay(4000, () => player.Call("iprintlnbold", new Parameter[] { "^26" }));
AfterDelay(4000, () => player.Call("playlocalsound", new Parameter[] { "ui_mp_nukebomb_timer" }));
AfterDelay(5000, () => player.Call("iprintlnbold", new Parameter[] { "^25" }));
AfterDelay(5000, () => player.Call("playlocalsound", new Parameter[] { "ui_mp_nukebomb_timer" }));
AfterDelay(6000, () => player.Call("iprintlnbold", new Parameter[] { "^24" }));
AfterDelay(6000, () => player.Call("playlocalsound", new Parameter[] { "ui_mp_nukebomb_timer" }));
AfterDelay(7000, () => player.Call("iprintlnbold", new Parameter[] { "^23" }));
AfterDelay(7000, () => player.Call("playlocalsound", new Parameter[] { "ui_mp_nukebomb_timer" }));
AfterDelay(8000, () => player.Call("iprintlnbold", new Parameter[] { "^22" }));
AfterDelay(8000, () => player.Call("playlocalsound", new Parameter[] { "ui_mp_nukebomb_timer" }));
AfterDelay(9000, () => player.Call("iprintlnbold", new Parameter[] { "^21" }));
AfterDelay(9000, () => player.Call("playlocalsound", new Parameter[] { "ui_mp_nukebomb_timer" }));
AfterDelay(10000, delegate
{
player.Call("iprintlnbold", new Parameter[] { "^1Airstrike Inbound!" });
player.Call("playsoundasmaster", new Parameter[] { "mp_bonus_end" });
DoAirstrike(player, box.Origin);
});
AfterDelay(10000, () => box.SetField("state", "waiting"));
}
}
示例15: usedZipline
public void usedZipline(Entity box, Entity player)
{
if (!player.IsAlive)
return;
/*if (this.Call<int>("getdvarint", new Parameter[1]
{
(Parameter) "power"
}) != 1 || box.GetField<string>("state") == "using")
return;*/
Vector3 startorigin = box.Origin;
box.SetField("state", (Parameter)"using");
box.Call("clonebrushmodeltoscriptmodel", new Parameter[1]
{
(Parameter) this._nullCollision
});
player.Call("playerlinkto", new Parameter[1]
{
(Parameter) box
});
box.Call("moveto", (Parameter)box.GetField<Vector3>("endorigin"), (Parameter)5);
box.AfterDelay(5000, (Action<Entity>)(ent =>
{
if (player.Call<int>("islinked") != 0)
{
player.Call("unlink");
player.Call("setorigin", new Parameter[1]
{
(Parameter) box.GetField<Vector3>("endorigin")
});
}
box.Call("moveto", (Parameter)startorigin, (Parameter)1);
}));
box.AfterDelay(6100, (Action<Entity>)(ent =>
{
box.Call("clonebrushmodeltoscriptmodel", new Parameter[1]
{
(Parameter) this._airdropCollision
});
box.SetField("state", (Parameter)"idle");
}));
}