AdminMod.de https://www.adminmod.de/ |
|
new PLUGIN_LOGD_CAREER https://www.adminmod.de/viewtopic.php?t=3146 |
Seite 1 von 3 |
Autor: | Biohazard1 [ 28.05.2002, 23:59 ] |
Betreff des Beitrags: | new PLUGIN_LOGD_CAREER |
Nach langem Basteln haben Rizla und ich uns entschieden eine BETA-Version des besagten Plugins zu veröffentlichen. Funktionsweise und Einstellmöglichkeiten werden in der beiliegenden Info.txt erklärt. Diese ist im folgenden aufgeführt. Zitat: V o r w o r t
Quellcode:-------------- Nach einer Idee von Rizla. Das Plugin befördert Spieler nach der Anzahl ihrer Kills. Je höher die Anzahl der Kills desto höher der Rang des Spielers. Wird ein Spieler be- fördert, so wird dies auf dem Bildschirm angezeigt und der Name des betreffenden Spielers in seinen Namen + neuen Rang umbenannt. (Rang und Name sind durch ein Leerzeichen getrennt, der Rang steht in eckigen Klammern []) Wir haben als Ränge die Dienstgrade der Bundeswehr herangezogen. Eventuell werden wir zu- sätzlich noch eine zweite Version dieses Plugins programmieren in der dann amerikanische Ränge statt der deutschen verwendet werden. Eine Tabelle über die Anzahl der benötigten Kills zur Erreichung eines neuen Ranges befindet sich weiter unten im Anhang dieses Textes. V o r a u s s e t z u n g e n ------------------------------ Um das Plugin nutzen zu können wird eine aktuelle AdminMod Version benötigt (min. 2.50.09 zu empfehlen wäre jedoch 2.50.26a). Zusätzlich werden Metamod (liegt AdminMod 2.50.26 bei) und der Log Daemon (LogD) benötigt. Zu empfehlen sind Metamod 1.12 und LogD 1.00.4 (sofern ihr die aktuelle AdminMod Version nutzt). Die Bezugsquellen der aufgelisteten Software sind weiter unten im Anhang aufgelistet. F u n k t i o n s w e i s e ---------------------------- Das Plugin überprüft beim Konnektieren eines Spielers dessen Name und setzt ein [Gren], welches für Grenadier stehen soll, vor den Namen. Konnektiert ein Spieler mit altem Rang (etwa [OG] PlayerName) dann wird sein Name in [Gren] PlayerName geändert. Zu jedem Rundenstart werden die Namen aller Spieler überprüft und ggf. der Name in richtigen Rang und Name geändert. Dies soll zum einen verhindern das sich Player Ränge geben die sie noch nicht erreicht haben und zum anderen Playern die ihren Namen geändert haben, während sie tot waren, ihren Rang zurück geben. Ändert ein Spieler während er lebt seinen Namen, wird sein aktueller Rang vor den neuen Namen gestellt. Er wird also sofort umbenannt, nicht erst nach dem nächsten Rundenstart. Das Plugin kann mit dem Befehl 'admin_career 1' ein- und mit dem Befehl 'admin_career 0' ausgeschaltet werden. Der Eintrag 'career_mode 1' in der vault.ini bewirkt das das Plugin nach einem Mapchange aktiviert bleibt. Analog dazu bewirkt der Eintrag 'career_mode 0' das das Plugin ausge- schaltet bleibt. Ist ein solcher Eintrag nicht in der vault.ini vorhanden, bleibt das Plugin inaktiv bis es mit 'admin_career 1' aktiviert wird. Standartmäßig werden Beförderungen und Degradierungen per Centersay angezeigt. Hat man allerdings auf seinem Server CSGuard installiert kann man durch den Eintrag 'career_usecsgsay 1' das Plugin anweisen die Engine von CSGuard zur Anzeige zu benutzen. Dadurch werden Konflikte mit anderen Plugins vermieden. Beförderungen und Degradierungen werden mit der CSG Engine in der unteren Hälfte des Bildschirms mittig ausgegeben. Durch den Eintrag 'career_rename 0' in der vault.ini wird das Plugin angewiesen die Namen der Player nicht zu ändern. In diesem Fall werden Beförderungen und Degradierungen nur auf dem Bildschirm angezeigt. Standartmäßig werden die Spieler umbenannt. Sollte es einem Spieler gelingen einen der fünf höchsten Ränge zu erlangen, wird sein Name zusammen mit seinem Rang und der Wonid in der Datei 'honor.dat' gespeichert. Wie man an der Dateierweiterung schon erkennen kann handelt es sich bei dieser Datei nicht um eine Konfigurationsdatei. Deshalb sollte sie auch nicht editiert werden ! A n h a n g ------------ Rang Kills ------------------------------------------ - Grenadier 0 - Gefreiter - - Obergefreiter 2 - Hauptgefreiter 5 - stabsgefreiter - - oberstabsgefreiter - - unteroffizier 8 - stabsunteroffizier - - feldwebel 13 - oberfeldwebel - - hauptfeldwebel - - stabsfeldwebel - - oberstabsfeldfebel 18 - leutnant 25 - oberleutnant - - hauptmann 32 - major 41 - oberstleutnant - - oberst 50 - brigardegeneral 61 - generalmajor 72 - generalleutnant - - general 85 ------------------------------------------ - : nicht benutzt Wir haben die Verteilung der benötigten Kills bewußt nicht linear verlaufen lassen. Wer jedoch eine lineare Verteilung wünscht, kann dies zu beginn des Quellcodes mit Hilfe der #defines einstellen: ... #define RANK1 0 // Grenadier #define RANK2 2 // Obergefreiter #define RANK3 5 // Hauptgefreiter #define RANK4 8 // Unteroffizier #define RANK5 13 // Feldwebel #define RANK6 18 // Oberstabsfeldwebel #define RANK7 25 // Leutnant #define RANK8 32 // Hauptmann #define RANK9 41 // Major #define RANK10 50 // Oberst #define RANK11 61 // Brigadegeneral #define RANK12 72 // Generalmajor #define RANK13 85 // General ... Da dies eine BETA Version ist ist mit einigen kleineren Problemen zu rechnen. Wendet euch bitte in diesem Falle an das Forum von www.adminmod.de damit wir die Probleme gemeinsam lösen können. In der Testphase ist uns aufgefallen das es zu Problemen kommen kann wenn das Plugin mit einem Listenserver benutzt wird. Solltet auch ihr einen Listenserver nutzen und es treten Probleme auf, aktiviert bitte die DEBUG Funktion des Plugins (#define DEBUG 1 am Anfang des Quellcodes) und postet den betreffenden Abschnitt eurer Logdatei im Forum. Für weitere Fragen, Verbesserungsvorschläge oder dergleichen stehen wir unter unten angegebener eMail- Adresse gerne zur Verfügung. Software --------- AdminMod: www.adminmod.de www.adminmod.org Metamod: http://www.metamod.org/ LogD: http://logd.sourceforge.net/ ---------------------------------------------------------------------------------------- (c)Copyright 2002 by Rizla & Biohazard eMail: support_career@counterstrike.de Code: /************************************************************************* ************** Rizlas and Biohazards Career Plugin v 1.5b **** ************ ****** ********** INFO: This plugin promotes player by means of their ******** ******** kills. The more you kill the higher your rank will ********** ****** be. !!! NOTE THAT THIS IS A BETA VERSION !!! ************ **** GREETINGS to: Sir Drink A Lot and Black Knight - Be ************** *** sure to check out their new plugin 'CW-Creator'. It *************** **** is pretty cool. ************** ****** THANKS to: Luke Sankey for making me laughing every ************ ******** time I join a server which is running his funny ********** ********** plugin_sank_sounds - woohoo ******** ************ SPECIAL THANKS to: MrClone for his help about using ****** ************** the CSG-Say-Funktion **** *************************************************************************/ /**************************** INCLUDES ****************************/ #include <core> #include <console> #include <string> #include <admin> #include <adminlib> /**************************** DEFINES *****************************/ #define ACCESS_CONSOLE 131072 #define ACCESS_CAREER 1024 #define CLEAN_SLATE 0 #define SHOW_TIME 8 #define MAX_RANK_LENGTH 11 #define RANK1 0 // Grenadier #define RANK2 2 // Obergefreiter #define RANK3 5 // Hauptgefreiter #define RANK4 8 // Unteroffizier #define RANK5 13 // Feldwebel #define RANK6 18 // Oberstabsfeldwebel #define RANK7 25 // Leutnant #define RANK8 32 // Hauptmann #define RANK9 41 // Major #define RANK10 50 // Oberst #define RANK11 61 // Brigadegeneral #define RANK12 72 // Generalmajor #define RANK13 85 // General #define DEGRA_R 255 // Color of degrade message (red part) #define DEGRA_G 12 // Color of degrade message (green part) #define DEGRA_B 12 // Color of degrade message (blue part) #define PROMO_R 12 // Color of promotion message (red part) #define PROMO_G 255 // Color of promotion message (green part) #define PROMO_B 12 // Color of promotion message (blue part) // Only set one of the next five defines ! #define CSG_DEGRA_RED 1 // Set this to make CSG-SAY degrade message red colored #define CSG_DEGRA_GREEN 0 // Set this to make CSG-SAY degrade message green colored #define CSG_DEGRA_BLUE 0 // Set this to make CSG-SAY degrade message blue colored #define CSG_DEGRA_WHITE 0 // Set this to make CSG-SAY degrade message white colored #define CSG_DEGRA_YELLOW 0 // Set this to make CSG-SAY degrade message yellow colored // Only set one of the next five defines ! #define CSG_PROMO_RED 0 // Set this to make CSG-SAY promotion message red colored #define CSG_PROMO_GREEN 1 // Set this to make CSG-SAY promotion message green colored #define CSG_PROMO_BLUE 0 // Set this to make CSG-SAY promotion message blue colored #define CSG_PROMO_WHITE 0 // Set this to make CSG-SAY promotion message white colored #define CSG_PROMO_YELLOW 0 // Set this to make CSG-SAY promotion message yellow colored #define DEBUG 0 /************************ GLOBAL VARIABLES ************************/ new STRING_VERSION[MAX_DATA_LENGTH] = "1.5b"; // Plugin Version new FILENAME[MAX_DATA_LENGTH] = "honor.dat"; new bEnabled; new bUseCSGSAY; new bRename; new KILLS[MAX_PLAYERS] = {CLEAN_SLATE,...}; new NAMES[MAX_PLAYERS][MAX_NAME_LENGTH]; new RANKS[MAX_PLAYERS][MAX_RANK_LENGTH]; // This funktion is used to en-/disable the plugin public admin_career(HLCommand,HLData,HLUserName,UserIndex) { new sCommand[MAX_COMMAND_LENGTH]; new sData[MAX_DATA_LENGTH]; new sUser[MAX_NAME_LENGTH]; new Text[MAX_TEXT_LENGTH]; convert_string(HLCommand,sCommand,MAX_COMMAND_LENGTH); convert_string(HLData,sData,MAX_DATA_LENGTH); convert_string(HLUserName,sUser,MAX_NAME_LENGTH); if (strlen(sData) == 0) { snprintf(Text,MAX_TEXT_LENGTH,"Career Mode: %i", bEnabled); selfmessage(Text); } else if (strcmp(sData, "1") == 0) { if (bEnabled == 0) { selfmessage("Career Mode has been enabled !"); bEnabled = 1; say_command(sUser,sCommand,sData); } else { selfmessage("Career Mode allready enabled !"); } } else if (strcmp(sData, "0") == 0) { if (bEnabled == 1) { selfmessage("Career Mode has been disabled !"); bEnabled = 0; say_command(sUser,sCommand,sData); } else { selfmessage("Career Mode allready disabled !"); } } else if (strcmp(sData, "reset") == 0) { if (fileexists(FILENAME) > 0) { resetfile(FILENAME); snprintf(Text,MAX_TEXT_LENGTH,"'%s' has been reseted.", FILENAME); selfmessage(Text); say_command(sUser,sCommand,sData); } else { snprintf(Text,MAX_TEXT_LENGTH,"'%s' not found.", FILENAME); selfmessage(Text); } } else { selfmessage("Wrong argument !"); } return PLUGIN_HANDLED; } // This funktion will be execuded whenever someone is killed public cm_HandleKill(HLCommand,HLData,HLUserName,UserIndex) { if (!bEnabled) return PLUGIN_CONTINUE; new Data[MAX_DATA_LENGTH]; new iWONIDK; new iTeamK; new iTeamV; new iIDK; new iIDV; new sID1[3]; new sID2[3]; new dummy; new Killer[MAX_NAME_LENGTH]; new Victim[MAX_NAME_LENGTH]; new Text[MAX_TEXT_LENGTH]; new sCommand[MAX_DATA_LENGTH]; new bBefoerderung; convert_string(HLData, Data, MAX_DATA_LENGTH); strsplit(Data, " ", sID1, 3, sID2, 3); iIDK = strtonum(sID1); iIDV = strtonum(sID2); if(playerinfo(iIDK, Killer, MAX_NAME_LENGTH, dummy, iWONIDK, iTeamK)) { if(playerinfo(iIDV, Victim, MAX_NAME_LENGTH, dummy, dummy, iTeamV)) { if (iTeamK == iTeamV) { KILLS[iIDK] = KILLS[iIDK] - 1; bBefoerderung = 0; } else { KILLS[iIDK] = KILLS[iIDK] + 1; bBefoerderung = 1; } if (iWONIDK != 0) { // Grenadier if ((KILLS[iIDK] == RANK1) && (strcmp(RANKS[iIDK], "[Gren]") != 0)) { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum Grenadier degradiert", Killer); cm_csgsay(Text, "down"); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^nGrenadier degradiert", Killer); centersay(Text, SHOW_TIME, DEGRA_R, DEGRA_G, DEGRA_B); } strcpy(RANKS[iIDK], "[Gren]", MAX_RANK_LENGTH); if (bRename == 1) { snprintf(sCommand,MAX_DATA_LENGTH,"name ^"[Gren] %s^"", NAMES[iIDK]); execclient(Killer, sCommand); } // Obergefreiter } else if ((KILLS[iIDK] == RANK2) && (strcmp(RANKS[iIDK], "[OG]") != 0)) { if (bBefoerderung == 1) { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum Obergefreiten befoerdert", Killer); cm_csgsay(Text, "up"); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^nObergefreiten befoerdert", Killer); centersay(Text, SHOW_TIME, PROMO_R, PROMO_G, PROMO_B); } } else { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum Obergefreiten degradiert", Killer); cm_csgsay(Text, "down"); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^nObergefreiten degradiert", Killer); centersay(Text, SHOW_TIME, DEGRA_R, DEGRA_G, DEGRA_B); } } strcpy(RANKS[iIDK], "[OG]", MAX_RANK_LENGTH); if (bRename == 1) { snprintf(sCommand,MAX_DATA_LENGTH,"name ^"[OG] %s^"", NAMES[iIDK]); execclient(Killer, sCommand); } // Hauptgefreiter } else if ((KILLS[iIDK] == RANK3) && (strcmp(RANKS[iIDK], "[HG]") != 0)) { if (bBefoerderung == 1) { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum Hauptgefreiten befoerdert", Killer); cm_csgsay(Text, "up"); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^nHauptgefreiten befoerdert", Killer); centersay(Text, SHOW_TIME, PROMO_R, PROMO_G, PROMO_B); } } else { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum Hauptgefreiten degradiert", Killer); cm_csgsay(Text, "down"); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^nHauptgefreiten degradiert", Killer); centersay(Text, SHOW_TIME, DEGRA_R, DEGRA_G, DEGRA_B); } } strcpy(RANKS[iIDK], "[HG]", MAX_RANK_LENGTH); if (bRename == 1) { snprintf(sCommand,MAX_DATA_LENGTH,"name ^"[HG] %s^"", NAMES[iIDK]); execclient(Killer, sCommand); } // Unteroffizier } else if ((KILLS[iIDK] == RANK4) && (strcmp(RANKS[iIDK], "[U]") != 0)) { if (bBefoerderung == 1) { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum Unteroffizier befoerdert", Killer); cm_csgsay(Text, "up"); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^nUnteroffizier befoerdert", Killer); centersay(Text, SHOW_TIME, PROMO_R, PROMO_G, PROMO_B); } } else { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum Unteroffizier degradiert", Killer); cm_csgsay(Text, "down"); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^nUnteroffizier degradiert", Killer); centersay(Text, SHOW_TIME, DEGRA_R, DEGRA_G, DEGRA_B); } } strcpy(RANKS[iIDK], "[U]", MAX_RANK_LENGTH); if (bRename == 1) { snprintf(sCommand,MAX_DATA_LENGTH,"name ^"[U] %s^"", NAMES[iIDK]); execclient(Killer, sCommand); } // Feldwebel } else if ((KILLS[iIDK] == RANK5) && (strcmp(RANKS[iIDK], "[Fw]") != 0)) { if (bBefoerderung == 1) { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum Feldwebel befoerdert", Killer); cm_csgsay(Text, "up"); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^nFeldwebel befoerdert", Killer); centersay(Text, SHOW_TIME, PROMO_R, PROMO_G, PROMO_B); } } else { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum Feldwebel degradiert", Killer); cm_csgsay(Text, "down"); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^nFeldwebel degradiert", Killer); centersay(Text, SHOW_TIME, DEGRA_R, DEGRA_G, DEGRA_B); } } strcpy(RANKS[iIDK], "[Fw]", MAX_RANK_LENGTH); if (bRename == 1) { snprintf(sCommand,MAX_DATA_LENGTH,"name ^"[Fw] %s^"", NAMES[iIDK]); execclient(Killer, sCommand); } // Oberstabsfeldwebel } else if ((KILLS[iIDK] == RANK6) && (strcmp(RANKS[iIDK], "[OStFw]") != 0)) { if (bBefoerderung == 1) { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum Oberstabsfeldwebel befoerdert", Killer); cm_csgsay(Text, "up"); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^nOberstabsfeldwebel befoerdert", Killer); centersay(Text, SHOW_TIME, PROMO_R, PROMO_G, PROMO_B); } } else { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum Oberstabsfeldwebel degradiert", Killer); cm_csgsay(Text, "down"); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^nOberstabsfeldwebel degradiert", Killer); centersay(Text, SHOW_TIME, DEGRA_R, DEGRA_G, DEGRA_B); } } strcpy(RANKS[iIDK], "[OStFw]", MAX_RANK_LENGTH); if (bRename == 1) { snprintf(sCommand,MAX_DATA_LENGTH,"name ^"[OStFw] %s^"", NAMES[iIDK]); execclient(Killer, sCommand); } // Leutnant } else if ((KILLS[iIDK] == RANK7) && (strcmp(RANKS[iIDK], "[Lt]") != 0)) { if (bBefoerderung == 1) { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum Leutnant befoerdert", Killer); cm_csgsay(Text, "up"); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^nLeutnant befoerdert", Killer); centersay(Text, SHOW_TIME, PROMO_R, PROMO_G, PROMO_B); } } else { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum Leutnant degradiert", Killer); cm_csgsay(Text, "down"); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^nLeutnant degradiert", Killer); centersay(Text, SHOW_TIME, DEGRA_R, DEGRA_G, DEGRA_B); } } strcpy(RANKS[iIDK], "[Lt]", MAX_RANK_LENGTH); if (bRename == 1) { snprintf(sCommand,MAX_DATA_LENGTH,"name ^"[Lt] %s^"", NAMES[iIDK]); execclient(Killer, sCommand); } // Hauptmann } else if ((KILLS[iIDK] == RANK8) && (strcmp(RANKS[iIDK], "[Hptm]") != 0)) { if (bBefoerderung == 1) { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum Hauptmann befoerdert", Killer); cm_csgsay(Text, "up"); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^nHauptmann befoerdert", Killer); centersay(Text, SHOW_TIME, PROMO_R, PROMO_G, PROMO_B); } } else { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum Hauptmann degradiert", Killer); cm_csgsay(Text, "down"); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^nHauptmann degradiert", Killer); centersay(Text, SHOW_TIME, DEGRA_R, DEGRA_G, DEGRA_B); } } strcpy(RANKS[iIDK], "[Hptm]", MAX_RANK_LENGTH); if (bRename == 1) { snprintf(sCommand,MAX_DATA_LENGTH,"name ^"[Hptm] %s^"", NAMES[iIDK]); execclient(Killer, sCommand); } // Major } else if ((KILLS[iIDK] == RANK9) && (strcmp(RANKS[iIDK], "[Major]") != 0)) { if (bBefoerderung == 1) { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum Major befoerdert", Killer); cm_csgsay(Text, "up"); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^nMajor befoerdert", Killer); centersay(Text, SHOW_TIME, PROMO_R, PROMO_G, PROMO_B); } } else { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum Major degradiert", Killer); cm_csgsay(Text, "down"); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^nMajor degradiert", Killer); centersay(Text, SHOW_TIME, DEGRA_R, DEGRA_G, DEGRA_B); } } strcpy(RANKS[iIDK], "[Major]", MAX_RANK_LENGTH); if (bRename == 1) { snprintf(sCommand,MAX_DATA_LENGTH,"name ^"[Major] %s^"", NAMES[iIDK]); execclient(Killer, sCommand); } // Oberst } else if ((KILLS[iIDK] == RANK10) && (strcmp(RANKS[iIDK], "[Oberst]") != 0)) { if (bBefoerderung == 1) { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum Oberst befoerdert", Killer); cm_csgsay(Text, "up"); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^nOberst befoerdert", Killer); centersay(Text, SHOW_TIME, PROMO_R, PROMO_G, PROMO_B); } } else { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum Oberst degradiert", Killer); cm_csgsay(Text, "down"); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^nOberst degradiert", Killer); centersay(Text, SHOW_TIME, DEGRA_R, DEGRA_G, DEGRA_B); } } strcpy(RANKS[iIDK], "[Oberst]", MAX_RANK_LENGTH); if (bRename == 1) { snprintf(sCommand,MAX_DATA_LENGTH,"name ^"[Oberst] %s^"", NAMES[iIDK]); execclient(Killer, sCommand); } cm_SaveName(iIDK); // Brigadegeneral } else if ((KILLS[iIDK] == RANK11) && (strcmp(RANKS[iIDK], "[BriGen]") != 0)) { if (bBefoerderung == 1) { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum Brigadegeneral befoerdert", Killer); cm_csgsay(Text, "up"); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^nBrigadegeneral befoerdert", Killer); centersay(Text, SHOW_TIME, PROMO_R, PROMO_G, PROMO_B); } } else { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum Brigadegeneral degradiert", Killer); cm_csgsay(Text, "down"); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^nBrigadegeneral degradiert", Killer); centersay(Text, SHOW_TIME, DEGRA_R, DEGRA_G, DEGRA_B); } } strcpy(RANKS[iIDK], "[BriGen]", MAX_RANK_LENGTH); if (bRename == 1) { snprintf(sCommand,MAX_DATA_LENGTH,"name ^"[BriGen] %s^"", NAMES[iIDK]); execclient(Killer, sCommand); } cm_SaveName(iIDK); // Generalmajor } else if ((KILLS[iIDK] == RANK12) && (strcmp(RANKS[iIDK], "[GenMaj]") != 0)) { if (bBefoerderung == 1) { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum Generalmajor befoerdert", Killer); cm_csgsay(Text, "up"); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^nGeneralmajor befoerdert", Killer); centersay(Text, SHOW_TIME, PROMO_R, PROMO_G, PROMO_B); } } else { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum Generalmajor degradiert", Killer); cm_csgsay(Text, "down"); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^nGeneralmajor degradiert", Killer); centersay(Text, SHOW_TIME, DEGRA_R, DEGRA_G, DEGRA_B); } } strcpy(RANKS[iIDK], "[GenMaj]", MAX_RANK_LENGTH); if (bRename == 1) { snprintf(sCommand,MAX_DATA_LENGTH,"name ^"[GenMaj] %s^"", NAMES[iIDK]); execclient(Killer, sCommand); } cm_SaveName(iIDK); // General } else if ((KILLS[iIDK] == RANK13) && (strcmp(RANKS[iIDK], "[General]") != 0)) { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum General befoerdert", Killer); cm_csgsay(Text, ""); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^nGeneral befoerdert", Killer); centersay(Text, SHOW_TIME, PROMO_R, PROMO_G, PROMO_B); } strcpy(RANKS[iIDK], "[General]", MAX_RANK_LENGTH); if (bRename == 1) { snprintf(sCommand,MAX_DATA_LENGTH,"name ^"[General] %s^"", NAMES[iIDK]); execclient(Killer, sCommand); } cm_SaveName(iIDK); } } } } ///////////////////////////// DEBUG START ////////////////////////////// #if DEBUG snprintf(Text, MAX_TEXT_LENGTH, "DEBUG: %s hat nun %i Kills", Killer, KILLS[iIDK]); say(Text); new i; printf("^n"); for (i=1; i<=10; i++) { printf("%d^t:^t%s^n", i, RANKS[i]); } #endif ////////////////////////////// DEBUG END /////////////////////////////// return PLUGIN_CONTINUE; } // This funktion will be execuded whenever a player entered the game public cm_HandleEnterGame(HLCommand,HLData,HLUserName,UserIndex) { if (!bEnabled) return PLUGIN_CONTINUE; new sData[MAX_DATA_LENGTH]; new iID; new iWONID; new sCommand[MAX_DATA_LENGTH]; new sPlayer[MAX_NAME_LENGTH]; new dummy; convert_string(HLData, sData, MAX_DATA_LENGTH); iID = strtonum(sData); ///////////////////////////// DEBUG START ////////////////////////////// #if DEBUG new Text[MAX_TEXT_LENGTH]; snprintf(Text, MAX_TEXT_LENGTH, "DEBUG: Index of new player: %i", iID); say(Text); #endif ////////////////////////////// DEBUG END /////////////////////////////// cm_NameCheck(iID); snprintf(sCommand,MAX_DATA_LENGTH,"name ^"[Gren] %s^"", NAMES[iID]); if (bRename == 1) { if (playerinfo(iID, sPlayer, MAX_NAME_LENGTH, dummy, iWONID, dummy, dummy)) { if (iWONID != 0) { execclient(sPlayer, sCommand); } } } return PLUGIN_CONTINUE; } // This funktion will be execuded whenever a player changed his name public cm_HandleNameChange(HLCommand,HLData,HLUserName,UserIndex) { if (!bEnabled) return PLUGIN_CONTINUE; new sData[MAX_DATA_LENGTH]; new sID[3]; new sName[MAX_NAME_LENGTH]; new iID; convert_string(HLData, sData, MAX_DATA_LENGTH); strsep(sData, " ", sID, 3, sName, MAX_NAME_LENGTH); iID = strtonum(sID); ///////////////////////////// DEBUG START ////////////////////////////// #if DEBUG new Text[MAX_TEXT_LENGTH]; snprintf(Text, MAX_TEXT_LENGTH, "DEBUG: Player %i changed his name to %s", iID, sName); say(Text); #endif ////////////////////////////// DEBUG END /////////////////////////////// cm_NameCheck2(iID); return PLUGIN_CONTINUE; } // This funktion will be execuded on World Actions public cm_HandleWorld(HLCommand,HLData,HLUserName,UserIndex) { if (!bEnabled) return PLUGIN_CONTINUE; new sData[MAX_DATA_LENGTH]; new i; new sName[MAX_NAME_LENGTH]; new dummy; convert_string(HLData,sData,MAX_DATA_LENGTH); if (strcmp(sData, "Round_Start") == 0 ) { for(i=1; i<maxplayercount(); i++) { cm_NameCheck2(i) } } else if (strcmp(sData, "Game_Commencing") == 0 ) { for(i=1; i<MAX_PLAYERS; i++) { if (playerinfo(i, sName, MAX_NAME_LENGTH, dummy, dummy, dummy, dummy)) { KILLS[i] = CLEAN_SLATE; strcpy(RANKS[i], "[Gren]", MAX_RANK_LENGTH); } } } return PLUGIN_CONTINUE; } cm_NameCheck(iID) { new sOldName[MAX_NAME_LENGTH]; new sRank[MAX_RANK_LENGTH]; new sNameRest[MAX_NAME_LENGTH]; new dummy; new iWONID; new iStatus = 0; if (playerinfo(iID, sOldName, MAX_NAME_LENGTH, dummy, iWONID, dummy, dummy)) { strsep(sOldName, " ", sRank, MAX_RANK_LENGTH, sNameRest, MAX_NAME_LENGTH); ///////////////////////////// DEBUG START ////////////////////////////// #if DEBUG printf("^nDEBUG: -----------------------------^n"); printf("DEBUG: NameCheck^n"); printf("DEBUG: iID:^t^t%d^n", iID); printf("DEBUG: sOldName:^t%s^n", sOldName); printf("DEBUG: sRank:^t^t%s^n", sRank); printf("DEBUG: sNameRest:^t%s^n", sNameRest); printf("DEBUG: -----------------------------^n"); #endif ////////////////////////////// DEBUG END /////////////////////////////// } if (iWONID != 0) { if (strcmp(sRank, "[Gren]") == 0) { iStatus = 1; } else if (strcmp(sRank, "[OG]") == 0) { iStatus = 1; } else if (strcmp(sRank, "[HG]") == 0) { iStatus = 1; } else if (strcmp(sRank, "[U]") == 0) { iStatus = 1; } else if (strcmp(sRank, "[Fw]") == 0) { iStatus = 1; } else if (strcmp(sRank, "[OStFw]") == 0) { iStatus = 1; } else if (strcmp(sRank, "[Lt]") == 0) { iStatus = 1; } else if (strcmp(sRank, "[Hptm]") == 0) { iStatus = 1; } else if (strcmp(sRank, "[Major]") == 0) { iStatus = 1; } else if (strcmp(sRank, "[Oberst]") == 0) { iStatus = 1; } else if (strcmp(sRank, "[BriGen]") == 0) { iStatus = 1; } else if (strcmp(sRank, "[GenMaj]") == 0) { iStatus = 1; } else if (strcmp(sRank, "[General]") == 0) { iStatus = 1; } if (iStatus == 1) { strcpy(NAMES[iID], sNameRest, MAX_NAME_LENGTH); } } return PLUGIN_CONTINUE; } cm_NameCheck2(iID) { new sNewName[MAX_NAME_LENGTH]; new sRank[MAX_RANK_LENGTH]; new sNameRest[MAX_NAME_LENGTH]; new dummy; new iWONID; new iStatus; new sCommand[MAX_DATA_LENGTH]; if (playerinfo(iID, sNewName, MAX_NAME_LENGTH, dummy, iWONID, dummy, dummy)) { strsep(sNewName, " ", sRank, MAX_RANK_LENGTH, sNameRest, MAX_NAME_LENGTH); ///////////////////////////// DEBUG START ////////////////////////////// #if DEBUG printf("^nDEBUG: -----------------------------^n"); printf("DEBUG: NameCheck2^n"); printf("DEBUG: iID:^t^t%d^n", iID); printf("DEBUG: sNewName:^t%s^n", sNewName); printf("DEBUG: sRank:^t^t%s^n", sRank); printf("DEBUG: sNameRest:^t%s^n", sNameRest); printf("DEBUG: -----------------------------^n"); #endif ////////////////////////////// DEBUG END /////////////////////////////// } if (iWONID != 0) { if (strcmp(sRank, "[Gren]") == 0) { if (strcmp(RANKS[iID], "[Gren]") == 0) { iStatus = 0; } else { iStatus = 1; } } else if (strcmp(sRank, "[OG]") == 0) { if (strcmp(RANKS[iID], "[OG]") == 0) { iStatus = 0; } else { iStatus = 1; } } else if (strcmp(sRank, "[HG]") == 0) { if (strcmp(RANKS[iID], "[HG]") == 0) { iStatus = 0; } else { iStatus = 1; } } else if (strcmp(sRank, "[U]") == 0) { if (strcmp(RANKS[iID], "[U]") == 0) { iStatus = 0; } else { iStatus = 1; } } else if (strcmp(sRank, "[Fw]") == 0) { if (strcmp(RANKS[iID], "[Fw]") == 0) { iStatus = 0; } else { iStatus = 1; } } else if (strcmp(sRank, "[OStFw]") == 0) { if (strcmp(RANKS[iID], "[OStFw]") == 0) { iStatus = 0; } else { iStatus = 1; } } else if (strcmp(sRank, "[Lt]") == 0) { if (strcmp(RANKS[iID], "[Lt]") == 0) { iStatus = 0; } else { iStatus = 1; } } else if (strcmp(sRank, "[Hptm]") == 0) { if (strcmp(RANKS[iID], "[Hptm]") == 0) { iStatus = 0; } else { iStatus = 1; } } else if (strcmp(sRank, "[Major]") == 0) { if (strcmp(RANKS[iID], "[Major]") == 0) { iStatus = 0; } else { iStatus = 1; } } else if (strcmp(sRank, "[Oberst]") == 0) { if (strcmp(RANKS[iID], "[Oberst]") == 0) { iStatus = 0; } else { iStatus = 1; } } else if (strcmp(sRank, "[BriGen]") == 0) { if (strcmp(RANKS[iID], "[BriGen]") == 0) { iStatus = 0; } else { iStatus = 1; } } else if (strcmp(sRank, "[GenMaj]") == 0) { if (strcmp(RANKS[iID], "[GenMaj]") == 0) { iStatus = 0; } else { iStatus = 1; } } else if (strcmp(sRank, "[General]") == 0) { if (strcmp(RANKS[iID], "[General]") == 0) { iStatus = 0; } else { iStatus = 1; } } else { iStatus = 2; } if (iStatus == 1) { strcpy(NAMES[iID], sNameRest, MAX_NAME_LENGTH); if (bRename == 1) { snprintf(sCommand,MAX_DATA_LENGTH,"name ^"%s %s^"", RANKS[iID], sNameRest); execclient(sNewName, sCommand); } } else if (iStatus == 2) { strcpy(NAMES[iID], sNewName, MAX_NAME_LENGTH); if (bRename == 1) { snprintf(sCommand,MAX_DATA_LENGTH,"name ^"%s %s^"", RANKS[iID], NAMES[iID]); execclient(sNewName, sCommand); } } } return PLUGIN_CONTINUE; } cm_SaveName(iID) { new sName[MAX_NAME_LENGTH]; new dummy; new iWONID; new Text[MAX_TEXT_LENGTH]; new sRank[MAX_RANK_LENGTH]; new sNameRest[MAX_NAME_LENGTH]; if (playerinfo(iID, sName, MAX_NAME_LENGTH, dummy, iWONID, dummy, dummy)) { strsep(sName, " ", sRank, MAX_RANK_LENGTH, sNameRest, MAX_NAME_LENGTH); snprintf(Text, MAX_TEXT_LENGTH, "%s^t%s^t%i", sNameRest, RANKS[iID], iWONID); writefile(FILENAME, Text); snprintf(Text, MAX_TEXT_LENGTH, "CAREER: '%s' has been successfully updated", FILENAME); log(Text); ///////////////////////////// DEBUG START ////////////////////////////// #if DEBUG printf("^nDEBUG: -----------------------------^n"); printf("DEBUG: SaveName^n"); printf("DEBUG: sName:^t^t%s^n", sName); printf("DEBUG: sRank:^t^t%s^n", sRank); printf("DEBUG: sNameRest:^t%s^n", sNameRest); printf("DEBUG: RANKS[iID]:^t%s^n", RANKS[iID]); printf("DEBUG: iWONID:^t^t%d^n", iWONID); printf("DEBUG: -----------------------------^n"); #endif ////////////////////////////// DEBUG END /////////////////////////////// } } cm_csgsay(sMessage[]="", sStatus[]="") { new sCommand[MAX_TEXT_LENGTH]; if (strcmp(sStatus, "up") == 0) { #if CSG_PROMO_RED exec("csg_sayformat ^"255:12:12:-1:0.65:0:0.25:2:3.0:4.0^""); #endif #if CSG_PROMO_GREEN exec("csg_sayformat ^"12:255:12:-1:0.65:0:0.25:2:3.0:4.0^""); #endif #if CSG_PROMO_BLUE exec("csg_sayformat ^"12:12:255:-1:0.65:0:0.25:2:3.0:4.0^""); #endif #if CSG_PROMO_WHITE exec("csg_sayformat ^"255:255:255:-1:0.65:0:0.25:2:3.0:4.0^""); #endif #if CSG_PROMO_YELLOW exec("csg_sayformat ^"255:255:0:-1:0.65:0:0.25:2:3.0:4.0^""); #endif } else if (strcmp(sStatus, "down") == 0) { #if CSG_DEGRA_RED exec("csg_sayformat ^"255:12:12:-1:0.65:0:0.25:2:3.0:4.0^""); #endif #if CSG_DEGRA_GREEN exec("csg_sayformat ^"12:255:12:-1:0.65:0:0.25:2:3.0:4.0^""); #endif #if CSG_DEGRA_BLUE exec("csg_sayformat ^"12:12:255:-1:0.65:0:0.25:2:3.0:4.0^""); #endif #if CSG_DEGRA_WHITE exec("csg_sayformat ^"255:255:255:-1:0.65:0:0.25:2:3.0:4.0^""); #endif #if CSG_DEGRA_YELLOW exec("csg_sayformat ^"255:255:0:-1:0.65:0:0.25:2:3.0:4.0^""); #endif } else { exec("csg_sayformat ^"255:255:255:-1:0.65:0:0.25:2:3.0:4.0^""); } snprintf(sCommand,MAX_TEXT_LENGTH,"csg_say ^"%s^"", sMessage); exec(sCommand); exec("exec ^"csguard\csg_color.cfg^""); return PLUGIN_HANDLED; } cm_initialize() { new sData[2]; new iData; new sData2[2]; new iData2; new sData3[2]; new iData3; if (get_vaultdata("career_mode", sData, 2) == 1) { iData = strtonum(sData); ///////////////////////////// DEBUG START ////////////////////////////// #if DEBUG printf("^nDEBUG: -----------------------------^n"); printf("DEBUG: Vault.ini - career_mode^n"); printf("DEBUG: (String):^t%s^n", sData); printf("DEBUG: (Integer):^t%d^n", iData); printf("DEBUG: -----------------------------^n"); #endif ////////////////////////////// DEBUG END /////////////////////////////// if (iData == 1) { bEnabled = 1; } else { bEnabled = 0; } } else { bEnabled = 0; } if (get_vaultdata("career_usecsgsay", sData2, 2) == 1) { iData2 = strtonum(sData2); ///////////////////////////// DEBUG START ////////////////////////////// #if DEBUG printf("^nDEBUG: -----------------------------^n"); printf("DEBUG: Vault.ini - career_usecsgsay:^n"); printf("DEBUG: (String):^t%s^n", sData2); printf("DEBUG: (Integer):^t%d^n", iData2); printf("DEBUG: -----------------------------^n"); #endif ////////////////////////////// DEBUG END /////////////////////////////// if (iData2 == 1) { bUseCSGSAY = 1; } else { bUseCSGSAY = 0; } } else { bUseCSGSAY = 0; } if (get_vaultdata("career_rename", sData3, 2) == 1) { iData3 = strtonum(sData3); ///////////////////////////// DEBUG START ////////////////////////////// #if DEBUG printf("^nDEBUG: -----------------------------^n"); printf("DEBUG: Vault.ini - career_rename:^n"); printf("DEBUG: (String):^t%s^n", sData3); printf("DEBUG: (Integer):^t%d^n", iData3); printf("DEBUG: -----------------------------^n"); #endif ////////////////////////////// DEBUG END /////////////////////////////// if (iData3 == 0) { bRename = 0; } else { bRename = 1; } } else { bRename = 1; } } public plugin_connect(HLUserName, HLIP, UserIndex) { new sHLUserName[MAX_TEXT_LENGTH]; convert_string(HLUserName,sHLUserName,MAX_DATA_LENGTH); if (UserIndex >= 1 && UserIndex <= MAX_PLAYERS) { KILLS[UserIndex] = CLEAN_SLATE; strcpy(NAMES[UserIndex], sHLUserName, MAX_NAME_LENGTH); strcpy(RANKS[UserIndex], "[Gren]", MAX_RANK_LENGTH); } return PLUGIN_CONTINUE; } public plugin_disconnect(HLUserName, UserIndex) { if (UserIndex >= 1 && UserIndex <= MAX_PLAYERS) { KILLS[UserIndex] = CLEAN_SLATE; } return PLUGIN_CONTINUE; } public plugin_init() { plugin_registerinfo("Career Plugin by Rizla and Biohazard","Work your way up.",STRING_VERSION); plugin_registercmd("cm_HandleKill", "cm_HandleKill", ACCESS_CONSOLE); plugin_registercmd("cm_HandleEnterGame", "cm_HandleEnterGame", ACCESS_CONSOLE); plugin_registercmd("cm_HandleNameChange", "cm_HandleNameChange", ACCESS_CONSOLE); plugin_registercmd("cm_HandleWorld", "cm_HandleWorld", ACCESS_CONSOLE); // plugin_registercmd("cm_HandleTeamSelect", "cm_HandleTeamSelect", ACCESS_CONSOLE); // plugin_registercmd("cm_HandleSuicide", "cm_HandleSuicide", ACCESS_CONSOLE); plugin_registercmd("admin_career","admin_career",ACCESS_CAREER,"admin_career 1/0: Turns Career Mode on or off."); exec("logd_reg 57 admin_command cm_HandleKill"); // Kill exec("logd_reg 51 admin_command cm_HandleEnterGame"); // Enter Game exec("logd_reg 56 admin_command cm_HandleNameChange"); // Change Name exec("logd_reg 62 admin_command cm_HandleWorld"); // World Action // exec("logd_reg 54 admin_command cm_HandleTeamSelect"); // Change Team // exec("logd_reg 53 admin_command cm_HandleSuicide"); // Suicide cm_initialize(); return PLUGIN_CONTINUE; }Das komplette Plugin als Quellcode mit Info.txt und vorkompilierten AMX für Windows und Linux findet ihr hier: www.ekclan.de/plugins/plugin_logd_career.zip oder: http://www.cottbus-plus.de/kuhl_ma/plug ... career.zip Wenn das Plugin Gefallen findet, werden wir eine Version 2 mit erweiterten Funktionen programmieren. Viel Spaß damit ... Rizla & Bio |
Autor: | rizla [ 29.05.2002, 00:08 ] |
Betreff des Beitrags: | |
hehe sauberes ding bio!!!! naja mal sehen was da so kommt ! cu Rizla |
Autor: | [COLA]*Whiskey [ 29.05.2002, 08:46 ] |
Betreff des Beitrags: | |
hmm das mit den namen umbenennen find ich nich so toll ausserdem wenn man sein admin_pw über den namen laufen lässt dann verschwindet der ja auch |
Autor: | rizla [ 29.05.2002, 08:49 ] |
Betreff des Beitrags: | |
wenn einem das mit den namen nicht gefällt kann man das ja auch ausstellen! steht ganz oben in der "kleinen" info hehe cu rizla |
Autor: | DevilZero [ 29.05.2002, 11:18 ] |
Betreff des Beitrags: | |
DAS PLUGIN IST DER HAMMER, nur etwas hab ich zu bemängeln...der Rang sollte NACH dem Namen stehen, sonst gibt das n durcheinander mit den Clantags.... ANSONSTEN: SAUBERE ARBEIT! |
Autor: | MrClone [ 29.05.2002, 13:59 ] |
Betreff des Beitrags: | |
Ahaaa, jetzt weis ich wozu ihr das csg_say braucht! Ich schaue mir das auch gleich an! Aber das mit dem csg_say habt ihr ein wenig ungeschickt angestellt, hier mal ein Ausschnitt aus meinem neuen cs/hl-guard plugin: Code: csgcsay(sMessage[ ],sRed[ ],sGreen[ ],sBlue[ ]) { new sCSGFORM[MAX_DATA_LENGTH]; new sCSGSAY[MAX_DATA_LENGTH]; new CSGDATA[MAX_NAME_LENGTH]; new CSGNFORM[MAX_NAME_LENGTH]; getstrvar("csg_sayformat",CSGDATA,MAX_DATA_LENGTH); snprintf(CSGNFORM, MAX_TEXT_LENGTH,"csg_sayformat ^"%s^"",CSGDATA); snprintf(sCSGFORM,MAX_TEXT_LENGTH,"csg_sayformat ^"%s:%s:%s:-1:0.20:1:3:6:3.0:4.0^"",sRed,sGreen,sBlue); snprintf(sCSGSAY,MAX_TEXT_LENGTH,"csg_say ^"%s^"",sMessage); exec(sCSGFORM); exec(sCSGSAY); exec(CSGNFORM); return 1; } |
Autor: | Biohazard1 [ 29.05.2002, 14:28 ] |
Betreff des Beitrags: | |
Zitat: ... wenn man sein admin_pw über den namen laufen lässt dann verschwindet der ja auch
Da muß ich dir recht geben. Allerdings werden die meisten die einen Server im Internet betreiben wohl per WonID als Admin erkannt. Wer jedoch im LAN spielt hat folgende Möglichkeiten:a) RCON zur Administration des Servers nutzen (ist wohl nicht die beste Lösung wenn man sonst das gute AdminMod gewöhnt ist) b) Wie Rizla schon sagte: Die Namensänderung durch einfügen von 'career_rename 0' in die 'vault.ini' deaktivieren. c) Für jeden Rang mit Namen einen Admin in der 'users.ini' definieren (wenn man der einzige Admin des Servers ist, ist dies wohl die beste Lösung. Es gibt übrigens 13 Ränge) Andere Möglichkeiten sehe ich zurzeit leider nicht. Zitat: ... nur etwas hab ich zu bemängeln...der Rang sollte NACH dem Namen stehen, sonst gibt das n durcheinander mit den Clantags....
Sollten noch mehr Leute dieser Meinung sein werden wir uns überlegen ob wir das Plugin dahingehend ändern.Danke an alle für eure Meinung und Kritik... Bio @MrClone: Du hast recht, an diese Möglichkeit habe ich garnicht gedacht. Das ist die erste Änderung die wir in der neuen Version einbauen werden. |
Autor: | MrClone [ 29.05.2002, 14:35 ] |
Betreff des Beitrags: | |
@Bio, da ich gerade so gut drauf bin, wahrscheinlich weil mir euer Plugin richtig gefällt. Ihr habt doch ständig diese Zeilen, 20 Stück oder so: Code: } else if ((KILLS[iIDK] == RANK2) && (strcmp(RANKS[iIDK], "[OG]") != 0)) { if (bBefoerderung == 1) { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum Obergefreiten befoerdert", Killer); cm_csgsay(Text, "up"); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^nObergefreiten befoerdert", Killer); centersay(Text, SHOW_TIME, PROMO_R, PROMO_G, PROMO_B); } } else { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum Obergefreiten degradiert", Killer); cm_csgsay(Text, "down"); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^nObergefreiten degradiert", Killer); centersay(Text, SHOW_TIME, DEGRA_R, DEGRA_G, DEGRA_B); } } strcpy(RANKS[iIDK], "[OG]", MAX_RANK_LENGTH); if (bRename == 1) { snprintf(sCommand,MAX_DATA_LENGTH,"name ^"[OG] %s^"", NAMES[iIDK]); execclient(Killer, sCommand); } // Hauptgefreiter } else if ((KILLS[iIDK] == RANK3) && (strcmp(RANKS[iIDK], "[HG]") != 0)) { if (bBefoerderung == 1) { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum Hauptgefreiten befoerdert", Killer); cm_csgsay(Text, "up"); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^nHauptgefreiten befoerdert", Killer); centersay(Text, SHOW_TIME, PROMO_R, PROMO_G, PROMO_B); } } else { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum Hauptgefreiten degradiert", Killer); cm_csgsay(Text, "down"); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^nHauptgefreiten degradiert", Killer); centersay(Text, SHOW_TIME, DEGRA_R, DEGRA_G, DEGRA_B); } } strcpy(RANKS[iIDK], "[HG]", MAX_RANK_LENGTH); if (bRename == 1) { snprintf(sCommand,MAX_DATA_LENGTH,"name ^"[HG] %s^"", NAMES[iIDK]); execclient(Killer, sCommand); }Könntest du das nicht auch über einen neuen Befehl laufen lassen? Also so ungefähr wie das beispiel von mir mit dem csgsay...! Dort gebt ihr also in einen oder Zwei Befehle die texte "%s wurde zum Obergefreiten befoerdert" usw..dann noch paar Anforderungen (KILLS[iIDK] == RANK2) und so, und das läuft komplett über einen Befehl, und ihr braucht nicht 10000Zeilen! Achja, das plugin sollte auch hlguard kompatibel sein! |
Autor: | MrClone [ 29.05.2002, 15:00 ] |
Betreff des Beitrags: | |
Das sollte also ungefähr so aussehen: Code: checkdoRang(DerRang[ ],KurzRang[ ]) if (bBefoerderung == 1) { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum %s befoerdert", Killer, DerRang); cm_csgsay(Text, "up"); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^n%s befoerdert", Killer, DerRang); centersay(Text, SHOW_TIME, PROMO_R, PROMO_G, PROMO_B); } } else { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum %s degradiert", Killer, DerRang); cm_csgsay(Text, "down"); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^n%s degradiert", Killer, DerRang); centersay(Text, SHOW_TIME, DEGRA_R, DEGRA_G, DEGRA_B); } } strcpy(RANKS[iIDK],KurzRang, MAX_RANK_LENGTH); if (bRename == 1) { snprintf(sCommand,MAX_DATA_LENGTH,"name ^"%s %s^"", KurzRang, NAMES[iIDK]); execclient(Killer, sCommand); }und dann weiter unten Code: ... } else if ((KILLS[iIDK] == RANK2) && (strcmp(RANKS[iIDK], "[OG]") != 0)) { checkdoRang("Obergefreiter","[OG]"); } else if ((KILLS[iIDK] == RANK3) && (strcmp(RANKS[iIDK], "[HG]") != 0)) { checkdoRang("Hauptgefreiten","[HG]"); } else if ((KILLS[iIDK] == RANK4) && (strcmp(RANKS[iIDK], "[U]") != 0)) { checkdoRang("Unteroffizier","[U]"); } ...Ich hab es so zwar nicht getestet, aber so ungefärt müsste es gehen! |
Autor: | Biohazard1 [ 29.05.2002, 15:17 ] |
Betreff des Beitrags: | |
Ich vestehe was du meinst. Ok, dann werde ich mich der Sache mal annehmen. Danke für die Tips... Bio Nachtrag: Ok, ich habe es soweit geändert, allerdings handelt es sich bei bBefoerderung nicht um eine globale Variable, sodass man sie der neuen Funktion mit übergeben muß. |
Autor: | MrClone [ 29.05.2002, 19:30 ] |
Betreff des Beitrags: | |
Jo stimmt, das hatte ich vorher nicht gesehen, das müsste dann etwa so aussehen: doRank(TheRank[ ],StRank[ ],bBefoerderung[ ],Text[ ],Killer[ ],iIDK[ ]) stimmts? |
Autor: | Biohazard1 [ 30.05.2002, 13:15 ] |
Betreff des Beitrags: | |
Bei uns sieht die Funktion nun so aus: Code: cm_CheckRank(iIDK, sKiller[]="", sRank[]="", sShortCut[]="", bBefoerderung)Da ja bBefoerderung und iIDK keine Strings sondern Variablen sind. BTW: Wozu hast du noch ein Text[] einbauen wollen ? Übrigens ist der Quellcode nachdem ich deine Tips realisiert habe 30% kleiner geworden Bio |
Autor: | MrClone [ 30.05.2002, 14:41 ] |
Betreff des Beitrags: | |
%30 kleiner? Uj nur noch 672 Zeilen? |
Autor: | Biohazard1 [ 30.05.2002, 14:51 ] |
Betreff des Beitrags: | |
Zitat: %30 kleiner? Uj nur noch 672 Zeilen?
Habe mich etwas unklar ausgedrück - die AMX ist 30 % kleiner als vorher.Bio |
Autor: | MrClone [ 30.05.2002, 15:21 ] |
Betreff des Beitrags: | |
lol, sende mir doch mal bitte die neue version, ich will die mir mal ansehen! |
Autor: | Biohazard1 [ 30.05.2002, 15:35 ] |
Betreff des Beitrags: | |
Hier eine Vorabversion der 1.6b unseres Plugins: Code: /************************************************************************* ************** Rizlas and Biohazards Career Plugin v 1.6b **** ************ ****** ********** INFO: This plugin promotes player by means of their ******** ******** kills. The more you kill the higher your rank will ********** ****** be. !!! NOTE THAT THIS IS A BETA VERSION !!! ************ **** GREETINGS to: Sir Drink A Lot and Black Knight - Be ************** *** sure to check out their new plugin 'CW-Creator'. It *************** **** is pretty cool. ************** ****** THANKS to: Luke Sankey for making me laughing every ************ ******** time I join a server which is running his funny ********** ********** plugin_sank_sounds - woohoo ******** ************ SPECIAL THANKS to: MrClone for his help about using ****** ************** the CSG-Say-Funktion **** *************************************************************************/ /**************************** INCLUDES ****************************/ #include <core> #include <console> #include <string> #include <admin> #include <adminlib> /**************************** DEFINES *****************************/ #define ACCESS_CONSOLE 131072 #define ACCESS_CAREER 1024 #define CLEAN_SLATE 0 #define SHOW_TIME 8 #define MAX_RANK_LENGTH 11 #define RANK1 0 // Grenadier #define RANK2 2 // Obergefreiter #define RANK3 5 // Hauptgefreiter #define RANK4 8 // Unteroffizier #define RANK5 13 // Feldwebel #define RANK6 18 // Oberstabsfeldwebel #define RANK7 25 // Leutnant #define RANK8 32 // Hauptmann #define RANK9 41 // Major #define RANK10 50 // Oberst #define RANK11 61 // Brigadegeneral #define RANK12 72 // Generalmajor #define RANK13 85 // General #define PROMO_R 12 // Color of promotion message (red part) #define PROMO_G 255 // Color of promotion message (green part) #define PROMO_B 12 // Color of promotion message (blue part) #define DEGRA_R 255 // Color of degrade message (red part) #define DEGRA_G 12 // Color of degrade message (green part) #define DEGRA_B 12 // Color of degrade message (blue part) #define DEBUG 0 /************************ GLOBAL VARIABLES ************************/ new STRING_VERSION[MAX_DATA_LENGTH] = "1.6b"; // Plugin Version new FILENAME[MAX_DATA_LENGTH] = "honor.dat"; new bEnabled; new bUseCSGSAY; new bRename; new sCSG_PROMO_R[4] = "12"; // Color of CSG promotion message (red part) new sCSG_PROMO_G[4] = "255"; // Color of CSG promotion message (green part) new sCSG_PROMO_B[4] = "12"; // Color of CSG promotion message (blue part) new sCSG_DEGRA_R[4] = "255"; // Color of CSG degrade message (red part) new sCSG_DEGRA_G[4] = "12"; // Color of CSG degrade message (green part) new sCSG_DEGRA_B[4] = "12"; // Color of CSG degrade message (blue part) new KILLS[MAX_PLAYERS] = {CLEAN_SLATE,...}; new NAMES[MAX_PLAYERS][MAX_NAME_LENGTH]; new RANKS[MAX_PLAYERS][MAX_RANK_LENGTH]; // This funktion is used to en-/disable the plugin public admin_career(HLCommand,HLData,HLUserName,UserIndex) { new sCommand[MAX_COMMAND_LENGTH]; new sData[MAX_DATA_LENGTH]; new sUser[MAX_NAME_LENGTH]; new Text[MAX_TEXT_LENGTH]; convert_string(HLCommand,sCommand,MAX_COMMAND_LENGTH); convert_string(HLData,sData,MAX_DATA_LENGTH); convert_string(HLUserName,sUser,MAX_NAME_LENGTH); if (strlen(sData) == 0) { snprintf(Text,MAX_TEXT_LENGTH,"Career Mode: %i", bEnabled); selfmessage(Text); } else if (strcmp(sData, "1") == 0) { if (bEnabled == 0) { selfmessage("Career Mode has been enabled !"); bEnabled = 1; say_command(sUser,sCommand,sData); } else { selfmessage("Career Mode allready enabled !"); } } else if (strcmp(sData, "0") == 0) { if (bEnabled == 1) { selfmessage("Career Mode has been disabled !"); bEnabled = 0; say_command(sUser,sCommand,sData); } else { selfmessage("Career Mode allready disabled !"); } } else if (strcmp(sData, "reset") == 0) { if (fileexists(FILENAME) > 0) { resetfile(FILENAME); snprintf(Text,MAX_TEXT_LENGTH,"'%s' has been reseted.", FILENAME); selfmessage(Text); say_command(sUser,sCommand,sData); } else { snprintf(Text,MAX_TEXT_LENGTH,"'%s' not found.", FILENAME); selfmessage(Text); } } else { selfmessage("Wrong argument !"); } return PLUGIN_HANDLED; } // This funktion will be execuded whenever someone is killed public cm_HandleKill(HLCommand,HLData,HLUserName,UserIndex) { if (!bEnabled) return PLUGIN_CONTINUE; new Data[MAX_DATA_LENGTH]; new iWONIDK; new iTeamK; new iTeamV; new iIDK; new iIDV; new sID1[3]; new sID2[3]; new dummy; new sKiller[MAX_NAME_LENGTH]; new sVictim[MAX_NAME_LENGTH]; new bBefoerderung; convert_string(HLData, Data, MAX_DATA_LENGTH); strsplit(Data, " ", sID1, 3, sID2, 3); iIDK = strtonum(sID1); iIDV = strtonum(sID2); if(playerinfo(iIDK, sKiller, MAX_NAME_LENGTH, dummy, iWONIDK, iTeamK)) { if(playerinfo(iIDV, sVictim, MAX_NAME_LENGTH, dummy, dummy, iTeamV)) { if (iTeamK == iTeamV) { KILLS[iIDK] = KILLS[iIDK] - 1; bBefoerderung = 0; } else { KILLS[iIDK] = KILLS[iIDK] + 1; bBefoerderung = 1; } if (iWONIDK != 0) { // Grenadier if ((KILLS[iIDK] == RANK1) && (strcmp(RANKS[iIDK], "[Gren]") != 0)) { cm_CheckRank(iIDK, sKiller, "Grenadier", "[Gren]", bBefoerderung); // Obergefreiter } else if ((KILLS[iIDK] == RANK2) && (strcmp(RANKS[iIDK], "[OG]") != 0)) { cm_CheckRank(iIDK, sKiller, "Obergefreiter", "[OG]", bBefoerderung); // Hauptgefreiter } else if ((KILLS[iIDK] == RANK3) && (strcmp(RANKS[iIDK], "[HG]") != 0)) { cm_CheckRank(iIDK, sKiller, "Hauptgefreiter", "[HG]", bBefoerderung); // Unteroffizier } else if ((KILLS[iIDK] == RANK4) && (strcmp(RANKS[iIDK], "[U]") != 0)) { cm_CheckRank(iIDK, sKiller, "Unteroffizier", "[U]", bBefoerderung); // Feldwebel } else if ((KILLS[iIDK] == RANK5) && (strcmp(RANKS[iIDK], "[Fw]") != 0)) { cm_CheckRank(iIDK, sKiller, "Feldwebel", "[Fw]", bBefoerderung); // Oberstabsfeldwebel } else if ((KILLS[iIDK] == RANK6) && (strcmp(RANKS[iIDK], "[OStFw]") != 0)) { cm_CheckRank(iIDK, sKiller, "Oberstabsfeldwebel", "[OStFw]", bBefoerderung); // Leutnant } else if ((KILLS[iIDK] == RANK7) && (strcmp(RANKS[iIDK], "[Lt]") != 0)) { cm_CheckRank(iIDK, sKiller, "Leutnant", "[Lt]", bBefoerderung); // Hauptmann } else if ((KILLS[iIDK] == RANK8) && (strcmp(RANKS[iIDK], "[Hptm]") != 0)) { cm_CheckRank(iIDK, sKiller, "Hauptmann", "[Hptm]", bBefoerderung); // Major } else if ((KILLS[iIDK] == RANK9) && (strcmp(RANKS[iIDK], "[Major]") != 0)) { cm_CheckRank(iIDK, sKiller, "Major", "[Major]", bBefoerderung); // Oberst } else if ((KILLS[iIDK] == RANK10) && (strcmp(RANKS[iIDK], "[Oberst]") != 0)) { cm_CheckRank(iIDK, sKiller, "Oberst", "[Oberst]", bBefoerderung); // Brigadegeneral } else if ((KILLS[iIDK] == RANK11) && (strcmp(RANKS[iIDK], "[BriGen]") != 0)) { cm_CheckRank(iIDK, sKiller, "Brigadegeneral", "[BriGen]", bBefoerderung); cm_SaveName(iIDK); // Generalmajor } else if ((KILLS[iIDK] == RANK12) && (strcmp(RANKS[iIDK], "[GenMaj]") != 0)) { cm_CheckRank(iIDK, sKiller, "Generalmajor", "[GenMaj]", bBefoerderung); cm_SaveName(iIDK); // General } else if ((KILLS[iIDK] == RANK13) && (strcmp(RANKS[iIDK], "[General]") != 0)) { cm_CheckRank(iIDK, sKiller, "General", "[General]", bBefoerderung); cm_SaveName(iIDK); } } } } ///////////////////////////// DEBUG START ////////////////////////////// #if DEBUG new Text[MAX_TEXT_LENGTH]; snprintf(Text, MAX_TEXT_LENGTH, "DEBUG: %s hat nun %i Kills", sKiller, KILLS[iIDK]); say(Text); new i; printf("^n"); for (i=1; i<=10; i++) { printf("%d^t:^t%s^n", i, RANKS[i]); } #endif ////////////////////////////// DEBUG END /////////////////////////////// return PLUGIN_CONTINUE; } // This funktion will be execuded whenever a player entered the game public cm_HandleEnterGame(HLCommand,HLData,HLUserName,UserIndex) { if (!bEnabled) return PLUGIN_CONTINUE; new sData[MAX_DATA_LENGTH]; new iID; new iWONID; new sCommand[MAX_DATA_LENGTH]; new sPlayer[MAX_NAME_LENGTH]; new dummy; convert_string(HLData, sData, MAX_DATA_LENGTH); iID = strtonum(sData); ///////////////////////////// DEBUG START ////////////////////////////// #if DEBUG new Text[MAX_TEXT_LENGTH]; snprintf(Text, MAX_TEXT_LENGTH, "DEBUG: Index of new player: %i", iID); say(Text); #endif ////////////////////////////// DEBUG END /////////////////////////////// cm_NameCheck(iID); snprintf(sCommand,MAX_DATA_LENGTH,"name ^"[Gren] %s^"", NAMES[iID]); if (bRename == 1) { if (playerinfo(iID, sPlayer, MAX_NAME_LENGTH, dummy, iWONID, dummy, dummy)) { if (iWONID != 0) { execclient(sPlayer, sCommand); } } } return PLUGIN_CONTINUE; } // This funktion will be execuded whenever a player changed his name public cm_HandleNameChange(HLCommand,HLData,HLUserName,UserIndex) { if (!bEnabled) return PLUGIN_CONTINUE; new sData[MAX_DATA_LENGTH]; new sID[3]; new sName[MAX_NAME_LENGTH]; new iID; convert_string(HLData, sData, MAX_DATA_LENGTH); strsep(sData, " ", sID, 3, sName, MAX_NAME_LENGTH); iID = strtonum(sID); ///////////////////////////// DEBUG START ////////////////////////////// #if DEBUG new Text[MAX_TEXT_LENGTH]; snprintf(Text, MAX_TEXT_LENGTH, "DEBUG: Player %i changed his name to %s", iID, sName); say(Text); #endif ////////////////////////////// DEBUG END /////////////////////////////// cm_NameCheck2(iID); return PLUGIN_CONTINUE; } // This funktion will be execuded on World Actions public cm_HandleWorld(HLCommand,HLData,HLUserName,UserIndex) { if (!bEnabled) return PLUGIN_CONTINUE; new sData[MAX_DATA_LENGTH]; new i; new sName[MAX_NAME_LENGTH]; new dummy; convert_string(HLData,sData,MAX_DATA_LENGTH); if (strcmp(sData, "Round_Start") == 0 ) { for(i=1; i<maxplayercount(); i++) { cm_NameCheck2(i) } } else if (strcmp(sData, "Game_Commencing") == 0 ) { for(i=1; i<MAX_PLAYERS; i++) { if (playerinfo(i, sName, MAX_NAME_LENGTH, dummy, dummy, dummy, dummy)) { KILLS[i] = CLEAN_SLATE; strcpy(RANKS[i], "[Gren]", MAX_RANK_LENGTH); } } } return PLUGIN_CONTINUE; } cm_NameCheck(iID) { new sOldName[MAX_NAME_LENGTH]; new sRank[MAX_RANK_LENGTH]; new sNameRest[MAX_NAME_LENGTH]; new dummy; new iWONID; new iStatus = 0; if (playerinfo(iID, sOldName, MAX_NAME_LENGTH, dummy, iWONID, dummy, dummy)) { strsep(sOldName, " ", sRank, MAX_RANK_LENGTH, sNameRest, MAX_NAME_LENGTH); ///////////////////////////// DEBUG START ////////////////////////////// #if DEBUG printf("^nDEBUG: -----------------------------^n"); printf("DEBUG: NameCheck^n"); printf("DEBUG: iID:^t^t%d^n", iID); printf("DEBUG: sOldName:^t%s^n", sOldName); printf("DEBUG: sRank:^t^t%s^n", sRank); printf("DEBUG: sNameRest:^t%s^n", sNameRest); printf("DEBUG: -----------------------------^n"); #endif ////////////////////////////// DEBUG END /////////////////////////////// } if (iWONID != 0) { if (strcmp(sRank, "[Gren]") == 0) { iStatus = 1; } else if (strcmp(sRank, "[OG]") == 0) { iStatus = 1; } else if (strcmp(sRank, "[HG]") == 0) { iStatus = 1; } else if (strcmp(sRank, "[U]") == 0) { iStatus = 1; } else if (strcmp(sRank, "[Fw]") == 0) { iStatus = 1; } else if (strcmp(sRank, "[OStFw]") == 0) { iStatus = 1; } else if (strcmp(sRank, "[Lt]") == 0) { iStatus = 1; } else if (strcmp(sRank, "[Hptm]") == 0) { iStatus = 1; } else if (strcmp(sRank, "[Major]") == 0) { iStatus = 1; } else if (strcmp(sRank, "[Oberst]") == 0) { iStatus = 1; } else if (strcmp(sRank, "[BriGen]") == 0) { iStatus = 1; } else if (strcmp(sRank, "[GenMaj]") == 0) { iStatus = 1; } else if (strcmp(sRank, "[General]") == 0) { iStatus = 1; } if (iStatus == 1) { strcpy(NAMES[iID], sNameRest, MAX_NAME_LENGTH); } } return PLUGIN_CONTINUE; } cm_NameCheck2(iID) { new sNewName[MAX_NAME_LENGTH]; new sRank[MAX_RANK_LENGTH]; new sNameRest[MAX_NAME_LENGTH]; new dummy; new iWONID; new iStatus; new sCommand[MAX_DATA_LENGTH]; if (playerinfo(iID, sNewName, MAX_NAME_LENGTH, dummy, iWONID, dummy, dummy)) { strsep(sNewName, " ", sRank, MAX_RANK_LENGTH, sNameRest, MAX_NAME_LENGTH); ///////////////////////////// DEBUG START ////////////////////////////// #if DEBUG printf("^nDEBUG: -----------------------------^n"); printf("DEBUG: NameCheck2^n"); printf("DEBUG: iID:^t^t%d^n", iID); printf("DEBUG: sNewName:^t%s^n", sNewName); printf("DEBUG: sRank:^t^t%s^n", sRank); printf("DEBUG: sNameRest:^t%s^n", sNameRest); printf("DEBUG: -----------------------------^n"); #endif ////////////////////////////// DEBUG END /////////////////////////////// } if (iWONID != 0) { if (strcmp(sRank, "[Gren]") == 0) { if (strcmp(RANKS[iID], "[Gren]") == 0) { iStatus = 0; } else { iStatus = 1; } } else if (strcmp(sRank, "[OG]") == 0) { if (strcmp(RANKS[iID], "[OG]") == 0) { iStatus = 0; } else { iStatus = 1; } } else if (strcmp(sRank, "[HG]") == 0) { if (strcmp(RANKS[iID], "[HG]") == 0) { iStatus = 0; } else { iStatus = 1; } } else if (strcmp(sRank, "[U]") == 0) { if (strcmp(RANKS[iID], "[U]") == 0) { iStatus = 0; } else { iStatus = 1; } } else if (strcmp(sRank, "[Fw]") == 0) { if (strcmp(RANKS[iID], "[Fw]") == 0) { iStatus = 0; } else { iStatus = 1; } } else if (strcmp(sRank, "[OStFw]") == 0) { if (strcmp(RANKS[iID], "[OStFw]") == 0) { iStatus = 0; } else { iStatus = 1; } } else if (strcmp(sRank, "[Lt]") == 0) { if (strcmp(RANKS[iID], "[Lt]") == 0) { iStatus = 0; } else { iStatus = 1; } } else if (strcmp(sRank, "[Hptm]") == 0) { if (strcmp(RANKS[iID], "[Hptm]") == 0) { iStatus = 0; } else { iStatus = 1; } } else if (strcmp(sRank, "[Major]") == 0) { if (strcmp(RANKS[iID], "[Major]") == 0) { iStatus = 0; } else { iStatus = 1; } } else if (strcmp(sRank, "[Oberst]") == 0) { if (strcmp(RANKS[iID], "[Oberst]") == 0) { iStatus = 0; } else { iStatus = 1; } } else if (strcmp(sRank, "[BriGen]") == 0) { if (strcmp(RANKS[iID], "[BriGen]") == 0) { iStatus = 0; } else { iStatus = 1; } } else if (strcmp(sRank, "[GenMaj]") == 0) { if (strcmp(RANKS[iID], "[GenMaj]") == 0) { iStatus = 0; } else { iStatus = 1; } } else if (strcmp(sRank, "[General]") == 0) { if (strcmp(RANKS[iID], "[General]") == 0) { iStatus = 0; } else { iStatus = 1; } } else { iStatus = 2; } if (iStatus == 1) { strcpy(NAMES[iID], sNameRest, MAX_NAME_LENGTH); if (bRename == 1) { snprintf(sCommand,MAX_DATA_LENGTH,"name ^"%s %s^"", RANKS[iID], sNameRest); execclient(sNewName, sCommand); } } else if (iStatus == 2) { strcpy(NAMES[iID], sNewName, MAX_NAME_LENGTH); if (bRename == 1) { snprintf(sCommand,MAX_DATA_LENGTH,"name ^"%s %s^"", RANKS[iID], NAMES[iID]); execclient(sNewName, sCommand); } } } return PLUGIN_CONTINUE; } cm_SaveName(iID) { new sName[MAX_NAME_LENGTH]; new dummy; new iWONID; new sText[MAX_TEXT_LENGTH]; new sRank[MAX_RANK_LENGTH]; new sNameRest[MAX_NAME_LENGTH]; if (playerinfo(iID, sName, MAX_NAME_LENGTH, dummy, iWONID, dummy, dummy)) { if (bRename == 1) { strsep(sName, " ", sRank, MAX_RANK_LENGTH, sNameRest, MAX_NAME_LENGTH); snprintf(sText, MAX_TEXT_LENGTH, "%s^t%s^t%i", sNameRest, RANKS[iID], iWONID); } else { snprintf(sText, MAX_TEXT_LENGTH, "%s^t%s^t%i", sName, RANKS[iID], iWONID); } writefile(FILENAME, sText); snprintf(sText, MAX_TEXT_LENGTH, "CAREER: '%s' has been successfully updated", FILENAME); log(sText); ///////////////////////////// DEBUG START ////////////////////////////// #if DEBUG printf("^nDEBUG: -----------------------------^n"); printf("DEBUG: SaveName^n"); printf("DEBUG: sName:^t^t%s^n", sName); printf("DEBUG: sRank:^t^t%s^n", sRank); printf("DEBUG: sNameRest:^t%s^n", sNameRest); printf("DEBUG: RANKS[iID]:^t%s^n", RANKS[iID]); printf("DEBUG: iWONID:^t^t%d^n", iWONID); printf("DEBUG: -----------------------------^n"); #endif ////////////////////////////// DEBUG END /////////////////////////////// } } cm_CheckRank(iIDK, sKiller[]="", sRank[]="", sShortCut[]="", bBefoerderung) { new Text[MAX_TEXT_LENGTH]; new sCommand[MAX_DATA_LENGTH]; if (bBefoerderung == 1) { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum %s befoerdert", sKiller, sRank); cm_csgsay(Text, "up"); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^n%s befoerdert", sKiller, sRank); centersay(Text, SHOW_TIME, PROMO_R, PROMO_G, PROMO_B); } } else { if (bUseCSGSAY == 1) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum %s degradiert", sKiller, sRank); cm_csgsay(Text, "down"); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum^n%s degradiert", sKiller, sRank); centersay(Text, SHOW_TIME, DEGRA_R, DEGRA_G, DEGRA_B); } } strcpy(RANKS[iIDK], sShortCut, MAX_RANK_LENGTH); if (bRename == 1) { snprintf(sCommand,MAX_DATA_LENGTH,"name ^"%s %s^"", sRank, NAMES[iIDK]); execclient(sKiller, sCommand); } } cm_csgsay(sMessage[]="", sStatus[]="") { new sCommand[MAX_TEXT_LENGTH]; if (strcmp(sStatus, "up") == 0) { snprintf(sCommand,MAX_TEXT_LENGTH,"csg_sayformat ^"%s:%s:%s:-1:0.65:0:0.25:2:3.0:4.0^"", sCSG_PROMO_R, sCSG_PROMO_G, sCSG_PROMO_B); exec(sCommand); } else if (strcmp(sStatus, "down") == 0) { snprintf(sCommand,MAX_TEXT_LENGTH,"csg_sayformat ^"%s:%s:%s:-1:0.65:0:0.25:2:3.0:4.0^"", sCSG_DEGRA_R, sCSG_DEGRA_G, sCSG_DEGRA_B); exec(sCommand); } else { exec("csg_sayformat ^"255:255:255:-1:0.65:0:0.25:2:3.0:4.0^""); } snprintf(sCommand,MAX_TEXT_LENGTH,"csg_say ^"%s^"", sMessage); exec(sCommand); exec("exec ^"csguard\csg_color.cfg^""); return PLUGIN_HANDLED; } cm_initialize() { new sData[2]; new iData; new sData2[2]; new iData2; new sData3[2]; new iData3; if (get_vaultdata("career_mode", sData, 2) == 1) { iData = strtonum(sData); ///////////////////////////// DEBUG START ////////////////////////////// #if DEBUG printf("^nDEBUG: -----------------------------^n"); printf("DEBUG: Vault.ini - career_mode^n"); printf("DEBUG: (String):^t%s^n", sData); printf("DEBUG: (Integer):^t%d^n", iData); printf("DEBUG: -----------------------------^n"); #endif ////////////////////////////// DEBUG END /////////////////////////////// if (iData == 1) { bEnabled = 1; } else { bEnabled = 0; } } else { bEnabled = 0; } if (get_vaultdata("career_usecsgsay", sData2, 2) == 1) { iData2 = strtonum(sData2); ///////////////////////////// DEBUG START ////////////////////////////// #if DEBUG printf("^nDEBUG: -----------------------------^n"); printf("DEBUG: Vault.ini - career_usecsgsay^n"); printf("DEBUG: (String):^t%s^n", sData2); printf("DEBUG: (Integer):^t%d^n", iData2); printf("DEBUG: -----------------------------^n"); #endif ////////////////////////////// DEBUG END /////////////////////////////// if (iData2 == 1) { bUseCSGSAY = 1; } else { bUseCSGSAY = 0; } } else { bUseCSGSAY = 0; } if (get_vaultdata("career_rename", sData3, 2) == 1) { iData3 = strtonum(sData3); ///////////////////////////// DEBUG START ////////////////////////////// #if DEBUG printf("^nDEBUG: -----------------------------^n"); printf("DEBUG: Vault.ini - career_rename^n"); printf("DEBUG: (String):^t%s^n", sData3); printf("DEBUG: (Integer):^t%d^n", iData3); printf("DEBUG: -----------------------------^n"); #endif ////////////////////////////// DEBUG END /////////////////////////////// if (iData3 == 0) { bRename = 0; } else { bRename = 1; } } else { bRename = 1; } } public plugin_connect(HLUserName, HLIP, UserIndex) { new sHLUserName[MAX_TEXT_LENGTH]; convert_string(HLUserName,sHLUserName,MAX_DATA_LENGTH); if (UserIndex >= 1 && UserIndex <= MAX_PLAYERS) { KILLS[UserIndex] = CLEAN_SLATE; strcpy(NAMES[UserIndex], sHLUserName, MAX_NAME_LENGTH); strcpy(RANKS[UserIndex], "[Gren]", MAX_RANK_LENGTH); } return PLUGIN_CONTINUE; } public plugin_disconnect(HLUserName, UserIndex) { if (UserIndex >= 1 && UserIndex <= MAX_PLAYERS) { KILLS[UserIndex] = CLEAN_SLATE; } return PLUGIN_CONTINUE; } public plugin_init() { plugin_registerinfo("Career Plugin by Rizla and Biohazard","Work your way up.",STRING_VERSION); plugin_registercmd("cm_HandleKill", "cm_HandleKill", ACCESS_CONSOLE); plugin_registercmd("cm_HandleEnterGame", "cm_HandleEnterGame", ACCESS_CONSOLE); plugin_registercmd("cm_HandleNameChange", "cm_HandleNameChange", ACCESS_CONSOLE); plugin_registercmd("cm_HandleWorld", "cm_HandleWorld", ACCESS_CONSOLE); // plugin_registercmd("cm_HandleTeamSelect", "cm_HandleTeamSelect", ACCESS_CONSOLE); // plugin_registercmd("cm_HandleSuicide", "cm_HandleSuicide", ACCESS_CONSOLE); plugin_registercmd("admin_career","admin_career",ACCESS_CAREER,"admin_career 1/0: Turns Career Mode on or off."); exec("logd_reg 57 admin_command cm_HandleKill"); // Kill exec("logd_reg 51 admin_command cm_HandleEnterGame"); // Enter Game exec("logd_reg 56 admin_command cm_HandleNameChange"); // Change Name exec("logd_reg 62 admin_command cm_HandleWorld"); // World Action // exec("logd_reg 54 admin_command cm_HandleTeamSelect"); // Change Team // exec("logd_reg 53 admin_command cm_HandleSuicide"); // Suicide cm_initialize(); return PLUGIN_CONTINUE; }Wir werden bald noch einige Dinge in Bezug auf die Speicherung der Namen ändern und die neue Version dann auf unseren HPs zum Download anbieten. Bio |
Autor: | [WING] Black Knight [ 30.05.2002, 17:43 ] |
Betreff des Beitrags: | |
Hey, hey, hey! Da ist ja Werbung für uns drin. Schönen Dank! Euer Plugin ist aber auch ne schicke Idee! |
Autor: | MrClone [ 30.05.2002, 17:54 ] |
Betreff des Beitrags: | |
Ich will nicht rummeckern aber mindestens 3 Sachen stören mich! 1. außer der Abfrage ||if (bUseCSGSAY == 1)|| solltest du noch die Abfrage ||if (bUseCSGSAY == 2)|| machen, die 2 für HLGuard!! Also: Code: if (bUseCSGSAY == 2) { snprintf(Text, MAX_TEXT_LENGTH, "%s wurde zum %s befoerdert", sKiller, sRank); cm_hlgsay(Text, "up"); ...<< cm_HLgsay!!! 2. Du hast weiter oben Code: cm_CheckRank(iIDK, sKiller, "Obergefreiter", "[OG]", bBefoerderung);stehen, wenn du das aber so schreibst kommt als message "Killer wurde zum Obergefreiter befördert" das sollte aber Obergefreiten heißen! Und bei hauptgefreiter auch! 3. statt Code: exec("exec ^"csguard\csg_color.cfg^"");kannst du auch Code: new CSGDATA[MAX_NAME_LENGTH]; new CSGNFORM[MAX_NAME_LENGTH]; getstrvar("csg_sayformat",CSGDATA,MAX_DATA_LENGTH); snprintf(CSGNFORM, MAX_TEXT_LENGTH,"csg_sayformat ^"%s^"",CSGDATA); exec(CSGNFORM);machen, da viele keine csg_color.cfg haben! und das gleiche für hlguard! getstrvar muss natürlich weiter oben stehen, bevor csg_sayformat geändert wird! |
Autor: | rizla [ 03.06.2002, 14:11 ] |
Betreff des Beitrags: | |
gute vorschläge mrclone! also so wie ich bio kenne wird er schon an der umsetzung arbeiten! und dann bald die neue version vorstellen! rizla ps: habt ihr vielleicht noch vorschläge was man noch so einbauen könnte in das plugin? |
Autor: | MrClone [ 03.06.2002, 15:16 ] |
Betreff des Beitrags: | |
Zitat:
ps: habt ihr vielleicht noch vorschläge was man noch so einbauen könnte in das plugin?
Ja, ein zweite methode einbauen, das man schon bei Obergefreiter in die Datei geschrieben wird, aber dafür die Verteilung etwa so aussieht
Code: #define RANK1 1 // Grenadier #define RANK2 13 // Obergefreiter #define RANK3 24 // Hauptgefreiter #define RANK4 47 // Unteroffizier #define RANK13 1252 // Generaldas man also eine fast lebenslange Kariere auf einem Server hat!! |
Seite 1 von 3 | Alle Zeiten sind UTC+01:00 |
Powered by phpBB® Forum Software © phpBB Limited https://www.phpbb.com/ |