SA-MP Forums Archive
[Tutorial] Four ways to protect the GM - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] Four ways to protect the GM (/showthread.php?tid=620120)

Pages: 1 2


Four ways to protect the GM - TheLustcheR - 26.10.2016

Hello Everybody


Hello, I will share with you four ways, very simple, your modem protection.




The first way, check server IP:

pawn Code:
#include <a_samp>


#define IP "0.0.0.0"


public OnGameModeInit()
{
    new ServerIP[16];    
    GetServerVarAsString("bind", ServerIP, sizeof(ServerIP));    
    if(strcmp(ServerIP, IP, false)) SendRconCommand("exit");    
    return 1;    
}
Pastebin: Here.

So what we have here, anyway?
We ran a test if the server IP compatible to write server IP in "server.cfg" file.
If is not compatible, the server is shut down.




Second way, check server slots:
pawn Code:
#include <a_samp>


#undef MAX_PLAYERS
#define MAX_PLAYERS 32


public OnGameModeInit()
{
    if(GetMaxPlayers() != MAX_PLAYERS) SendRconCommand("exit");
    return 1;
}
Pastebin: Here.

So what we have here, anyway?
Initially lowered the maximum setting of the slots on the server (default 500) and set the desired amount to us.
Then we ran a test if the server slots compatible to write server slots in "server.cfg" file.
If is not compatible, the server is shut down.




Third way, check server port:
pawn Code:
#include <a_samp>


#define Port 7777


public OnGameModeInit()
{
    if(GetConsoleVarAsInt("port") != Port) SendRconCommand("exit");
    return 1;
}
Pastebin: Here.

So what we have here, anyway?
We ran a test if the server port compatible to write server port in "server.cfg" file.
If is not compatible, the server is shut down.




Fourth way, check GM name:
pawn Code:
#include <a_samp>


#define GameModeAMX "NameAMX"


public OnGameModeInit()
{
    new SGameModeAMX[32];
    GetConsoleVarAsString("gamemode0", SGameModeAMX, sizeof(SGameModeAMX));
    if(strcmp(SGameModeAMX, GameModeAMX, false)) SendRconCommand("exit");
    return 1;
}
Pastebin: Here.

So what we have here, anyway?
We ran a test if the server GM name compatible to write server GM name in "server.cfg" file.
If is not compatible, the server is shut down.




.My Pastebin: Here

** Sorry for my English, see you soon...


Re: Four ways to protect the GM - Mister0 - 26.10.2016

I don't understand from who you use this protection? I mean from the person who can change this settings gamemode port bind should have ftp acces. Or I didnt understod, but for what or who are these protections?


Re: Four ways to protect the GM - Logic_ - 26.10.2016

These are codes that can be used in your script to avoid others using it on their host without .pwn.


Re: Four ways to protect the GM - ISmokezU - 26.10.2016

This is actually good. GoodJob Dude.


Re: Four ways to protect the GM - Spmn - 26.10.2016

What if there is no bind set in server.cfg?


Re: Four ways to protect the GM - TheLustcheR - 26.10.2016

Quote:
Originally Posted by Mister0
View Post
I don't understand from who you use this protection? I mean from the person who can change this settings gamemode port bind should have ftp acces. Or I didnt understod, but for what or who are these protections?
If someone got your GM he can't running it.

Quote:
Originally Posted by Spmn
View Post
What if there is no bind set in server.cfg?
This example can be on stored server.
Anyway, you have more 3 ways.


Re: Four ways to protect the GM - XBrianX - 27.10.2016

That's pretty good!


Re: Four ways to protect the GM - DTV - 27.10.2016

Sorry if I sound stupid, but I don't get the forth one.

If you're checking to see if the gm name in the server.cfg is the same as the one defined in the script, how would that protect you if someone was to steal your .amx file? I don't imagine they'd change the name in the server.cfg or the actual file name.

Other than that, the rest of them are good, I might actually use one of them in the future.


Re: Four ways to protect the GM - TheLustcheR - 27.10.2016

Quote:
Originally Posted by DTV
View Post
Sorry if I sound stupid, but I don't get the forth one.

If you're checking to see if the gm name in the server.cfg is the same as the one defined in the script, how would that protect you if someone was to steal your .amx file? I don't imagine they'd change the name in the server.cfg or the actual file name.

Other than that, the rest of them are good, I might actually use one of them in the future.
All the ways working with same mission.
Checking if the Define and Server.cfg is same, if not the server is turn off.


Re: Four ways to protect the GM - BurnZ - 27.10.2016

Sorry? But why would people steal your amx when all the textdraws and everything else shows another website? Not to mention in-game names would show your server's name and stuff.


Re: Four ways to protect the GM - TheLustcheR - 27.10.2016

Quote:
Originally Posted by BurnZ
View Post
Sorry? But why would people steal your amx when all the textdraws and everything else shows another website? Not to mention in-game names would show your server's name and stuff.
I dont know, its happen.
If you was just reading and no mere responding, you would understand that it blocks the possibility of any use in GM.


Re: Four ways to protect the GM - iLearner - 28.10.2016

I devided my script (and do so with all of my scrips) in includes (pawno/include/dayz(for example)/here all files).

Like functions in one, commands in another, then one for admins commands... Defines and so on... This way even if my .pwn gets stolen anyhow by host or anyone it'be useless for them as my main gm only has samp callbacks & includes.

#best way for me!


Re: Four ways to protect the GM - BurnZ - 28.10.2016

Quote:
Originally Posted by iLearner
View Post
I devided my script (and do so with all of my scrips) in includes (pawno/include/dayz(for example)/here all files).

Like functions in one, commands in another, then one for admins commands... Defines and so on... This way even if my .pwn gets stolen anyhow by host or anyone it'be useless for them as my main gm only has samp callbacks & includes.

#best way for me!
Because all your scripts uses CNRSF as base.

@LutscheR That's not what i mean.


Re: Four ways to protect the GM - SickAttack - 28.10.2016

Quote:
Originally Posted by iLearner
View Post
I devided my script (and do so with all of my scrips) in includes (pawno/include/dayz(for example)/here all files).

Like functions in one, commands in another, then one for admins commands... Defines and so on... This way even if my .pwn gets stolen anyhow by host or anyone it'be useless for them as my main gm only has samp callbacks & includes.

#best way for me!
That makes no sense... For a lot of reasons.

One being... Why will you have your .pwn file on your host if it is pretty much unusable to start with?...


Re: Four ways to protect the GM - Jayse - 28.10.2016

Best way to protect the gamemode: don't use free hosts/cheap shitty hosts nor give anyone access to your files. More secure way: use your own VPS.


Re: Four ways to protect the GM - TheLustcheR - 28.10.2016

Quote:
Originally Posted by Jayse
View Post
Best way to protect the gamemode: don't use free hosts/cheap shitty hosts nor give anyone access to your files. More secure way: use your own VPS.
HAHA, You're right there


Re: Four ways to protect the GM - iLearner - 28.10.2016

Sickattack I meant 'even if somehow (maybe by mistake?) the file gets uploaded'


Re: Four ways to protect the GM - BurnZ - 28.10.2016

Quote:
Originally Posted by iLearner
View Post
Sickattack I meant 'even if somehow (maybe by mistake?) the file gets uploaded'
LOL. Linux host doesn't even require the pawno folder.


Re: Four ways to protect the GM - iLearner - 28.10.2016

Your reply makes no sense. #logic.exe not found


Re: Four ways to protect the GM - Eoussama - 28.10.2016

Nice