AdminMod.de https://www.adminmod.de/ |
|
plugin_incubus_tagcheck https://www.adminmod.de/viewtopic.php?t=3391 |
Seite 1 von 1 |
Autor: | Bert[germany] [ 21.06.2002, 08:40 ] |
Betreff des Beitrags: | plugin_incubus_tagcheck |
hi ich hab bei diesem plugin ein problem. da ich mich mit schreiben von plugins net auskenne und die fehlermeldung mir nix sagt, würde ich mich freuen wenn einer mir helfen könnte. Code: /* Clan Tag Check Plugin Version 2 * I added a feature that makes it so you don't have to * recompile this every time you add a WONID * it comes with a file called WONID.CFG * you just put all the WONID's in there * Checks every person in the server to see if they are in * Your clan if they are using the tag * You have to modify this a little bit for your clan * I commented most of the stuff * Look at the comments for what you need to edit * Please if you edit this give me SOME credit * I mean other than the necessary changes * Thanks to all -9mm- for this plugin idea * Thanks to Greg for help testing it * Thanks to Sarah for help testing it * Thanks to Superplatypuss for the idea of external WONID's * Copyright Chris (-9mm- Incubus) 2002 */ #include <core> #include <console> #include <string> #include <admin> #include <adminlib> /* ALL MODIFICATIONS ARE MADE RIGHT HERE */ /* REQUIRED CHANGE */ new ClanTag1[MAX_DATA_LENGTH] = "[germany]" /* change to your clans tag */ /* OPTIONAL CHANGE */ #define AUTO_KICK 1; /* change to 0 if you don't want it to automatically check */ new SpeakGoodbye[MAX_DATA_LENGTH] = "speak ^"you are unauthorized personnel, goodbye ass hole^""; /* this is the string the HL voice guy speaks, change to whatever in between the ^" */ /* END OF MODIFICATIONS! */ new FILENAME[MAX_DATA_LENGTH] = "WONID.CFG"; new STRING_VERSION[MAX_DATA_LENGTH] = "2.50.1"; new DEBUG = 0; /* THIS IS WHERE YOU PUT IN YOUR WONID'S */ InClan(WONID) { new i = 0; new wasoff = 0; new temp[MAX_DATA_LENGTH]; new temp2[MAX_DATA_LENGTH]; new final; new NUM_MEMBERS = 0; for(i = 1; i <= 100; i++) { readfile(FILENAME, temp, i + 1, MAX_DATA_LENGTH); if(streq(temp, "") != 1) NUM_MEMBERS++; if(streq(temp, "") == 1) break; } for(i = 1; i <= NUM_MEMBERS; i++) { if(getvar("file_access_read") != 1) { wasoff = 1; exec("file_access_read 0"); } readfile(FILENAME,temp,i,MAX_DATA_LENGTH) if (streq(temp, "")) { if(wasoff == 1) exec("file_access_read 0"); return(0); /* there are no more WONID's and user isn't in clan*/ } if (DEBUG == 1) { if(fileexists(FILENAME) == 1) selfmessage("File exists!"); selfmessage(temp); } final = strtonum(temp); if (DEBUG == 1) { numtostr(final, temp2); selfmessage(temp2); } if(WONID == final) { if(wasoff == 1) exec("file_access_read 0"); return(1); /* return 1 if they are in clan */ } } if(wasoff == 1) exec("file_access_read 0"); return(0); /* return 0 if they aren't in the clan */ } findstr(str1[], str2[]) { new i = 0; new j = 0; new len1; new len2; len1 = strlen(str1); // Length of source string len2 = strlen(str2); // Length of string we're searching for // Step through str1 for (j=0; j<len1; j++) { // If the current letter of str2 is the same as the current letter of str1 while (str1[j+i] == str2[i]) { i++; // If we are at the end of str2, then success! if (i == len2) return j+1; // If we get to the end of str1, but not end of str2, then fail. else if (len1 == j+i) return 0; } // Re-initialize i to zero for next time around i = 0; } // If we don't find anything, and we get to the end, then return 0 return 0; } public AutoTagCheck() /* this is for the auto tag check feature */ { exec("admin_tagcheck"); /* execute the kick function */ return PLUGIN_HANDLED; } public TagCheck(HLCommand,HLData,HLUserName,UserIndex) /* this is the actual testing and kicking function */ { new Command[MAX_COMMAND_LENGTH]; new Data[MAX_DATA_LENGTH]; new User[MAX_NAME_LENGTH]; new maxplayers = maxplayercount(); new Target[MAX_NAME_LENGTH]; new i = 0; new SessionID; new WONID; new Team; new imp_message[MAX_DATA_LENGTH] = " is an imposter and was booted!"; new temp[MAX_DATA_LENGTH] = "You aren't "; new temp2[MAX_DATA_LENGTH]; convert_string(HLCommand,Command,MAX_COMMAND_LENGTH); convert_string(HLData,Data,MAX_DATA_LENGTH); convert_string(HLUserName,User,MAX_NAME_LENGTH); for(i=1; i<=maxplayers; i++) { if(playerinfo(i, Target, MAX_NAME_LENGTH, SessionID, WONID, Team) == 1) { playerinfo(i, Target, MAX_NAME_LENGTH, SessionID, WONID, Team); if (DEBUG == 1) selfmessage(Target); if ((findstr(Target, ClanTag1) > 0) && (InClan(WONID) == 0)) { if((check_immunity(Target)==0) && (i != UserIndex)) { execclient(Target, SpeakGoodbye); /* speaks the message, this is funny lol */ strcat(temp, ClanTag1, MAX_DATA_LENGTH); temp2 = temp; strcat(temp2, ", change tag and then come back", MAX_DATA_LENGTH); message(Target, temp2); /* change this to your clan's tag */ strcat(temp, imp_message, MAX_DATA_LENGTH); typesay(temp, 10, 255, 255, 255); kick(Target); /* kick em */ } } } } return PLUGIN_HANDLED; } public plugin_init() { plugin_registerinfo("Clan Tag Check","Makes it so if you don't have a clan wonid, you get booted for having clan tag", STRING_VERSION); /* register the info blah blah blah */ plugin_registercmd("admin_tagcheck","TagCheck",ACCESS_IMMUNITY); /* register the command admin_tagcheck for manual use */ plugin_registercmd("name", "TagCheck", ACCESS_ALL); /* checks as soon as a name is changed */ plugin_registerhelp("admin_tagcheck",ACCESS_IMMUNITY,"admin_tagcheck: turns on or off clan tag checking"); /* just used for admin_help */ #if AUTO_KICK == 1 set_timer("AutoTagCheck", 30, 99999); #endif return PLUGIN_CONTINUE; }die fehlermeldung die ich beim compilieren bekomme: plugin_incubus_tagcheck.sma(34) Error [1]: expected token: ";", but found "new" plugin_incubus_tagcheck.sma(68) Error [1]: expected token: ";", but found "if" --- bertl --- |
Autor: | Qualle [ 21.06.2002, 09:18 ] |
Betreff des Beitrags: | |
Zitat:
/* REQUIRED CHANGE */
In der Zeile (34) (code: new ClanTag1[MAX_DATA_LENGTH] = "[germany]" )new ClanTag1[MAX_DATA_LENGTH] = "[germany]" fehlt am ende ein: ";" sollte also so aussehn: new ClanTag1[MAX_DATA_LENGTH] = "[germany]"; Das selbe hier: Zitat:
}
readfile(FILENAME,temp,i,MAX_DATA_LENGTH);readfile(FILENAME,temp,i,MAX_DATA_LENGTH) if (streq(temp, "")) { dann sollt es klappen.. Gruß, Qualle [/quote] |
Autor: | Bert[germany] [ 21.06.2002, 09:36 ] |
Betreff des Beitrags: | |
juhu thx qualle, es funzt . --- bertl --- |
Autor: | Qualle [ 21.06.2002, 09:40 ] |
Betreff des Beitrags: | |
np |
Seite 1 von 1 | Alle Zeiten sind UTC+01:00 |
Powered by phpBB® Forum Software © phpBB Limited https://www.phpbb.com/ |