Anti Steal System Include
#1

Guys, I'm about to release a simple include that makes stolen filterscripts/gamemodes crash server if they are not running in your host ip and port. Of course it will only work if in your server.cfg you had:

Код:
bind 127.0.0.1 //your server ip
port 7777 //your server port - as usual
It goes like this:

Код:
#if defined _Anti_Steal_included
  #endinput
#endif
#define _Anti_Steal_included

#include <a_samp>
#include <YSI\y_hooks> //by ******: https://sampforum.blast.hk/showthread.ph...022#define IP_PORT "127.0.0.1:7777" //change this to your server host ip and port before compile your scripts with this include.

stock AntiSteal()
{
   	new SIp[32], SPort;
    GetServerVarAsString("bind", SIp, sizeof(SIp));
    SPort = GetServerVarAsInt("port");
	format(SIp, sizeof(SIp), "%s:%d", SIp, SPort);
	if(strcmp(SIp, IP_PORT, false))
	{
		print("This script was stolen. Crashing server now...");
		SetTimerEx("Bla", 1, false, "s", ""); //function to crash server
	}
    return 1;
}
My doubt:
I want to run the function OnGameModeInit if the script is a gamemode or OnFilterScriptInit if it is a filterscript. Is it possible to identify if script is a gamemode or filterscript without changing nothing in it? Anyway, that's why I'm hooking both:

Код:
hook OnGameModeInit()
{
	AntiSteal();
	return 1;
}

hook OnFilterScriptInit()
{
	AntiSteal();
	return 1;
}
Thanks!
Reply
#2

I recommend checking if 'FILTERSCRIPT' is defined.
Reply
#3

I also thought about it. But that way, "#define FILTERSCRIPT" code is needed in each filterscript.
Anyway, is there any problem about hooking both functions?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)