Sie sind nicht angemeldet.

Lieber Besucher, herzlich willkommen bei: sourceserver.info. Falls dies Ihr erster Besuch auf dieser Seite ist, lesen Sie sich bitte die Hilfe durch. Dort wird Ihnen die Bedienung dieser Seite näher erläutert. Darüber hinaus sollten Sie sich registrieren, um alle Funktionen dieser Seite nutzen zu können. Benutzen Sie das Registrierungsformular, um sich zu registrieren oder informieren Sie sich ausführlich über den Registrierungsvorgang. Falls Sie sich bereits zu einem früheren Zeitpunkt registriert haben, können Sie sich hier anmelden.

1

Dienstag, 31. März 2009, 18:42

Funktionen von 2 Plugins in einem vereinen?

Hi

und zwar handelt es sich einmal um dieses Plugin hier SaySounds (inculding Hybrid Edition) und um ein Plugins, was jemand von meinem Clan geschrieben hat. Hier mal der Code aus der .sp dazu.

Spoiler Spoiler

/*
1.0.1
- Fixed: Abschalten der Sounds, schaltet gleichzeitig die Chatanzeige mit ab.
*/

#include <sourcemod>
#include <sdktools>
#pragma semicolon 1
#define MAX_PLAYERS 28

new g_soundtime = 1;
new g_download_index = 0;
new g_soundcount = 0;
new g_Soundoption[29] = { 0, ... };
new String:g_Soundtrigger[300][15];
new String:g_Soundtext[300][95];
new String:g_Soundlocation[300][30];

public Plugin:myinfo =
{
name = "]FUSION[ Sounds",
author = "]FUSION[ Gray Death",
description = "Admin sounds and configuration",
version = "1.0.1b",
url = "http://www.fusion-clan.de/plugins"
};

public OnPluginStart()
{
RegConsoleCmd("say", Command_Say);
HookEvent("round_start", HookRoundStart, EventHookMode_Pre);
HookEvent("round_end", HookRoundEnd, EventHookMode_Pre);
}

public Action:HookRoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
g_soundtime = 1;
}

public Action:HookRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
CreateTimer(10.0, End_Startphase);
}

public Action:End_Startphase(Handle:timer)
{
g_soundtime = 0;
}

public OnMapStart()
{
CreateTimer(0.1, Load_Sounds);
}

public Action:Load_Sounds(Handle:timer)
{
new i = 0;

new String:soundlistfile[PLATFORM_MAX_PATH];
BuildPath(Path_SM,soundlistfile,sizeof(soundlistfile),"configs/saysounds.cfg");

if(!FileExists(soundlistfile))
{
LogMessage("saysounds.cfg not parsed...file doesnt exist!");
}
else
{

new Handle:listfile = CreateKeyValues("soundlist");
FileToKeyValues(listfile,soundlistfile);
KvRewind(listfile);
KvGotoFirstSubKey(listfile);

new add_until = g_download_index + 30;

do
{
new String:buffer[15];
new String:soundtext[95];
new String:filelocation[30];

KvGetSectionName(listfile, buffer, sizeof(buffer));
KvGetString(listfile, "file", filelocation, sizeof(filelocation));
KvGetString(listfile, "text", soundtext, sizeof(soundtext));
if(FileExists(filelocation))
{
g_Soundtrigger = buffer;
g_Soundtext[i] = soundtext;
g_Soundlocation[i] = filelocation;
if(i >= g_download_index && i < add_until)
{
AddFileToDownloadsTable(filelocation);
PrecacheSound(filelocation, true);
}
i++;
}
}
while (KvGotoNextKey(listfile));
CloseHandle(listfile);

g_download_index = add_until;
}

g_soundcount = i;
if(g_download_index > g_soundcount)
{
g_download_index = 0;
}
}

public OnClientAuthorized(client, const String:auth[])
{
if(!IsFakeClient(client))
{
if(client != 0)
{
decl String:temp[3];
GetClientInfo(client, "fsound", temp, 3);
g_Soundoption[client] = StringToInt(temp);
}
}
}

public Action:Command_Say(client,args)
{

if(client != 0)
{
decl String:speech[128];
decl String:clientName[64];
GetClientName(client,clientName,64);
GetCmdArgString(speech,sizeof(speech));

new startidx = 0;
if (speech[0] == '"')
{
startidx = 1;
/* Strip the ending quote, if there is one */
new len = strlen(speech);
if (speech[len-1] == '"')
{
speech[len-1] = '\0';
}
}

if(strcmp(speech[startidx],"/sounds",false) == 0)
{
switch(g_Soundoption[client])
{
case 0:
{
g_Soundoption[client] = 1;
PrintToChat(client,"%c[Sound:] %cWährend Du am Leben bist, werden keine Sounds mehr abgespielt.", 0x03, 0x01);
}
case 1:
{
g_Soundoption[client] = 2;
PrintToChat(client,"%c[Sound:] %cSounds sind jetzt abgeschaltet.", 0x03, 0x01);
}
case 2:
{
g_Soundoption[client] = 3;
PrintToChat(client,"%c[Sound:] %cSounds nur in den Rundenpausen und beim Zuschauen.", 0x03, 0x01);
}
case 3:
{
g_Soundoption[client] = 0;
PrintToChat(client,"%c[Sound:] %cSounds werden immer abgespielt.", 0x03, 0x01);
}
}
return Plugin_Handled;
}


if (speech[startidx] == 'y' || speech[startidx] == '!' || speech[startidx] == 'z')
{
startidx += 1;
}
else
{
return Plugin_Continue;
}

new AdminId:aid = GetUserAdmin(client);
if (aid == INVALID_ADMIN_ID)
{
return Plugin_Continue;
}

new soundfound = -1;

for (new i=0; i < 300; i++)
{
if (strcmp(speech[startidx],g_Soundtrigger[i],false) == 0)
{
soundfound = i;
break;
}
}

new String:options[255] = "";
new a = 0;
new matchcheck = 1;
if(strlen(speech[startidx]) < 4)
{
matchcheck = 0;
}

if(soundfound == -1 && matchcheck == 1)
{
for (new i=0; i < 300; i++)
{
if (StrContains(g_Soundtext[i], speech[startidx], false) > -1)
{
if(a > 5)
{
StrCat(options, 255, "(Weitere Moeglichkeiten vorhanden)");
break;
}
StrCat(options, 255, g_Soundtrigger[i]);
StrCat(options, 255, " ");
a++;
soundfound = i;
}
}
}

if(a > 1)
{
PrintToChat(client, "Meintest Du vielleicht: %s", options);
return Plugin_Handled;
}
else if(a == 1 || soundfound > 0)
{
decl String:filelocation[30];
decl String:soundtext[95];
soundtext = g_Soundtext[soundfound];
filelocation = g_Soundlocation[soundfound];
new playersconnected;
playersconnected = GetMaxClients();
for (new ii = 1; ii <= playersconnected; ii++)
{
if(IsClientInGame(ii))
{
switch(g_Soundoption[ii])
{
case 0: // Def: Play sound and text always
{
ClientCommand(ii, "playgamesound \"%s\"", filelocation[6]);
}
case 1:
{
if(!IsPlayerAlive(ii))
{
ClientCommand(ii, "playgamesound \"%s\"", filelocation[6]);
}
}
case 3:
{
{
if(!IsPlayerAlive(ii) || g_soundtime == 1)
{
ClientCommand(ii, "playgamesound \"%s\"", filelocation[6]);
}
}
}
}
PrintToChat(ii,"%s: %s (sound)", clientName, soundtext);
}
}
return Plugin_Handled;
}

}
return Plugin_Continue;
}


Nun sind in dem Plugin von unserem Clan einige Funktionen, die ich gern in das andere implementiert hätte. Allerdings bin ich im Thema Scripting eine absolute Niete. Vieleicht gibt es ja jemanden, der sich meiner bzw diesem Script mal annehmen könnte.

Folgende Funktionen würde ich gern aus unserem Plugin in das andere Plugin implementieren:

-Sounds werden mit zsoundname, ysoundname oder !soundname gestartet
-anstatt des triggers wird der Sound als Text im Chat angezeigt
- die Trigger für den jeweiligen Sound werden aus dem für den Sound hinterlegten Text erzeugt, haben mehrere Soundtexte diesen Trigger, wird im Chat eingeblendet, welche Soundtrigger in Frage kommen.

Also wäre Klasse wenn sich das mal einer anschauen könnte.

MfG Franky

Das Leben ist eine lange Reihe von Zimmern und die Menschen auf die wir in den Zimmern treffen, bestimmen unser Leben!