AdminMod.de
https://www.adminmod.de/

plugin_logd_soul_killstreak.sma
https://www.adminmod.de/viewtopic.php?t=9732
Seite 1 von 1

Autor:  Ithron [ 13.02.2006, 19:08 ]
Betreff des Beitrags:  plugin_logd_soul_killstreak.sma

Hallo..

ich wollte an meinem plugin ein bisschen rumbasteln... udn zwar das nach godlike noch holy shit kommt...

hab das ganze so angepasst:
Code:
/*
 * Killstreak v1.0beta (May 19th, 2002)
 *
 * Author: <[NN]>Soul (sefanja_severin@hotmail.com, http://nn.kicks-ass.net/)
 * (Ideas and code borrowed from Bud-froggy Productions®, all honor to him ;)
 *
 * Announces killstreaks: multi kill, ultra kill, killing spree, monster kill, godlike and holy shit.
 *
 *
 *
 * IMPORTANT:
 * Place the .wav files in %mod%/lan/misc.
 * Add these lines to all your .res files in the %mod%/maps folder:
 *
 *   sound/lan/multikill.wav
 *   sound/lan/ultrakill.wav
 *   sound/lan/killingspree.wav
 *   sound/lan/monsterkill.wav
 *   sound/lan/godlike.wav
 *   sound/lan/holyshit.wav
 *
 * If a .res doesn't exist, create one, for example: de_dust.res.
 *
 */

#pragma dynamic 16384

#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>



// Edit these
//
#define FRAG_START_LEVEL 6
#define FRAG_NEXT_LEVEL 3
//
// Stop editing



#define ACCESS_CONSOLE 131072

new STRING_VERSION[MAX_DATA_LENGTH] = "1.0beta";

new FragCount[MAX_PLAYERS] = {0,...};



/* * * * * * * * * * *
 * Helper Functions  *
 * * * * * * * * * * */

playFile(sFileName[])
{
	new TargetIndex;
	new TargetName[MAX_NAME_LENGTH];
	new iTargetID;
	new sTargetID[MAX_NUMBER_LENGTH];

	new MaxPlayerCount = maxplayercount();

	for (TargetIndex = 1; TargetIndex <= MaxPlayerCount; TargetIndex++ )
	{
		if ( playerinfo(TargetIndex,TargetName,MAX_NAME_LENGTH,iTargetID) ) {
			numtostr(iTargetID, sTargetID);
			{
				playsound(sTargetID, sFileName);
			}
		}
	}

	return PLUGIN_CONTINUE;
}



/* * * * * * * * * *
 * LogD Functions  *
 * * * * * * * * * */

public logd_killstreak(HLCommand, HLData, HLUserName, UserIndex)
{
	new Data[MAX_DATA_LENGTH];
	new User[MAX_NAME_LENGTH];

	new iIDA;
	new sIDA[MAX_NUMBER_LENGTH];
	new iIDV;
	new sIDV[MAX_NUMBER_LENGTH];

	new Message[MAX_TEXT_LENGTH];

	convert_string(HLData, Data, MAX_DATA_LENGTH);

	strsplit(Data," ", sIDA,MAX_NUMBER_LENGTH, sIDV,MAX_NUMBER_LENGTH);

	iIDA = strtonum(sIDA);
	iIDV = strtonum(sIDV);

	if( !playerinfo(iIDA,User,MAX_NAME_LENGTH) ) {
		return PLUGIN_HANDLED;
	}

	FragCount[iIDV] = 0;
	FragCount[iIDA] += 1;

	if (FragCount[iIDA] < FRAG_START_LEVEL || (FragCount[iIDA] - FRAG_START_LEVEL) % FRAG_NEXT_LEVEL != 0) {
		return PLUGIN_HANDLED;
	}

	if (FragCount[iIDA] == FRAG_START_LEVEL) {
		playFile("lan/multikill.wav");
		snprintf(Message, MAX_TEXT_LENGTH, "%s: Multi Kill!! (%i frags)", User, FragCount[iIDA]);
		typesay(Message, 6, 255,255,255);
	} else if (FragCount[iIDA] == FRAG_NEXT_LEVEL + FRAG_START_LEVEL) {
		playFile("lan/ultrakill.wav" );
		snprintf(Message, MAX_TEXT_LENGTH, "%s: Ultra Kill!! (%i frags)", User, FragCount[iIDA]);
		typesay(Message, 6, 255,15,255);
	} else if (FragCount[iIDA] == 2 * FRAG_NEXT_LEVEL + FRAG_START_LEVEL) {
		playFile("lan/killingspree.wav");
		snprintf(Message, MAX_TEXT_LENGTH, "%s is on a Killing Spree!! (%i frags)", User, FragCount[iIDA]);
		typesay(Message, 6, 15,255,15);
	} else if (FragCount[iIDA] == 3 * FRAG_NEXT_LEVEL + FRAG_START_LEVEL) {
		playFile("lan/monsterkill.wav");
		snprintf(Message, MAX_TEXT_LENGTH, "%s: Monster Kill!! (%i frags)", User, FragCount[iIDA]);
		typesay(Message, 6, 255,15,15);
	} else {
		playFile("lan/godlike.wav");
		snprintf(Message, MAX_TEXT_LENGTH, "%s is Godlike!! (%i frags)", User, FragCount[iIDA]);
		typesay(Message, 6, 15,128,255);
	} else {
		playFile("lan/holyshit.wav");
		snprintf(Message, MAX_TEXT_LENGTH, "HOLY SHIT!!! %s is unbelievably (%i frags)", User, FragCount[iIDA]);
		typesay(Message, 6, 225,15,255);
	}

	return PLUGIN_HANDLED;
}



/* * * * * * * * * * *
 * Handle Functions  *
 * * * * * * * * * * */

public plugin_connect(HLUserName, HLIP, UserIndex)
{
	if (UserIndex >= 1 && UserIndex <= MAX_PLAYERS) {
		FragCount[UserIndex] = 0;
	}

	return PLUGIN_CONTINUE;
}

public plugin_disconnect(HLUserName, UserIndex)
{
	if (UserIndex >= 1 && UserIndex <= MAX_PLAYERS) {
		FragCount[UserIndex] = 0;
	}

	return PLUGIN_CONTINUE;
}

public plugin_init()
{
	plugin_registerinfo("Kill Streak Announcer - by <[NN]>Soul", "Announces kill streaks.", STRING_VERSION);

	plugin_registercmd("logd_killstreak", "logd_killstreak", ACCESS_CONSOLE, "");

	exec("logd_reg 57 admin_command logd_killstreak");

	return PLUGIN_CONTINUE;
}

dann kommt aber immer eine fehlermeldung beim compilieren:
Code:
plugin_logd_soul_killstreak.sma(135) Error [029]: invalid expression, assumed zero
kann mir da einer helfen? vielen dank^^

Autor:  Sir Drink a lot [ 21.02.2006, 17:40 ]
Betreff des Beitrags: 

Tipp1: 2 mal else im If Satz am Ende geht nicht bzw. macht auch keinen Sinn. Musst also bei "Godlike" auch eine } else if(...){ Bedingung schreiben, wie bei "monsterkill".

Tipp2: Bei der Fehlermeldung steht in ( ) die Zeilennummer, wo der Fehler liegt.

Seite 1 von 1 Alle Zeiten sind UTC+01:00
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/