Hi dieser Bombtimer funktioniert bei uns auf 2 Servern einwandfrei.
Hab hier mal den Quelltext angefügt, compilieren, ggf. convertieren, installieren sich freuen.
Code:
*/[WHO]Them's bomb countdown timer.
Ripped and stripped from bud-froggy's bombsay code to expedite release.
Edited by Kndroc to be complient with LogD 1.0
*/
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
#define ACCESS_CONSOLE 131072
new ADDON_WORDS[] = "seconds";
new STRING_VERSION[MAX_DATA_LENGTH] = "1.3";
new bombdefused = 1;
public execute_all(a[])
{
new userid = 0;
new wonid = 0;
new teamid = 0;
new username[200];
new i = 0;
new x = 0;
x = maxplayercount();
for (i = 1; i <= x; i = i + 1)
{
strinit(username);
if (playerinfo(i, username, 200, userid, wonid, teamid) == 1)
{
execclient(username, a);
}
}
}
public bt_checkplant(HLCommand,HLData,HLUserName,UserIndex)
{
new Data[MAX_DATA_LENGTH];
new sID[MAX_DATA_LENGTH];
new Message[MAX_TEXT_LENGTH];
convert_string(HLData, Data, MAX_DATA_LENGTH);
strbreak(Data, sID, Data, MAX_DATA_LENGTH);
if(strcmp(Data, "Planted_The_Bomb") == 0)
{
new c4time = 45;
new numstring[MAX_DATA_LENGTH];
getstrvar("mp_c4timer",numstring, MAX_DATA_LENGTH);
c4time = strtonum(numstring);
new Name[MAX_NAME_LENGTH];
new iID = strtonum(sID);
if(!playerinfo(iID,Name,MAX_NAME_LENGTH)){
return PLUGIN_FAILURE;
}
snprintf(Message, MAX_TEXT_LENGTH, "%s hat die Bombe gelegt !!!",Name);
centersay(Message,5,10,125,10);
set_timer("thirtysecstillboom", c4time - 30, 0);
set_timer("twentysecstillboom", c4time - 20, 0);
set_timer("tensecstillboom", c4time - 10, 0);
set_timer("fivesecstillboom", c4time - 5, 0);
set_timer("foursecstillboom", c4time - 4, 0);
set_timer("threesecstillboom", c4time - 3, 0);
set_timer("twosecstillboom", c4time - 2, 0);
set_timer("onesecstillboom", c4time - 1, 0);
set_timer("nosecstillboom", c4time - 0, 0);
bombdefused = 0;
}
return PLUGIN_CONTINUE;
}
public bt_checkdone(HLCommand,HLData,HLUserName,UserIndex)
{
new Params[MAX_DATA_LENGTH];
new Data[MAX_DATA_LENGTH];
convert_string(HLData,Params,MAX_DATA_LENGTH);
switch( Params[ 6 ] )
{
case 'S':
{
bombdefused = 1;
return PLUGIN_CONTINUE;
}
case 'E':
{
bombdefused = 1;
return PLUGIN_CONTINUE;
}
}
if(strcmp(Data, "Round_Start") == 1 || strcmp(Data, "Round_End") == 1)
{
bombdefused = 1;
return PLUGIN_CONTINUE;
}
return PLUGIN_CONTINUE;
}
public thirtysecstillboom() {
if(bombdefused == 0) {
new messageout[MAX_DATA_LENGTH];
strcpy(messageout, "speak ^"thirty ", MAX_DATA_LENGTH);
strcat(messageout, ADDON_WORDS, MAX_DATA_LENGTH);
strcat(messageout, "^"", MAX_DATA_LENGTH);
execute_all(messageout);
centersay("30 Sekunden bis zur Explosion",3,12,125,12);
}
}
public twentysecstillboom() {
if(bombdefused == 0) {
new messageout[MAX_DATA_LENGTH];
strcpy(messageout, "speak ^"twenty ", MAX_DATA_LENGTH);
strcat(messageout, ADDON_WORDS, MAX_DATA_LENGTH);
strcat(messageout, "^"", MAX_DATA_LENGTH);
execute_all(messageout);
centersay("20 Sekunden bis zur Explosion",3,12,125,12);
}
}
public tensecstillboom() {
if(bombdefused == 0) {
new messageout[MAX_DATA_LENGTH];
strcpy(messageout, "speak ^"ten ", MAX_DATA_LENGTH);
strcat(messageout, ADDON_WORDS, MAX_DATA_LENGTH);
strcat(messageout, "^"", MAX_DATA_LENGTH);
execute_all(messageout);
centersay("10 Sekunden bis zur Explosion",3,255,0,0);
}
}
public fivesecstillboom() {
if(bombdefused == 0) {
centersay("5 IIIII",2,255,0,0);
execute_all("speak ^"five^"");
}
}
public foursecstillboom() {
if(bombdefused == 0) {
centersay("4 IIII",2,255,0,0);
execute_all("speak ^"four^"");
}
}
public threesecstillboom() {
if(bombdefused == 0) {
centersay("3 III",2,255,0,0);
execute_all("speak ^"three^"");
}
}
public twosecstillboom() {
if(bombdefused == 0) {
centersay("2 II",2,255,0,0);
execute_all("speak ^"two^"");
}
}
public onesecstillboom() {
if(bombdefused == 0) {
centersay("1 I",2,255,0,0);
execute_all("speak ^"one^"");
}
}
public nosecstillboom() {
if(bombdefused == 0) {
centersay("! ! ! B - O - O - O - M ! ! !",2,255,0,0);
bombdefused = 1;
}
}
public plugin_init() {
plugin_registerinfo("Bomb Planting Timer","Just a countdown until the bomb explodes.",STRING_VERSION);
plugin_registercmd("bt_checkplant", "bt_checkplant", ACCESS_CONSOLE);
plugin_registercmd("bt_checkdone", "bt_checkdone", ACCESS_CONSOLE);
exec( "logd_reg 60 admin_command bt_checkplant" );
exec( "logd_reg 62 admin_command bt_checkdone" );
return PLUGIN_CONTINUE;
}
[/code]