12.05.2012, 16:47
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:
It goes like this:
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:
Thanks!
Код:
bind 127.0.0.1 //your server ip port 7777 //your server port - as usual
Код:
#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; }
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; }