Ein neues Thema erstellen  Auf das Thema antworten  [ 7 Beiträge ] 
Autor Nachricht
 Betreff des Beitrags: plugin_jack9_chime
BeitragVerfasst: 30.06.2002, 17:28 

Registriert: 10.05.2002, 15:30
Beiträge: 7
Also ich habe ein Problem mit diesem Plugin, es sollte eigentlich jede halbe Stund mit der HL-Stimme die Zeit ausgeben, doch als ich die .sma compilieren wollte, kan dieser Error:
Code:
plugin_jack9_chime_silent.sma(285) Warning [217]: loose indentation
plugin_jack9_chime_silent.sma(285) Error [29]: invalid expression, assumed zero
plugin_jack9_chime_silent.sma(287) Error [1]: expected token: "}", but found "new"
plugin_jack9_chime_silent.sma(359) Warning [204]: symbol is assigned a value that is never used: "Target"
plugin_jack9_chime_silent.sma(359) Warning [203]: symbol is never used: "SessionID"
plugin_jack9_chime_silent.sma(359) Warning [203]: symbol is never used: "WONID"
plugin_jack9_chime_silent.sma(359) Warning [203]: symbol is never used: "Team"
plugin_jack9_chime_silent.sma(359) Warning [204]: symbol is assigned a value that is never used: "maxplayers"
plugin_jack9_chime_silent.sma(359) Warning [203]: symbol is never used: "i"
plugin_jack9_chime_silent.sma(359) Warning [204]: symbol is assigned a value that is never used: "OUTSTRING"
Und hier noch mal die .sma, ich hoffe einer kann mir helfen!!!
Code:
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>

new STRING_VERSION[MAX_DATA_LENGTH] = "2.50.0";
new THour[MAX_DATA_LENGTH];
new TMinute[MAX_DATA_LENGTH];
new TValue[MAX_DATA_LENGTH];
new TWDay[MAX_DATA_LENGTH];
new TMonth[MAX_DATA_LENGTH];
new TDay[MAX_DATA_LENGTH];
new TYear[MAX_DATA_LENGTH];

/* Used to determine if a vocal message has been used in the last
   "arbitrary" amount of time, primarily to prevent overlaps.
*/
new iDelay = 0;

public strnsplit(a[],b[],n,m){
	new i;
	for(i=n;i<=m;i++) 
		a[i-n]=b[i];
	return 1;
}

/* The all important function */
public SpeakTime(WithSpeech){

/* Check for overlap */
	if (systemtime() > iDelay) {
		iDelay = systemtime() + 60;
	} else {
		return;
	}

	new OUTSTRING[300];
	new words[5][30];
	new PlaceHolder[MAX_DATA_LENGTH];
	new i;
	new maxplayers = maxplayercount();
	new Team;
	new WONID;
	new SessionID;
	new Target[MAX_NAME_LENGTH];
	new Text[MAX_DATA_LENGTH];
	
/* Get all the digits of the time. This is a BAD way to do it.
   Since while you are getting all these values, others could change,
   like trying to get all these values at 11:59:59 would cause bad
   data...should have gotten the time once and split it. If this was for
   money, I would do it, but a plugin is really not that important.
*/

/* Method did all this. */
	servertime(THour, MAX_DATA_LENGTH, "%I");
	servertime(TMinute, MAX_DATA_LENGTH, "%M");
	servertime(TValue, MAX_DATA_LENGTH, "%p");
	servertime(TWDay, MAX_DATA_LENGTH, "%A");
	servertime(TMonth, MAX_DATA_LENGTH, "%B");
	servertime(TDay, MAX_DATA_LENGTH, "%d");
	servertime(TYear, MAX_DATA_LENGTH, "%Y");
		
	if(streq(THour, "12")==1) {
strncpy(words[1], "twelve ", strlen("twelve "),MAX_DATA_LENGTH);
	}
	if(streq(THour, "11")==1) {
		strncpy(words[1], "eleven ", strlen("eleven "),MAX_DATA_LENGTH);
	}
	if(streq(THour, "10")==1) {
		strncpy(words[1], "ten ", strlen("ten "),MAX_DATA_LENGTH);
	}
	if(streq(THour, "09")==1) {
		strncpy(words[1], "nine ", strlen("nine "),MAX_DATA_LENGTH);
	}
	if(streq(THour, "08")==1) {
		strncpy(words[1], "eight ", strlen("eight "),MAX_DATA_LENGTH);
	}
	if(streq(THour, "07")==1) {
		strncpy(words[1], "seven ", strlen("seven "),MAX_DATA_LENGTH);
	}
	if(streq(THour, "06")==1) {
		strncpy(words[1], "six ", strlen("six "),MAX_DATA_LENGTH);
	}
	if(streq(THour, "05")==1) {
		strncpy(words[1], "five ", strlen("five "),MAX_DATA_LENGTH);
	}
	if(streq(THour, "04")==1) {
		strncpy(words[1], "four ", strlen("four "),MAX_DATA_LENGTH);
	}
	if(streq(THour, "03")==1) {
		strncpy(words[1], "three ", strlen("three "),MAX_DATA_LENGTH);
	}
	if(streq(THour, "02")==1) {
		strncpy(words[1], "two ", strlen("two "),MAX_DATA_LENGTH);
	}
	if(streq(THour, "01")==1) {
		strncpy(words[1], "one ", strlen("one "),MAX_DATA_LENGTH);
	}
	strnsplit(PlaceHolder, TMinute, 0, 1);
	if(PlaceHolder[0] == '1') {
		strnsplit(PlaceHolder, TMinute, 1, 2);
		if(PlaceHolder[0] == '0') {
			strncpy(words[2], "ten ", strlen("ten "),MAX_DATA_LENGTH);
		}
		if(PlaceHolder[0] == '1') {
			strncpy(words[2], "eleven ", strlen("eleven "),MAX_DATA_LENGTH);
		}
		if(PlaceHolder[0] == '2') {
			strncpy(words[2], "twelve ", strlen("twelve "),MAX_DATA_LENGTH);
		}	
		if(PlaceHolder[0] == '3') {
			strncpy(words[2], "thirteen ", strlen("thirteen "),MAX_DATA_LENGTH);
		}
		if(PlaceHolder[0] == '4') {
			strncpy(words[2], "fourteen ", strlen("fourteen "),MAX_DATA_LENGTH);
		}
		if(PlaceHolder[0] == '5') {
			strncpy(words[2], "fifteen ", strlen("fifteen "),MAX_DATA_LENGTH);
		}
		if(PlaceHolder[0] == '6') {
			strncpy(words[2], "sixteen ", strlen("sixteen "),MAX_DATA_LENGTH);
		}
		if(PlaceHolder[0] == '7') {
			strncpy(words[2], "seventeen ", strlen("seventeen "),MAX_DATA_LENGTH);
		}
		if(PlaceHolder[0] == '8') {
			strncpy(words[2], "eighteen ", strlen("eighteen "),MAX_DATA_LENGTH);
		}
		if(PlaceHolder[0] == '9') {
			strncpy(words[2], "nineteen ", strlen("nineteen "),MAX_DATA_LENGTH);
		}
	}else{	
		strnsplit(PlaceHolder, TMinute, 0, 2);
		if(PlaceHolder[0] == '2') {
			strncpy(words[2], "twenty ", strlen("twenty "),MAX_DATA_LENGTH);
		}
		if(PlaceHolder[0] == '3') {
			strncpy(words[2], "thirty ", strlen("thirty "),MAX_DATA_LENGTH);
		}
		if(PlaceHolder[0] == '4') {
			strncpy(words[2], "fourty ", strlen("fourty "),MAX_DATA_LENGTH);
		}
		if(PlaceHolder[0] == '5') {
			strncpy(words[2], "fifty ", strlen("fifty "),MAX_DATA_LENGTH);
		}else{
			if ( (PlaceHolder[0] == '0') && (PlaceHolder[1] != '0') ) {
		                strncpy(words[2], "boop ", strlen("boop "),MAX_DATA_LENGTH);
		        }                                                                    
		}
		strnsplit(PlaceHolder, TMinute, 1, 2);
		if(PlaceHolder[0] == '1') {
			strncpy(words[3], "one ", strlen("one "),MAX_DATA_LENGTH);
		}
		if(PlaceHolder[0] == '2') {
			strncpy(words[3], "two ", strlen("two "),MAX_DATA_LENGTH);
		}
		if(PlaceHolder[0] == '3') {
			strncpy(words[3], "three ", strlen("three "),MAX_DATA_LENGTH);
		}
		if(PlaceHolder[0] == '4') {
			strncpy(words[3], "four ", strlen("four "),MAX_DATA_LENGTH);
		}
		if(PlaceHolder[0] == '5') {
			strncpy(words[3], "five ", strlen("five "),MAX_DATA_LENGTH);
		}
		if(PlaceHolder[0] == '6') {
			strncpy(words[3], "six ", strlen("six "),MAX_DATA_LENGTH);
		}
		if(PlaceHolder[0] == '7') {
			strncpy(words[3], "seven ", strlen("seven "),MAX_DATA_LENGTH);
		}
		if(PlaceHolder[0] == '8') {
			strncpy(words[3], "eight ", strlen("eight "),MAX_DATA_LENGTH);
		}
		if(PlaceHolder[0] == '9') {
			strncpy(words[3], "nine ", strlen("nine "),MAX_DATA_LENGTH);
		}
	}
	if(streq(TValue, "AM")==1) {
		strncpy(words[4], "am", strlen("am"),MAX_DATA_LENGTH);
	}
	if(streq(TValue, "PM")==1) {
		strncpy(words[4], "pm", strlen("pm"),MAX_DATA_LENGTH);
	}

/* With all this uncertainty regarding systemtime() and the actual time, if
   2 was passed to SpeakTime(), then I WANT IT TO SAY IT'S 4:20, regardless.
*/	
	if (WithSpeech == 2) {
/*		snprintf(OUTSTRING, MAX_DATA_LENGTH, "speak ^"the time is now 4:20 up in the west side^"", words[1], words[2], words[3]);
		for(i=1; i<=maxplayers; i++) {
			strinit(Target);
			if(playerinfo(i,Target,MAX_NAME_LENGTH,SessionID,WONID,Team)==1) {
				execclient(Target,OUTSTRING);
			}
		}
*/
	}
/* end of Method's code */
	
/* The adminmod forums are next to useless. Female voice is done using
   fvox/  - and the forum denizens said it couldnt be done. Morons.
*/
	if (WithSpeech == 1) {
/*		snprintf(OUTSTRING, MAX_DATA_LENGTH, "speak ^"fvox/bell time_is_now %s%s%s%s^"", words[1], words[2], words[3], words[4]);
		for(i=1; i<=maxplayers; i++) {
			strinit(Target);
			if(playerinfo(i,Target,MAX_NAME_LENGTH,SessionID,WONID,Team)==1) {
				execclient(Target,OUTSTRING);
			}
		}
	}
*/	
	snprintf(Text, MAX_TEXT_LENGTH, "[ Current Server Time: %s:%s %s ]", THour, TMinute, TValue);
	say(Text);
	snprintf(Text, MAX_TEXT_LENGTH, "[ %s, %s %s %s ]", TWDay, TMonth, TDay, TYear);
	say(Text);
}

/* For recognizing partial matched strings in player messages in game  */
/*
public HandleSay(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_LENGTH];
	new User[MAX_NAME_LENGTH];
	
	convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
	convert_string(HLData,Data,MAX_DATA_LENGTH);
	convert_string(HLUserName,User,MAX_NAME_LENGTH);

	strstripquotes(Data);
        if ( (strcasestr(Data, "chime") != -1) && (strcasestr(Data, "test") != -1) ) { 
		if(systemtime() < iDelay){
			return PLUGIN_CONTINUE;
  		} else {
			SpeakTime(1);
			iDelay = systemtime();
			iDelay += 60;
		}
	}
        if ( (strcasestr(Data, "chim2") != -1) && (strcasestr(Data, "est") != -1) ) { 
                if (systemtime() < iDelay) {                                         
			SpeakTime(0);
			return PLUGIN_CONTINUE;
  		} else {
			SpeakTime(2);
			iDelay = systemtime();
			iDelay += 60;
		}
	}
	return PLUGIN_CONTINUE;
}
*/

public chime_check()
{
	new Hour_dec[MAX_DATA_LENGTH];
	new Minute_dec[MAX_DATA_LENGTH];
	
/* Hour in decimal 00-12 including 01-09 for singles */
	servertime(Hour_dec, MAX_DATA_LENGTH, "%I");	
/* Minute in decimal of course 00-59 */
	servertime(Minute_dec, MAX_DATA_LENGTH, "%M");

/*	Bah, old code that I used for testing. Bad way to do it anyway. */	
/*	if(streq(Minute_dec,"00")==1) {
		if(streq(Hour_dec, "01")==1) {
			SpeakTime(1);
		}
		if(streq(Hour_dec, "02")==1) {
			SpeakTime(1);
		}
		if(streq(Hour_dec, "03")==1) {
			SpeakTime(1);
		}
		if(streq(Hour_dec, "04")==1) {
			SpeakTime(1);
		}
		if(streq(Hour_dec, "05")==1) {
			SpeakTime(1);
		}
		if(streq(Hour_dec, "06")==1) {
			SpeakTime(1);
		}
		if(streq(Hour_dec, "07")==1) {
			SpeakTime(1);
		}
		if(streq(Hour_dec, "08")==1) {
			SpeakTime(1);
		}
		if(streq(Hour_dec, "09")==1) {
			SpeakTime(1);
		}
		if(streq(Hour_dec, "10")==1) {
			SpeakTime(1);
		}
		if(streq(Hour_dec, "11")==1) {
			SpeakTime(1);
		}
		if(streq(Hour_dec, "12")==1) {
			SpeakTime(1);
		}
	}
*/

/* 420 is the police code in California, USA (only?) used to indicate
   an arrest for marijuana possesion. Therefore, 4:20am/pm is a
   recognized "important" time for many ppl as a symbolic cultural thing.
   You can of course just edit line number 220 (or about there depending
   on how you edit this filefrom "west" to "east" for your server if
   it's more appropriate. If I wanted to be 'cool', I would have made it
   line 420 :p
*/

/* If the minute is 20, then test if hour is 4 */
	if(streq(Minute_dec, "20")==1){
		if(streq(Hour_dec, "04")==1){
			SpeakTime(2);
		}
	}

/* Announce time every 30 min */
	if(streq(Minute_dec, "30")==1){
		SpeakTime(1);
	}
	if(streq(Minute_dec, "00")==1){
		SpeakTime(1);
	}
} 

/* Since I've never coded a plugin before, I assume this is necessary as a 
   default starting function, like 'public main(){}' in C/C++
*/
public plugin_init(){
	plugin_registerinfo("Server Chime Plugin", "Speaks server time every hour or so.", STRING_VERSION);

/* Only needed for testing using "said" triggers */
/*
	plugin_registercmd("say", "HandleSay", ACCESS_ALL);
*/

/* Using 60 second intervals does not work with a large number of plugins
   on slower computers or computer with 64 megs or less of ram.
   iDelay prevents overlaps.
*/ 
	set_timer("chime_check",45,999999);
	return PLUGIN_CONTINUE;
}				
MfG, schade das DEUTSCHLAND kein Weltmeister geworden ist.

_________________
www.bpclan.de


Nach oben
   
 Betreff des Beitrags: Re: plugin_jack9_chime
BeitragVerfasst: 30.06.2002, 17:57 
HLDS Team
Benutzeravatar

Registriert: 26.11.2001, 01:00
Beiträge: 676
Bin jetzt zu faul zum suchen, aber der sagt z.b. das du ein } zu wenig hast, außerdem wenn du nur eine zeile auskommentieren willst kannst davor auch einfach // schreiben!


Nach oben
   
 Betreff des Beitrags:
BeitragVerfasst: 01.07.2002, 14:42 
AM.de Team
Benutzeravatar

Registriert: 27.11.2001, 01:00
Beiträge: 3564
Wohnort: In der Nähe von Bonn
hm...das // gab bei Linux glaube ich Probleme...

_________________
Fehleranalyse: Poste den Inhalt Deiner liblist.gam, (listen)server.cfg, adminmod.cfg, users.ini, vault.ini, plugin.ini von adminmod und plugins.ini von metamod. Benutze auch die Such-Funktion


Nach oben
   
 Betreff des Beitrags:
BeitragVerfasst: 01.07.2002, 16:23 

Registriert: 17.12.2001, 01:00
Beiträge: 697
Ähhh, nein.


Nach oben
   
 Betreff des Beitrags:
BeitragVerfasst: 01.07.2002, 16:33 
AM.de Team
Benutzeravatar

Registriert: 23.11.2001, 00:00
Beiträge: 3842
Wohnort: Vor König Arthus
Äh, doch.
Ob dem immer noch so ist, kann ich nicht sagen, aber dass es mal damit Probleme gab kann ich nur bestätigen. Betonung sollte daher auf "gab" liegen. So gesehen keine Falschinformation. :wink:

_________________
Der schwarze Ritter triumphiert immer...
WING-Clan


Nach oben
   
 Betreff des Beitrags: Na toll
BeitragVerfasst: 01.07.2002, 18:47 

Registriert: 10.05.2002, 15:30
Beiträge: 7
Ich brauch dafür Hilfe und bitte nicht, ob das Problem gab!!

Thx

_________________
www.bpclan.de


Nach oben
   
 Betreff des Beitrags:
BeitragVerfasst: 01.07.2002, 21:17 
AM.de Team
Benutzeravatar

Registriert: 23.11.2001, 00:00
Beiträge: 3842
Wohnort: Vor König Arthus
Hab mal alle Kommentarzeilen rausgeschmissen und die Warnings entfernt. Compiler läuft nun durch. Aber für die Funktionalität des Plugins übernehme ich keine Gewähr. Nicht getestet.

_________________
Der schwarze Ritter triumphiert immer...
WING-Clan


Nach oben
   
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen  Auf das Thema antworten  [ 7 Beiträge ] 


Du darfst keine neuen Themen in diesem Forum erstellen.
Du darfst keine Antworten zu Themen in diesem Forum erstellen.
Du darfst deine Beiträge in diesem Forum nicht ändern.
Du darfst deine Beiträge in diesem Forum nicht löschen.
Du darfst keine Dateianhänge in diesem Forum erstellen.

Suche nach:
Powered by phpBB® Forum Software © phpBB Limited
Deutsche Übersetzung durch phpBB.de
Original Design von "[ Half-Life Admin Mod © Alfred Reynolds 2000-2003 ] - [ site design by Jägermeister ]"