Registriert: 01.11.2002, 13:22 Beiträge: 7
|
Hehe, mist, hätte ich das mal eher gelesen, denn jetzt bi ich schon selbst drauf gekommen  aber ich danke dir, Lessie!
allerdings habe ich jetzt auch schon das nächste Problem. Und zwar bekomme ich folgende Fehlermeldung beim Kompilieren:
plugin_consgreet.sma(60) Error [25]: function heading differs from prototype
Das heißt wohl, das in Zeile 60 ein Fehler vorliegt. Alelrdings habe ich nicht wirklich etwas verändert, was dem zu Grunde liegen könnte, wie mir scheint. Ich hab die entsprechende Zeile unten hervorgehoben...
/* $Id: plugin_consgreet.sma,v 1.0.0.5 04/01/01 10:36:20 Ascad Exp $ */
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
new STRING_VERSION[MAX_DATA_LENGTH] = "1.0.0.5";
addstr(strBegin[],strEnd[]) {
new i=0;
new Length = strlen(strEnd);
new j;
while(strBegin !=0) i++;
for(j=0;j<Length;j++)
strBegin[i+j]=strEnd[j];
/* Null-terminate the string. */
strBegin[i+j] = NULL_CHAR;
}
public NumToStr(num,str[])
{
new Base = 1;
new Digits = 1;
new i = 0;
/* Special case: 0 */
if (num == 0) {
str[i++] = ´0´;
str[i++] = NULL_CHAR;
} else {
/* If we´ve got a negative number, add a negative sign
to the string, and multiply the number by -1 */
if (num < 0) {
str[i++] = ´-´;
num *= -1;
}
/* Ok. We´ve got at least one digit. Keep multiplying by
10 till we get a higher number than what we´ve got. Note
that this will leave Digits 1 higher than what we want (eg,
if Num was 7, Digits will be 2 */
while (Base <= num) {
Base *= 10;
Digits++;
}
/* Because Digits is higher, use --Digits rather than Digits--.
Also, divide Base before using it. */
while (--Digits > 0) {
Base /= 10;
str[i++] = ´0´ + (num - (num % Base)) / Base;
num = num % Base;
}
str[i++] = NULL_CHAR;
}
}
public plugin_connect(HLName,HLIP,UserIndex) {
new strName[MAX_NAME_LENGTH],strIP[MAX_DATA_LENGTH];
new strSeconds[MAX_NUMBER_LENGTH];
new strNumber[MAX_NUMBER_LENGTH];
new NextMap[MAX_NAME_LENGTH];
nextmap(NextMap,MAX_NAME_LENGTH);
new conmsg[MAX_TEXT_LENGTH];
new host[MAX_TEXT_LENGTH];
new CurrentMap[MAX_NAME_LENGTH];
new Seconds = timeleft(0);
new numPlayers = playercount();
new numMaxPlayers = maxplayercount();
Seconds /= 60;
NumToStr(Seconds, strSeconds);
currentmap(CurrentMap,MAX_NAME_LENGTH);
getstrvar("hostname",host,MAX_TEXT_LENGTH);
convert_string(HLName, strName,MAX_NAME_LENGTH);
convert_string(HLIP,strIP,MAX_DATA_LENGTH);
/* Stuff to do to the client as they connect */
consgreet("");
consgreet("");
consgreet("");
consgreet("");
consgreet("");
consgreet("");
consgreet("");
consgreet("");
consgreet("");
consgreet("");
consgreet("");
consgreet("");
consgreet("");
consgreet("");
consgreet("");
consgreet("");
consgreet("------------------Something to read for now---------------------");
consgreet("");
consgreet("================================================================");
addstr(conmsg,"Hallo, ");
addstr(conmsg,strName);
addstr(conmsg,", Willkommen auf dem: ");
addstr(conmsg,host);
consgreet("");
consgreet(conmsg);
conmsg = "";
addstr(conmsg,"Deine Ip lautet: ");
addstr(conmsg,strIP);
consgreet(conmsg);
conmsg = "";
consgreet("================================================================");
addstr(conmsg,"Dieser Server benutzt AdminMod v25026a");
consgreet(conmsg);
conmsg = "";
consgreet("================================================================");
consgreet("");
consgreet("url : [url]http://www.headshotcrew.net"[/url] ;
consgreet("");
consgreet("mail: server@headshotcrew.net");
consgreet("================================================================");
consgreet("-------------------------Aktuelle Infos-------------------------");
conmsg = "";
addstr(conmsg,"Aktuelle Map: ");
addstr(conmsg,CurrentMap);
consgreet(conmsg);
conmsg = "";
addstr(conmsg,"Verbleibende Zeit: ");
addstr(conmsg,strSeconds);
addstr(conmsg," Minutes");
consgreet(conmsg);
conmsg = "";
addstr(conmsg,"Naechste Map: ");
addstr(conmsg,NextMap);
consgreet(conmsg);
conmsg = "";
addstr(conmsg, "Aktuelle Spieleranzahl: ");
NumToStr(numPlayers, strNumber);
addstr(conmsg, strNumber);
addstr(conmsg, " / ");
NumToStr(numMaxPlayers, strNumber);
addstr(conmsg, strNumber);
consgreet(conmsg);
consgreet("");
conmsg = "";
consgreet("================================================================");
consgreet("-------------------------Server-Regeln--------------------------");
consgreet("consgreet.txt");
consgreet("");
consgreet("");
consgreet("---------------G-O-O-D--L-U-C-K--&--H-A-V-E--F-U-N--------------");
consgreet("");
consgreet("");
consgreet("");
return PLUGIN_CONTINUE;
}
public plugin_init() {
plugin_registerinfo("Ascad´s consgreet","Shows message on connect.",STRING_VERSION);
return PLUGIN_CONTINUE;
}
Hier nun as Original:
/* $Id: plugin_consgreet.sma,v 1.0.0.5 04/01/01 10:36:20 Ascad Exp $ */
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
new STRING_VERSION[MAX_DATA_LENGTH] = "1.0.0.5";
addstr(strBegin[],strEnd[]) {
new i=0;
new Length = strlen(strEnd);
new j;
while(strBegin!=0) i++;
for(j=0;j<Length;j++)
strBegin[i+j]=strEnd[j];
/* Null-terminate the string. */
strBegin[i+j] = NULL_CHAR;
}
public NumToStr(num,str[])
{
new Base = 1;
new Digits = 1;
new i = 0;
/* Special case: 0 */
if (num == 0) {
str[i++] = ´0´;
str[i++] = NULL_CHAR;
} else {
/* If we´ve got a negative number, add a negative sign
to the string, and multiply the number by -1 */
if (num < 0) {
str[i++] = ´-´;
num *= -1;
}
/* Ok. We´ve got at least one digit. Keep multiplying by
10 till we get a higher number than what we´ve got. Note
that this will leave Digits 1 higher than what we want (eg,
if Num was 7, Digits will be 2 */
while (Base <= num) {
Base *= 10;
Digits++;
}
/* Because Digits is higher, use --Digits rather than Digits--.
Also, divide Base before using it. */
while (--Digits > 0) {
Base /= 10;
str[i++] = ´0´ + (num - (num % Base)) / Base;
num = num % Base;
}
str[i++] = NULL_CHAR;
}
}
public plugin_connect(HLName,HLIP,UserIndex) {
new strName[MAX_NAME_LENGTH],strIP[MAX_DATA_LENGTH];
new strSeconds[MAX_NUMBER_LENGTH];
new strNumber[MAX_NUMBER_LENGTH];
new NextMap[MAX_NAME_LENGTH];
nextmap(NextMap,MAX_NAME_LENGTH);
new conmsg[MAX_TEXT_LENGTH];
new host[MAX_TEXT_LENGTH];
new CurrentMap[MAX_NAME_LENGTH];
new Seconds = timeleft(0);
new numPlayers = playercount();
new numMaxPlayers = maxplayercount();
Seconds /= 60;
NumToStr(Seconds, strSeconds);
currentmap(CurrentMap,MAX_NAME_LENGTH);
getstrvar("hostname",host,MAX_TEXT_LENGTH);
convert_string(HLName, strName,MAX_NAME_LENGTH);
convert_string(HLIP,strIP,MAX_DATA_LENGTH);
/* Stuff to do to the client as they connect */
consgreet("");
consgreet("");
consgreet("");
consgreet("");
consgreet("");
consgreet("");
consgreet("");
consgreet("");
consgreet("");
consgreet("");
consgreet("");
consgreet("");
consgreet("");
consgreet("");
consgreet("");
consgreet("");
consgreet("------------------Something to read for now---------------------");
consgreet("");
consgreet("================================================================");
addstr(conmsg,"Hello, ");
addstr(conmsg,strName);
addstr(conmsg,", Welcome to ");
addstr(conmsg,host);
consgreet("");
consgreet(conmsg);
conmsg = "";
addstr(conmsg,"Your ip address is: ");
addstr(conmsg,strIP);
consgreet(conmsg);
conmsg = "";
consgreet("================================================================");
addstr(conmsg,"This server is running Admin-Mod with multiple Plugins");
consgreet(conmsg);
conmsg = "";
consgreet("");
consgreet("");
consgreet("If you have any problems with this server, contact the admin");
consgreet("or visit http://www.adminmod.de!");
consgreet("================================================================");
consgreet("--------------------------Current info--------------------------");
conmsg = "";
addstr(conmsg,"The current map is: ");
addstr(conmsg,CurrentMap);
consgreet(conmsg);
conmsg = "";
addstr(conmsg,"Time remaining on map is: ");
addstr(conmsg,strSeconds);
addstr(conmsg," Minutes");
consgreet(conmsg);
conmsg = "";
addstr(conmsg,"The next map in the mapcycle is: ");
addstr(conmsg,NextMap);
consgreet(conmsg);
conmsg = "";
addstr(conmsg, "The current playercount is: ");
NumToStr(numPlayers, strNumber);
addstr(conmsg, strNumber);
addstr(conmsg, " / ");
NumToStr(numMaxPlayers, strNumber);
addstr(conmsg, strNumber);
consgreet(conmsg);
consgreet("");
conmsg = "";
consgreet("================================================================");
consgreet("-------------------------server stuff---------------------------");
consgreet("consgreet.txt");
consgreet("");
consgreet("================================================================");
consgreet("-----------------------------MOTD-------------------------------");
consgreet("motd.txt");
consgreet("");
consgreet("================================================================");
consgreet("");
consgreet("");
consgreet("--------------------Now just wait to get connected--------------------");
consgreet("");
consgreet("");
consgreet("");
return PLUGIN_CONTINUE;
}
public plugin_init() {
plugin_registerinfo("Ascad´s consgreet","Shows message on connect.",STRING_VERSION);
return PLUGIN_CONTINUE;
}
Im Prinzip habe ich nur übersetzt ...
Freundliche Grüße! - Micha
|
|