
Mind Freeze
Allows you to freeze players with a legit way.
Total Downloads: 844 - First Release: Jul 4, 2015 - Last Update: Feb 23, 2017
- 5/5, 6 likes
-
I'm sorry for the delay .. i will update it today.
All these days i'm trying to fix the plugin with some other developers ... finally i'm on the right "road" to finish it.
I just gave some information. Just to keep you updated. -
PaiN updated Mind Freeze with a new update entry:
Massive Update!
-
PaiN updated Mind Freeze with a new update entry:
small fix
-
Console commands?! xD
-
I mean i think its not needed .. -
just asking! i use a lot, the console !
-
-
is not important, i was just asking (for future versions) !
Enjoy your CSGO or LoL!
[DOUBLEPOST=1436194675,1436183124][/DOUBLEPOST]Hi! For testing propose, i freeze myself and when i tryed to unfreeze i've got this:
Error] Failed to call hook 'cmdUnFreeze' on plugin 'Mind Freeze' (NullReferenceException: Object reference not set to an instance of an object)
I had to unload the plugin!
?? -
-
1st : /freeze myname/mysteamid (i tryed 2nd with my steamid)
-------------------------------------------------------------------------------------
2nd: /unfreeze name/mysteamid
3rd: /unfreeze all
all this above: [Error] Failed to call hook 'cmdUnFreeze' on plugin 'Mind Freeze' (NullReferenceException: Object reference not set to an instance of an object)
-------------------------------------------------------------------------------------
4th: oxide.unload MindFreeze (this worked xD ) -
this plugin works with names not steamid's
and the command to unfreeze all is "/unfreezeall" -
1: Works with steamID! (because i'm freezed right now: /freeze mysteamid)
2. Unknown command "unfreezeall' (/unfreezeall)
[DOUBLEPOST=1436196363][/DOUBLEPOST])))))))))))))))))))))))))))))))))))))))
Solved!!!
I forgot to paste the new version! I used old version 1.3.0! I copied the new version, but never pasted!)))
Sorryyyyy my bad!!!!!!!! XD
Everything is working! Sorry again !Last edited by a moderator: Jul 6, 2015 -
-
Code:if(targetPlayer == null) { SendReply(player, "Player not found!") return; }
EDIT: eventhough it was the reason that the plugin was outdated, its still useful -
-
-
Yep the latest version should work properly but it needs some cleanup and some minor changes (next update) -
You should use a Dictionary instead of a List... Dictionaries don't allow for duplicate entries.
Also in the freeze command you don't need these:
If target is null or player doesn't exist, you'll never get to the "if(target == null) return;"
Code:if (!target) { SendReply(player, "Player not found!"); return; } if (target == null) return;
Code:if (target == null) { SendReply(player, "Player not found!"); return; }
Code:using System.Collections.Generic; using System.Reflection; using System; using System.Linq; using System.Data; using UnityEngine; using Oxide.Core;namespace Oxide.Plugins { [Info("Mind Freeze", "PaiN", "2.1.0", ResourceId = 1198)] [Description("Allows you to freeze players with a legit way.")] class MindFreeze : RustPlugin { private Timer _timer; /*private class FrozenPlayerInfo { public BasePlayer Player { get; set; } public Vector3 FrozenPosition { get; set; } public FrozenPlayerInfo(BasePlayer player) { Player = player; FrozenPosition = player.transform.position; } }*/ Dictionary<string, Vector3> frozenPlayers = new Dictionary<string, Vector3>(); //List<FrozenPlayerInfo> frozenPlayers = new List<FrozenPlayerInfo>(); void Loaded() { if (!permission.PermissionExists("canmindfreeze")) permission.RegisterPermission("canmindfreeze", this); //LoadDefaultConfig(); Maybe gonna add this later. _timer= timer.Every(1, OnTimer); } [ChatCommand("freeze")] void cmdFreeze(BasePlayer player, string cmd, string[] args) { var target = BasePlayer.Find(args[0]); string steamId = Convert.ToString(player.userID); if (args.Length == 1) { if (!permission.UserHasPermission(steamId, "canmindfreeze")) { SendReply(player, "No Permission!"); return; } if (target == null) { SendReply(player, "Player not found!"); return; } //if (target == null) return; ulong Tuserid = 0; if (frozenPlayers.TryGetValue(target.userID, out Tuserid)) { SendReply(player, "Target player already frozen!"); return; } else { frozenPlayers.Add(target.userID.ToString(), target.transform.position); SendReply(target, "You have been frozen by " + player.displayName); SendReply(player, "You have frozen " + target.displayName); } //if (frozenPlayers.Any(t => t.Player == target)) return; //SendReply(target, "You have been frozen by " + player.displayName); //SendReply(player, "You have frozen " + target.displayName); } else { SendReply(player, "Syntax: /freeze \"player\" "); return; } } [ChatCommand("unfreeze")] void cmdUnFreeze(BasePlayer player, string cmd, string[] args) { var target = BasePlayer.Find(args[0]); string steamId = Convert.ToString(player.userID); if (args.Length == 1) { if (!permission.UserHasPermission(steamId, "canmindfreeze")) { SendReply(player, "No Permission!"); return; } if (target == null) { SendReply(player, "Player not found!"); return; } if(frozenPlayers.ContainsKey(target.userID.ToString())) { frozenPlayers.Remove(target.userID.ToString()); SendReply(target, "You have been unfrozen by " + player.displayName); SendReply(player, "You have unfrozen " + target.displayName); } //frozenPlayers.RemoveAll(t => t.Player == target); //SendReply(target, "You have been unfrozen by " + player.displayName); //SendReply(player, "You have unfrozen " + target.displayName); } else { SendReply(player, "Syntax: /unfreeze \"player\" "); return; } } [ChatCommand("unfreezeall")] void cmdUnFreezeAll(BasePlayer player, string cmd, string[] args) { string steamId = Convert.ToString(player.userID); if (permission.UserHasPermission(steamId, "canmindfreeze")) { frozenPlayers.Clear(); SendReply(player, "All players now unfrozen!"); } else { SendReply(player, "No Permission!"); } } void OnTimer() { foreach(var FrozenPlayer in frozenPlayers) { BasePlayer p = BasePlayer.FindByID(Convert.ToUInt64(FrozenPlayer.Key)); if (p == null) return; if (Vector3.Distance(p.transform.position, FrozenPlayer.Value) < 1) continue; p.ClientRPCPlayer(null, p, "ForcePositionTo", new object[] { FrozenPlayer.Value }); p.TransformChanged(); } /* foreach (FrozenPlayerInfo current in frozenPlayers) { if (Vector3.Distance(current.Player.transform.position, current.FrozenPosition) < 1) continue; current.Player.ClientRPCPlayer(null, current.Player, "ForcePositionTo", new object[] { current.FrozenPosition }); current.Player.TransformChanged(); }*/ } void Unloaded() { _timer.Destroy(); frozenPlayers.Clear(); } } }
If it does work, and you don't understand it. I'll be happy to explain more.
Dictionaries are a good way to avoid writing more code as long as you understand them.Last edited by a moderator: Jul 6, 2015 -
But nvm
So an error line 59
http://screenshot.sh/ouD4nI9PSeshO