General Reference
#56

Quote:
Originally Posted by yom
View Post
Renaming default rcon commands - allowing you to basically rewrite them with PAWN:

Recently I had a pm of someone who wanted to modify default rcon commands. I don't remember it was discussed before, at least on this forum, so i've decided to write a quick tutorial about how to do it, as many people probably ignore how to do.

This example is for Windows, and i have no idea if this is working for linux. All you need is an hexadecimal editor. I personally use Notepad++ and the Hex editor plugin.
  • Make a backup of samp-server.exe, just in case you do something wrong.
  • Open samp-server.exe with your hex editor, and search for the rcon command that you want to modify*. In this tutorial i will search for gmx:

  • Replace (manually, not with the Replace option) the name of the command with something else of your choice*. I've replaced gmx by _gmx.

  • Save, done.

And now you can do things like that:
pawn Code:
public OnRconCommand(cmd[])
{
  if (!strcmp(cmd, "gmx", true, 3))
  {
    print("Gamemode is restarting...");
    SendRconCommand("_gmx"); //call the default gmx command
    return true;
  }

  return false;
}
*With the 0.3a server, you will find only one result for each command, with the exception of login which can be found easily anyway if you are not a complete dumbass, and can be max 7 characters, and exec which need to be modified twice (because it is called internally to load server.cfg) and must be 4 characters (or less, if you know what you are doing).



There are other tweaks that you can do while you have your samp-server.exe open in your hex editor.

I will show you two simple tweaks that can be easily applied with the Search and Replace function (search for hexadecimal values, NOT strings). Note that it was tested on 0.3r4 server, but that work since 0.1b so... Follow the guide!



Disabling server_log.txt:

This can be useful if you have your own logging system, or if you just want to disable it so it doesn't grow and waste space. The way i will show you now is the only way i've found that is safe.. but still, it's hacky as it replace the name of the file by a forbidden file name (previous methods were not as hacky, but also blocked samp.ban and crashinfo.txt so that's why i said mine is safer..)

Search and Replace:
Code:
00 73 65 72 76 65 72 5f 6c 6f 67 2e 74 78 74 00
By:
Code:
00 6e 75 6c 2e 74 78 74 00 00 00 00 00 00 00 00
There you go, no more server_log.txt will be created. Note that the reloadlog command will still say Reloaded log file: "server_log.txt", but that's probably a bug and you can ignore it.



Disabling the scriptfiles restriction:

This will allow PAWN's file functions to access files from outside the scriptfiles folder, as it is now allowed apparently, so be sure to update your scripts if you want to keep your files in scriptfiles, by adding "scriptfiles\\" in front of files names in fopen etc. So..for example with this tweak you can fread server.cfg, as well as other useful things..

Search and Replace:
Code:
00 73 63 72 69 70 74 66 69 6c 65 73 5c 00
By:
Code:
00 00 00 00 00 00 00 00 00 00 00 00 00 00
That one was easy..
Wow cool!! You are genious, thank!!!! Some is what I need ))
Reply


Messages In This Thread
General Reference - by Mike - 26.01.2006, 19:03
General Reference - by Simon - 04.04.2006, 10:32
General Reference - by RayW - 04.04.2006, 10:48
General Reference - by Postality - 04.04.2006, 19:42
General Reference - by Mount - 05.04.2006, 14:34
car colors - by Denver - 06.04.2006, 21:31
Sound IDs - by webspy - 10.04.2006, 18:20
General Reference - by ARMax - 10.04.2006, 18:46
General Reference - by jbeta - 11.04.2006, 01:17
General Reference - by Postality - 12.04.2006, 13:35
General Reference - by Postality - 13.04.2006, 06:10
General Reference - by jbeta - 15.04.2006, 00:01
General Reference - by Arctos - 17.04.2006, 10:39
Re: General Reference - by Denver - 24.04.2006, 06:44
Re: General Reference - by PsYcHoGoD - 15.05.2006, 15:32
Re: General Reference - by JernejL - 19.05.2006, 15:55
Re: General Reference - by Allan - 29.05.2006, 15:42
Re: General Reference - by Manej - 31.05.2006, 00:15
Re: General Reference - by Allan - 31.05.2006, 01:02
Re: General Reference - by Allan - 06.06.2006, 21:10
Re: General Reference - by SidViciousII - 16.06.2006, 20:13
Re: General Reference - by RayW - 16.06.2006, 22:22
Re: General Reference - by DracoBlue - 17.06.2006, 09:26
Re: General Reference - by Allan - 17.06.2006, 10:11
Game Object ID's - by Spectre - 18.06.2006, 02:15
Re: General Reference - by Allan - 18.06.2006, 09:36
Re: General Reference - by Drakos - 18.06.2006, 11:06
Re: General Reference - by Allan - 18.06.2006, 11:38
Re: 0.2 coding information. - by Hell_Demon - 07.06.2007, 17:53
Re: 0.2 coding information. - by 50p - 08.06.2007, 17:54
Re: 0.2 coding information. - by weedarr - 09.06.2007, 09:10
Re: General Reference - by Betamaster - 10.06.2007, 22:36
Re: 0.2 coding information. - by vick - 11.06.2007, 07:13
Re: General Reference - by boylett - 16.06.2007, 19:04
Ped IDs - by Ottae - 18.06.2007, 14:19
Re: General Reference - by DracoBlue - 21.06.2007, 10:26
Re: General Reference - by supness420 - 26.06.2007, 02:02
Re: General Reference - by supness420 - 26.06.2007, 02:43
Re: General Reference - by hansen111 - 14.01.2008, 18:21
Re: General Reference - by BeckzyBoi - 14.01.2008, 19:09
Re: General Reference - by hansen111 - 17.01.2008, 11:34
Re: General Reference - by MaXx001 - 23.01.2008, 06:13
Re: General Reference - by BeckzyBoi - 28.01.2008, 19:54
Re: General Reference - by yom - 28.01.2008, 20:14
Re: General Reference - by yom - 17.02.2008, 05:18
Re: General Reference - by Simon - 18.02.2008, 05:35
Re: General Reference - by sparker_rus - 27.02.2008, 13:07
Re: General Reference - by ConTron - 28.02.2008, 17:25
Re: General Reference - by Hiitch - 24.12.2009, 12:47
Re: General Reference - by Backwardsman97 - 24.12.2009, 17:08
Re: General Reference - by jamesbond007 - 28.03.2010, 15:28
Re: General Reference - by Masj - 07.04.2010, 20:42
Re: General Reference - by Zamaroht - 27.05.2010, 22:43
Re: General Reference - by Hiddos - 07.07.2010, 16:43
Re: General Reference - by legodude - 13.07.2010, 19:21
Re: General Reference - by Lucy - 20.07.2010, 12:38
Re: General Reference - by FireCat - 16.08.2010, 13:32
Re: General Reference - by OKStyle - 06.09.2010, 04:25
Re: General Reference - by willsuckformoney - 03.10.2010, 20:05
Respuesta: Re: General Reference - by MrDeath537 - 01.12.2010, 20:15
Re: General Reference - by Miralem - 12.01.2011, 19:45
Re: General Reference - by xalyy - 26.01.2011, 12:35
Re: General Reference - by [03]Garsino - 01.02.2011, 06:35
Re: General Reference - by Superthijs - 09.08.2011, 16:59
Re: General Reference - by [03]Garsino - 14.08.2011, 19:46
Re: General Reference - by sleepysnowflake - 14.08.2011, 19:47
Re: General Reference - by Blantas - 18.09.2011, 18:20
Re: General Reference - by [03]Garsino - 18.09.2011, 21:13
Re: General Reference - by Kimori - 01.10.2011, 17:13
Re: General Reference - by Austin - 09.10.2011, 00:35
Re: General Reference - by Kimori - 09.10.2011, 06:50
Re: General Reference - by Kyle - 09.10.2011, 07:34
Re: General Reference - by Blantas - 05.04.2012, 08:29
Re: General Reference - by Hiddos - 29.04.2012, 16:15
Re: General Reference - by iggy1 - 06.07.2012, 10:21
Re: General Reference - by Stylock - 06.07.2012, 14:16
Re: General Reference - by iggy1 - 06.07.2012, 14:25
Re: General Reference - by Stylock - 06.07.2012, 15:54
Re: General Reference - by iggy1 - 06.07.2012, 16:46
Re: General Reference - by JoBullet - 07.07.2012, 00:03
Re: General Reference - by Kar - 07.07.2012, 17:58
Re: General Reference - by detter - 21.08.2012, 00:30
Re: General Reference - by Virus. - 28.10.2012, 11:19
Re: General Reference - by Lordzy - 28.10.2012, 11:30
Re: General Reference - by Virus. - 28.10.2012, 11:37
Re: General Reference - by Y_Less - 28.10.2012, 12:05
Re: General Reference - by [KHK]Khalid - 09.11.2012, 18:28
Re: General Reference - by Virus. - 19.11.2012, 08:22
Re: General Reference - by Y_Less - 19.11.2012, 09:35
Re: General Reference - by Schocc - 17.12.2012, 12:19
Re: General Reference - by SilverKiller - 03.02.2013, 14:00
Re: General Reference - by mastermax7777 - 11.02.2013, 04:35
Re: General Reference - by Austin - 04.04.2013, 11:19
Re: General Reference - by LarzI - 04.04.2013, 13:03
Re: COMANDO COM LIMITE DE DISTГNCIA - by Smoking_Script - 18.07.2013, 13:07
Re: General Reference - by Guest4390857394857 - 30.04.2014, 17:36
Re: General Reference - by MarvinPWN - 01.09.2015, 09:56
Re: General Reference - by Yashas - 17.10.2015, 15:03
Re: General Reference - by GangstaSunny - 05.02.2016, 06:24
Re: General Reference - by Crayder - 10.02.2016, 11:36
Re: General Reference - by AndreiWow - 15.04.2017, 20:05

Forum Jump:


Users browsing this thread: 1 Guest(s)