Hi,
this is a question for advanced programmers,
this is actually meant for a RTCW(Return to Castle Wolfenstein) mod, there are many people that use a Hex progam to change the mod's name into theirs(Also called Modstealing).
So i made a Proof Of Concept of how to protect a name(string)...
Code:
#include <amxmodx>
public plugin_init()
{
register_plugin("Name Check","1.0","dutchmeat")
}
new alfabet[][0] = { "a", "b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"}
//new alfabet[][] = { "a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"}
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
public function(){
new name[10] = "dutchmeat";
new number;
for (new i=0; i<8; i++) {
for (new j = 0; j < 26; j++) {
if (name[i] == alfabet[j][0])
number = number + j;
}
}
if (number != 86) //The perfect name check !?!
return; //return if the name is correct
console_print(id,"The name is incorrect...")
}
// D u t c h m e a t
// 3 20 19 2 7 12 13 0 19 = 86
//This should check if all the characters match, if they do, they copy the 'alfabet' number into the var 'number',
//If number matches '86', the string should be 'dutchmeat'
__________________
before you criticize someone, you should walk a mile in their shoes. that way, when you criticize them, you're a mile away and you have their shoes.
Last edited by dutchmeat; 01-29-2007 at 06:07.
|