Posts: 5
Threads: 1
Joined: Aug 2012
Reputation:
0
ive been trying to make a god mode plugin..
when i try to compile it, i get an error saying: unsafe code may only appear when compiling/ with unsafe..
i dont really know what to do to fix that error.. im guessing that i have to add an exception to the addon.dll in the addon folder so that it will allow me to compile it even though it says its not safe....
im trying to make the plugin for 1.4.382 version....
i watched a vid from its mods on making plugins and they said to use 3.0 framework, but when i use that version, theres like 10 errrors, but on version 4.0 i dont get any...
sorry if im being a noob... this is my first time making a plugin
here is the soruce code:
using System;
using System.Runtime.InteropServices;
using System.Security;
using Addon;
namespace GODMODE_1_0
{
public class Program : CPlugin
{
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool WriteProcessMemory(IntPtr hProcess, int lpBaseAddress, byte[] lpBuffer, int nSize, out int lpNumberOfBytesWritten);
public override void OnMapChange()
{
SetDvar(" scr_player_maxhealth", "999");
}
unsafe public override void OnServerLoad()
{
ServerPrint("Plugin: GOD MODE made by th3oolbro has been loaded");
int oP;
byte[] bytes = { 0x90, 0x90 };
WriteProcessMemory(((IntPtr)(-1)), 0x40C8D7, bytes, bytes.Length, out oP);
}
}
}
Posts: 5,135
Threads: 241
Joined: Nov 2010
Reputation:
100
Go to your build settings and allow unsafe code.
Posts: 285
Threads: 15
Joined: Nov 2011
Reputation:
12
09-01-2012, 10:18
(This post was last modified: 09-01-2012, 10:19 by archit.)
A much better alternative would be to set the health to -1. This way you can control who becomes god and who doesn't.A wild guess but if you are working in 64 bit environment check the target CPU it should be x86
Posts: 5
Threads: 1
Joined: Aug 2012
Reputation:
0
09-01-2012, 11:29
(This post was last modified: 09-01-2012, 11:52 by th3coolbro.)
(09-01-2012, 09:58)Gravzy Wrote: Since thread has been answered, can i ask, why would you want everybody to have god mode? well thats just the first part of the project,, and because its my first time i ever did something with programing... i wanted to make it simple...
later i want to make a function where u can enable and disable it....
and when there is an aimboter or obvious wallhacker, u just enable it and that would = hacker gets trolled.... and he would leave..
its more troll plugin i guess.
(09-01-2012, 09:40)Pozzuh Wrote: Go to your build settings and allow unsafe code. sorry, i don't know how to do that,, can u please show me where i add it??
(09-01-2012, 10:18)archit Wrote: A much better alternative would be to set the health to -1. This way you can control who becomes god and who doesn't.A wild guess but if you are working in 64 bit environment check the target CPU it should be x86 wouldn't that just make everyone die super fast???
-1 health
i dont really understand since im still a supernoob in c#
(09-01-2012, 09:40)Pozzuh Wrote: Go to your build settings and allow unsafe code. FACEPALM.. thanx i got it now
Posts: 1,323
Threads: 24
Joined: Nov 2010
Reputation:
91
Can I ask what you are patching there exactly (WPM)?
Posts: 5
Threads: 1
Joined: Aug 2012
Reputation:
0
09-01-2012, 21:51
(This post was last modified: 09-01-2012, 21:58 by th3coolbro.)
omg lol,, idk,
i finally compiled the plugin under net framework 3.0 and i tested it, but it didnt work.
i dont know what i did wrong. any suggestions?
(09-01-2012, 17:23)zxz0O0 Wrote: Can I ask what you are patching there exactly (WPM)? wait i mean,, im trying to increase the health to the most 99999 i can do so it will become godmode..
and one thinng i was wondering...
what is the difference between
int oP;
byte[] bytes = { 0x90, 0x90 };
and
byte[] bytes = { 0xD9, 0x05, 0xD8, 0xFC, 0x76, 0x00 };
its that for like the cpu usage???
Posts: 2,509
Threads: 96
Joined: Nov 2010
Reputation:
38
!safe hackers_nickname
Give everyone godmode except the hacker (name: "hackers_nickname"), nice idea.
Posts: 5
Threads: 1
Joined: Aug 2012
Reputation:
0
09-02-2012, 00:24
(This post was last modified: 09-02-2012, 00:39 by th3coolbro.)
(09-01-2012, 22:19)surtek Wrote: !safe hackers_nickname
Give everyone godmode except the hacker (name: "hackers_nickname"), nice idea. i still didnt get the plugin working...
does anyone know the dvar name for bullet damage???
i was thinking if i lower is all the way,, it would take forever to kil someone...
can anyone give me a heads up on what i am doing wrong????
it should work,,, i get the message that the plugin is working,, but it doesnt,,,
(09-01-2012, 22:19)surtek Wrote: !safe hackers_nickname
Give everyone godmode except the hacker (name: "hackers_nickname"), nice idea. i still didnt get the plugin working...
does anyone know the dvar name for bullet damage???
i was thinking if i lower is all the way,, it would take forever to kil someone...
can anyone give me a heads up on what i am doing wrong????
it should work,,, i get the message that the plugin is working,, but it doesnt,,,
Posts: 5,320
Threads: 300
Joined: Feb 2011
Reputation:
149
09-02-2012, 01:36
(This post was last modified: 09-02-2012, 01:36 by JariZ.)
Sorry man, I'm very glad that you love working with the addon but we will not - and don't want to - help you because you're using a older version which means you're using a pirated version.
This thread has been moved to the boards archive.
Contact a moderator in case you want to contribute to this thread.
|