: So after spending a bit of time developing a plugin. I ran into a problem. :
: It gives me a error every time I load and the error its giving me isn't making that much since. :
: If I could get some help on this that would be great:
: http://pastebin.com/6QqMPh6R :
: The error is at the very bottom. :
: Thanks in advance! :
Error with my plugin
Discussion in 'Rust Discussion' started by DylanSMR, Aug 14, 2015.
-
Wulf Community Admin
The error is saying... on Line 235, you have an unexpected symbol. Open the plugin up in Visual Studio and it will show you these.
-
So I wrote that plugin and it works. But now I have a problem with this plugin.
I wrote this section almost exactly as the infinite ammo plugin and it gives me a error.
http://pastebin.com/QVfVv8Wc
--Error--
[Oxide] 8:44 AM [Error] IncreasedClipSize.cs(77,52): error CS0131: The left-handed side of an assignment must be a variable, a property or an indexer.
:Visual Studio: didnt report any errors so im not sure
[DOUBLEPOST=1439560205][/DOUBLEPOST]I realised I messed up "Projectile" with "Weapon" at line 77 but that didnt make a difference to my error. -
your plugin is just wrong everywhere XD
if (weapon == rifle.ak) how can that work ^^?
if (weapon.primaryMagazine.contents = weapon.primaryMagazine.capacity - Config["AkClipSize"])
same ^^
[DOUBLEPOST=1439562310][/DOUBLEPOST]checkItem item = player.GetActiveItme();
checkItem ????? this is not a variable
GetActiveItme? GetActivateItem?
BaseProjetcile? BaseProjectile
fix your plugin ... there is 1 error per line m8
[DOUBLEPOST=1439562348][/DOUBLEPOST]weapon.primary.Magazine.contents ? weapon.primaryMagazine.contents
[DOUBLEPOST=1439562379][/DOUBLEPOST]void checkItem(BasePlayer player, string command, string[] args) ?
checkItem(); ? no variables?
[DOUBLEPOST=1439562941][/DOUBLEPOST]Fixed part of your plugin so it at least works
Code:using System; using System.Collections.Generic; using Oxide.Core;namespace Oxide.Plugins { [Info("IncreasedClipSize", "DylanSMR", "0.0.1", ResourceId = 9823)] class IncreasedClipSize : RustPlugin { protected override void LoadDefaultConfig() { PrintWarning("Creating a new configuration file."); Config.Clear(); Config["AkClipSize"] = 30; Config["BoltClipSize"] = 20; Config["SemiAutoClipSize"] = 25; Config["RevolverClipSize"] = 25; Config["RocketLauncherClipSize"] = 2; Config["PumpShotgunClipSize"] = 18; Config["HuntingBowClipSize"] = 2; Config["EokaPistolClipSize"] = 2; Config["WaterPipeClipSize"] = 2; Config["CustomSMGClipSize"] = 50; Config["ThompsonClipSize"] = 45; Config["Empty"] = 0; Config["Reload"] = "Clip size low, be prepared to reloaded."; SaveConfig(); } class StoredData { public HashSet<PlayerInfo> Players = new HashSet<PlayerInfo>(); public StoredData() { } } class PlayerInfo { public string UserId; public PlayerInfo() { } public PlayerInfo(BasePlayer player) { UserId = player.userID.ToString(); } } StoredData storedData; private void OnWeaponFired(BaseProjectile projectile, BasePlayer player, ItemModProjectile projectilemod, ProtoBuf.ProjectileShoot projectiles) { checkItem(player, projectile); } private void checkItem(BasePlayer player, BaseProjectile projectile) { var info = new PlayerInfo(player); Item item = player.GetActiveItem(); if (item != null) { var weapon = item.GetHeldEntity() as BaseProjectile; Puts(weapon.gameObject.name); if (weapon.gameObject.name == "assets/bundled/prefabs/weapons/rifle/ak47u.weapon.prefab") { //if (storedData.Players.Contains(info)) Puts(weapon.primaryMagazine.contents.ToString()); Puts(weapon.primaryMagazine.capacity.ToString()); if (weapon.primaryMagazine.contents == weapon.primaryMagazine.capacity - (int)Config["AkClipSize"]) { Puts(weapon.primaryMagazine.contents.ToString()); weapon.primaryMagazine.contents = weapon.primaryMagazine.capacity; weapon.SendNetworkUpdateImmediate(); storedData.Players.Add(info); } //if (!storedData.Players.Contains(info)) return; /* if (weapon.primaryMagazine.contents == (int)Config["Empty"]) { storedData.Players.Remove(info); Interface.GetMod().DataFileSystem.WriteObject("IncreasedClipSizeData", storedData); }*/ } } } } }