Moin,
nach den Livestats also nun der zweite „Code-Upload“ von mir heute!
Eine neue Version vom HP-Plugin.
In dieser Version (3.3) wird nun auch angezeigt wie viel HP !!IHR!! dem
******kerl abgezogen habt!
Also etwa so:
Player hatte noch 40 HP und 84 Armor. Er traf dich mit der USP.
Du hast ihm 32 Schaden zugefuegt.
Ansonsten ist alles beim alten geblieben!
Die Funktion ist Standardmäßig aktiviert!
Ihr könnt sie aber durch den Eintrag:
Admin_hpudo 0
in der vault.ini
deaktivieren!
Mit 1 ist es logischerweise aktiviert!
Aber es scheint auch ganz ohne den Eintrag zu gehen!
Nun gut, hier also der Code:
Code:
/*******************************************************************
* *********
** Sir Drink a lots HP-Plugin v 3.3 ********
*** Changings made by: [Cola]-Whiskey *******
**** INFO: Shows the health of your enemy and, if it is ******
***** set up in the vault.ini, also the weapon which he has *****
***** used. *****
****** You can write hp,hp? or hp ? in chat to display this ****
******* message again. ***
******** Thanks to Warhead,Biohazard, [Cola]-Whiskey and the **
********* www.adminmod.de forumusers for help and the idea *
********* GREAT THANKS TO NETKOWALSKI FOR UPDATING THE CODE !!!! *
*******************************************************************
You have to set up admin_hpdisplay 0,1 ,admin_hpweapon 0,1 and admin_hpdeath 0,1 in your vault.ini.
To store your values forever :-)
admin_hpdisplay :
0= Only Display in chat area...
1= Display as typesay-message only visible for the victim.
admin_hpweapon:
0= Display with announcement of the killers weapon and armor.
1= Display without the weapon and armor.
admin_hpdeath:
0= Message is only displayed if you type hp in chat
1= Message is also displayed directly after death
It is recommended, that you only use the diplay in typesay if you have deactivated the
display with weapon.
!!! Sometimes it occurs that the client crashes if you use typesay !!!
*/
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
#define ACCESS_CONSOLE 131072
#define CLEAN_SLATE 0
#define MAX_PLAYERS 33
new STRING_VERSION[MAX_DATA_LENGTH] = "3.2";
new health[ MAX_PLAYERS ]= {CLEAN_SLATE,...};
new endhealth[MAX_PLAYERS] ={CLEAN_SLATE,...};
new enemy[MAX_PLAYERS] ={CLEAN_SLATE,...};
new endweapon[MAX_PLAYERS]={CLEAN_SLATE,...};
new armor[ MAX_PLAYERS ]= {CLEAN_SLATE,...};
new endarmor[MAX_PLAYERS] = {CLEAN_SLATE,...};
new killdata[MAX_PLAYERS][MAX_PLAYERS];
new Death[MAX_DATA_LENGTH];
new Displayweapon[MAX_DATA_LENGTH];
new DisplayUDo[MAX_DATA_LENGTH];
new Display[MAX_DATA_LENGTH];
new bhpEnabled = 1;
public admin_hpdisplay( HLCommand,HLData,HLUserName,UserIndex )
{
new Data[MAX_DATA_LENGTH];
new Text[MAX_TEXT_LENGTH];
convert_string( HLData, Data, MAX_DATA_LENGTH );
if(strcmp(Data,"0")==0)
{
set_vaultdata("admin_hpdisplay", Data);
selfmessage("Das HP wird ab jetzt IMMER nur im Chatbereich angezeigt.");
}
else if(strcmp(Data,"1")==0)
{
set_vaultdata("admin_hpdisplay", Data);
selfmessage("Das HP wird ab jetzt IMMER als Typesay angezeigt.");
}
else
{
get_vaultdata("admin_hpdisplay",Data, MAX_DATA_LENGTH);
snprintf(Text,MAX_TEXT_LENGTH,"Der Wert fuer admin_hpdisplay steht zur Zeit auf %s",Data);
selfmessage("Ungueltiger Wert fuer admin_hpdisplay.");
selfmessage("Entweder 0 fuer Anzeige nur im Chatbereich oder 1 fuer Typesay-Nachricht an den Spieler. ");
selfmessage(Text);
}
return PLUGIN_HANDLED;
}
public admin_hpweapon( HLCommand,HLData,HLUserName,UserIndex )
{
new Data[MAX_DATA_LENGTH];
new Text[MAX_TEXT_LENGTH];
convert_string( HLData, Data, MAX_DATA_LENGTH );
if(strcmp(Data,"0")==0)
{
set_vaultdata("admin_hpweapon", Data);
selfmessage("Das HP wird ab jetzt IMMER ohne Waffenangabe angezeigt.");
}
else if(strcmp(Data,"1")==0)
{
set_vaultdata("admin_hpweapon", Data);
selfmessage("Das HP wird ab jetzt IMMER mit Waffenangabe angezeigt.");
}
else
{
get_vaultdata("admin_hpweapon",Data, MAX_DATA_LENGTH);
snprintf(Text,MAX_TEXT_LENGTH,"Der Wert fuer admin_hpweapon steht zur Zeit auf %s",Data);
selfmessage("Ungueltiger Wert fuer admin_hpweapon.");
selfmessage("Entweder 1 fuer Anzeige nur mit Waffenangabe oder 0 fuer Anzeige ohne Waffenangabe an den Spieler.");
selfmessage(Text);
}
return PLUGIN_HANDLED;
}
public admin_hpdeath( HLCommand,HLData,HLUserName,UserIndex )
{
new Data[MAX_DATA_LENGTH];
new Text[MAX_TEXT_LENGTH];
convert_string( HLData, Data, MAX_DATA_LENGTH );
if(strcmp(Data,"0")==0)
{
set_vaultdata("admin_hpdeath", Data);
selfmessage("Das HP wird ab jetzt nicht mehr direkt beim Ableben angezeigt.IMMER !!");
}
else if(strcmp(Data,"1")==0)
{
set_vaultdata("admin_hpdeath", Data);
selfmessage("Das HP wird ab jetzt auch direkt beim Ableben angezeigt.IMMER !!!");
}
else
{
get_vaultdata("admin_hpdeath",Data, MAX_DATA_LENGTH);
snprintf(Text,MAX_TEXT_LENGTH,"Der Wert fuer admin_hpdeath steht zur Zeit auf %s",Data);
selfmessage("Ungueltiger Wert fuer admin_hpdeath.");
selfmessage("Entweder 1 fuer direkte Anzeige nach dem Tod oder 0 fuer Anzeige nur bei chat-Nachfrage.");
selfmessage(Text);
}
return PLUGIN_HANDLED;
}
public hp_injure( HLCommand,HLData,HLUserName,UserIndex )
{
new Damage[MAX_DATA_LENGTH];
new b[MAX_DATA_LENGTH];
new c[MAX_DATA_LENGTH];
new d[MAX_DATA_LENGTH];
new Armor[MAX_DATA_LENGTH];
new Victim[MAX_DATA_LENGTH];
new Data[MAX_DATA_LENGTH];
new iIDV;
new iIDA;
convert_string( HLData, Data, MAX_DATA_LENGTH );
strsplit(Data,"#",Damage,50,b,50,c,50,d,50,Armor,50);
strsplit(Damage," ",c,50,Victim,50);
strsplit(d," ",Damage,50,b,50,c,50);
iIDA = strtonum(c);
iIDV = strtonum(Victim);
killdata[iIDA][iIDV]=killdata[iIDA][iIDV]+(health[iIDV]-strtonum(Damage));
health[iIDV]=strtonum(Damage);
armor[iIDV]=strtonum(Armor);
return PLUGIN_CONTINUE;
}
public hp_kill( HLCommand,HLData,HLUserName,UserIndex )
{
if (!bhpEnabled)
{
return PLUGIN_CONTINUE;
}
new iIDA;
new iIDV;
new sIDA[MAX_NAME_LENGTH];
new sIDV[MAX_NAME_LENGTH];
new Data[MAX_DATA_LENGTH];
new Victim[MAX_DATA_LENGTH];
new Attacker[MAX_DATA_LENGTH];
new Text[MAX_DATA_LENGTH];
new weapon[MAX_DATA_LENGTH];
new killerweapon[MAX_DATA_LENGTH];
convert_string( HLData, Data, MAX_DATA_LENGTH );
strsplit(Data," ",sIDA,MAX_NAME_LENGTH,sIDV,MAX_NAME_LENGTH,weapon,MAX_DATA_LENGTH);
iIDA = strtonum(sIDA);
iIDV = strtonum(sIDV);
endhealth[iIDV]=health[iIDA];
endarmor[iIDV]=armor[iIDA];
if (endhealth[iIDV]==0)
{
endhealth[iIDV]=100;
}
enemy[iIDV]=iIDA;
if (strcmp(weapon,"grenade") == 0 )
{
endweapon[iIDV]= 1;
killerweapon ="der HE Granate";
}
if (strcmp(weapon,"knife") == 0 )
{
endweapon[iIDV]=2;
killerweapon ="dem Messer";
}
if (strcmp(weapon,"deagle") == 0 )
{
endweapon[iIDV]=3;
killerweapon ="der Desert Eagle";
}
if (strcmp(weapon,"elite") == 0 )
{
endweapon[iIDV]=4;
killerweapon ="den Elite Dual Berettas";
}
if (strcmp(weapon,"glock18") == 0 )
{
endweapon[iIDV]=5;
killerweapon ="der Glock 18";
}
if (strcmp(weapon,"p228") == 0 )
{
endweapon[iIDV]=6;
killerweapon ="der SIG P228";
}
if (strcmp(weapon,"fiveseven") == 0)
{
endweapon[iIDV]=7;
killerweapon ="der FN Five-Seven";
}
if (strcmp(weapon,"usp") == 0)
{
endweapon[iIDV]=8;
killerweapon ="der H&K USP";
}
if (strcmp(weapon,"m3") == 0 )
{
endweapon[iIDV]=9;
killerweapon ="der M3 Super90";
}
if (strcmp(weapon,"xm1014") == 0 )
{
endweapon[iIDV]=10;
killerweapon ="der XM1014";
}
if (strcmp(weapon,"mp5navy") == 0 )
{
endweapon[iIDV]=11;
killerweapon ="der MP5 Navy";
}
if (strcmp(weapon,"p90") == 0 )
{
endweapon[iIDV]=12;
killerweapon ="der FN P90";
}
if (strcmp(weapon,"tmp") == 0 )
{
endweapon[iIDV]=13;
killerweapon ="der Steyr TMP";
}
if (strcmp(weapon,"mac10") == 0 )
{
endweapon[iIDV]=14;
killerweapon ="der Ingram MAC-10";
}
if (strcmp(weapon,"ump45") == 0 )
{
endweapon[iIDV]=15;
killerweapon ="der H&K UMP45";
}
if (strcmp(weapon,"aug") == 0 )
{
endweapon[iIDV]=16;
killerweapon ="der Steyr Aug";
}
if (strcmp(weapon,"sg552") == 0 )
{
endweapon[iIDV]=17;
killerweapon ="der Sig SG-552";
}
if (strcmp(weapon,"awp") == 0 )
{
endweapon[iIDV]=18;
killerweapon ="der AWP";
}
if (strcmp(weapon,"m4a1") == 0 )
{
endweapon[iIDV]=19;
killerweapon ="der M4A1";
}
if (strcmp(weapon,"ak47") == 0 )
{
endweapon[iIDV]=20;
killerweapon ="der AK-47";
}
if (strcmp(weapon,"scout") == 0 )
{
endweapon[iIDV]=21;
killerweapon ="der Steyr Scout";
}
if (strcmp(weapon,"sg550") == 0 )
{
endweapon[iIDV]=22;
killerweapon ="der Sig SG-550 Sniper";
}
if (strcmp(weapon,"g3sg1") == 0 )
{
endweapon[iIDV]=23;
killerweapon ="der H&K G3/SG-1";
}
if (strcmp(weapon,"m249") == 0 )
{
endweapon[iIDV]=24;
killerweapon ="der FN M249 Para";
}
playerinfo(iIDA,Attacker,MAX_DATA_LENGTH);
playerinfo(iIDV,Victim,MAX_DATA_LENGTH);
get_vaultdata("admin_hpdeath",Death, MAX_DATA_LENGTH);
if(strcmp(Death,"1")==0)
{
get_vaultdata("admin_hpweapon",Displayweapon, MAX_DATA_LENGTH);
get_vaultdata("admin_hpudo",DisplayUDo,MAX_DATA_LENGTH);
if(strcmp(Displayweapon,"0")==0)
{
if (endhealth[iIDV]==100)
{
snprintf(Text,MAX_DATA_LENGTH,"%s wurde von Niemandem verletzt!",Attacker);
}
else
{
if (strcmp(DisplayUDo,"0")==0)
{
snprintf(Text,MAX_DATA_LENGTH,"%s hatte noch %i HP !",Attacker,endhealth[iIDV]);
}
else
{
snprintf(Text,MAX_DATA_LENGTH,"%s hatte noch %i HP ! Du hast ihm %i Schaden zugefuegt!",Attacker,endhealth[iIDV],killdata[iIDV][iIDA]);
}
}
}
else
{
if (endhealth[iIDV]==100)
{
snprintf(Text,MAX_DATA_LENGTH,"%s wurde von Niemandem verletzt!",Attacker);
}
else
{
if (strcmp(DisplayUDo,"0")==0)
{
snprintf(Text,MAX_DATA_LENGTH,"%s hatte noch %i HP und %i Armor.Er traf Dich mit %s !",Attacker,endhealth[iIDV],endarmor[iIDV],killerweapon);
}
else
{
snprintf(Text,MAX_DATA_LENGTH,"%s hatte noch %i HP und %i Armor.Er traf Dich mit %s !^nDu hast ihm %i Schaden zugefuegt.",Attacker,endhealth[iIDV],endarmor[iIDV],killerweapon,killdata[iIDV][iIDA]);
}
}
}
get_vaultdata("admin_hpdisplay",Display, MAX_DATA_LENGTH);
if(strcmp(Display,"0")==0)
{
messageex(Victim,Text,print_chat);
}
else
{
messageex(Victim,Text,print_tty);
}
}
return PLUGIN_HANDLED;
}
public hp_reset(HLCommand,HLData,HLUserName,UserIndex,Param)
{
new loop;
new Data[MAX_NAME_LENGTH];
convert_string(HLData,Data,MAX_NAME_LENGTH);
if( strcmp( "Round_Start", Data ) != 0 )
{
return PLUGIN_HANDLED;
}
for( loop = 0; loop < MAX_PLAYERS; loop += 1 )
{
health[loop] = 100;
endhealth[loop] = CLEAN_SLATE;
enemy[loop] =CLEAN_SLATE;
endweapon[loop]=CLEAN_SLATE;
armor[loop] = CLEAN_SLATE;
endarmor[loop]= CLEAN_SLATE;
for(new i=0;i<MAX_PLAYERS; i=i+1)
{
killdata[loop][i] = CLEAN_SLATE;
}
}
return PLUGIN_HANDLED;
}
public admin_hp(HLCommand, HLData, HLUserName, UserIndex)
{
new Data[MAX_DATA_LENGTH];
convert_string(HLData,Data,MAX_DATA_LENGTH);
if (strcmp(Data,"1")==0)
{
bhpEnabled = 1;
selfmessage("HP Anzeige nach Tot ist an");
return PLUGIN_HANDLED;
}
else
{
bhpEnabled = 0;
selfmessage("HP Anzeige ist ausgeschaltet");
return PLUGIN_HANDLED;
}
selfmessage("Falsche Eingabe. 1 = An und 0 = Aus !!!");
return PLUGIN_HANDLED;
}
public HandleSay(HLCommand,HLData,HLUserName,UserIndex)
{
if (!bhpEnabled)
{
return PLUGIN_CONTINUE;
}
new Data[MAX_DATA_LENGTH];
new User[MAX_DATA_LENGTH];
new enemyname[MAX_DATA_LENGTH];
new Text[MAX_DATA_LENGTH];
new IsDead = 0,UserID,WONID,Team;
new iUser;
new killerweapon[MAX_NAME_LENGTH];
convert_string(HLData,Data,MAX_DATA_LENGTH);
convert_string(HLUserName,User,MAX_DATA_LENGTH);
strstripquotes(Data);
get_userindex( User, iUser );
if (streq(Data, "hp?")==1 || streq(Data, "hp")==1 || streq(Data, "hp ?")==1)
{
playerinfo(iUser,User,MAX_DATA_LENGTH,UserID,WONID,Team,IsDead);
if(IsDead == 0)
{
return PLUGIN_CONTINUE;
}
else
{
if(enemy[iUser]==0)
{
messageex(User,"Du wurdest von keinem umgebracht. Selbstmord ? Oder war es der boese Admin ?",print_chat)
return PLUGIN_HANDLED;
}
switch(endweapon[iUser])
{
case 1: killerweapon ="der HE Granate";
case 2: killerweapon ="dem Messer";
case 3: killerweapon ="der Desert Eagle";
case 4: killerweapon ="den Elite Dual Berettas";
case 5: killerweapon ="der Glock 18";
case 6: killerweapon ="der SIG P228";
case 7: killerweapon ="der FN Five-Seven";
case 8: killerweapon ="der H&K USP";
case 9: killerweapon ="der M3 Super90";
case 10: killerweapon ="der XM1014";
case 11: killerweapon ="der MP5 Navy";
case 12: killerweapon ="der FN P90";
case 13: killerweapon ="der Steyr TMP";
case 14: killerweapon ="der Ingram MAC-10";
case 15: killerweapon ="der H&K UMP45";
case 16: killerweapon ="der Steyr Aug";
case 17: killerweapon ="der Sig SG-552";
case 18: killerweapon ="der AWP";
case 19: killerweapon ="der M4A1";
case 20: killerweapon ="der AK-47";
case 21: killerweapon ="der Steyr Scout";
case 22: killerweapon ="der Sig SG-550 Sniper";
case 23: killerweapon ="der H&K G3/SG-1";
case 24: killerweapon ="der FN M249 Para";
}
playerinfo(enemy[iUser],enemyname,MAX_DATA_LENGTH);
get_vaultdata("admin_hpweapon",Displayweapon, MAX_DATA_LENGTH);
get_vaultdata("admin_hpudo",DisplayUDo,MAX_DATA_LENGTH);
if(strcmp(Displayweapon,"0")==0)
{
if (endhealth[iUser]==100)
{
snprintf(Text,MAX_DATA_LENGTH,"%s wurde von Niemandem verletzt!",enemyname);
}
else
{
if (strcmp(DisplayUDo,"0")==0)
{
snprintf(Text,MAX_DATA_LENGTH,"%s hatte noch %i HP !",enemyname,endhealth[iUser]);
}
else
{
snprintf(Text,MAX_DATA_LENGTH,"%s hatte noch %i HP ! Du hast ihm %i Schaden zugefuegt!",enemyname,endhealth[iUser],killdata[iUser][enemy[iUser]]);
}
}
}
else
{
if (endhealth[iUser]==100)
{
snprintf(Text,MAX_DATA_LENGTH,"%s wurde von Niemandem verletzt!",enemyname);
}
else
{
if (strcmp(DisplayUDo,"0")==0)
{
snprintf(Text,MAX_DATA_LENGTH,"%s hatte noch %i HP und %i Armor.Er traf Dich mit %s !",enemyname,endhealth[iUser],endarmor[iUser],killerweapon);
}
else
{
snprintf(Text,MAX_DATA_LENGTH,"%s hatte noch %i HP und %i Armor.Er traf Dich mit %s !^nDu hast ihm %i Schaden zugefuegt.",enemyname,endhealth[iUser],endarmor[iUser],killerweapon,killdata[iUser][enemy[iUser]]);
}
}
}
get_vaultdata("admin_hpdisplay",Display, MAX_DATA_LENGTH);
if(strcmp(Display,"0")==0)
{
messageex(User,Text,print_chat);
}
else
{
messageex(User,Text,print_tty);
}
}
}
return PLUGIN_CONTINUE;
}
public plugin_init()
{
plugin_registerinfo("?HP-Script","Announces the health of your opponent",STRING_VERSION);
plugin_registercmd("hp_injure", "hp_injure", ACCESS_CONSOLE, "");
plugin_registercmd("hp_kill", "hp_kill", ACCESS_CONSOLE, "");
plugin_registercmd("hp_reset", "hp_reset", ACCESS_CONSOLE, "");
plugin_registercmd("say","HandleSay",ACCESS_ALL);
plugin_registerhelp("say",ACCESS_ALL,"say hp?/hp/hp ?: Will announce the health and weapon of your killer.");
plugin_registercmd("admin_hp", "admin_hp", ACCESS_BAN, "admin_hp (1/0): Turns HP Display on/off.");
plugin_registercmd("admin_hpdisplay", "admin_hpdisplay", ACCESS_BAN, "admin_hpdisplay (1/0): 0=message is displayed in chat, 1=message is displayed in typesay");
plugin_registercmd("admin_hpweapon", "admin_hpweapon", ACCESS_BAN, "admin_hpweapon (1/0): 0=message is displayed without weapon, 1=message is displayed with weapon");
plugin_registercmd("admin_hpdeath", "admin_hpdeath", ACCESS_BAN, "admin_hpdeath (1/0): 0=message is displayed only if you ask hp in chat, 1=message is displayed directly after death");
exec( "logd_reg 58 admin_command hp_injure" );
exec( "logd_reg 57 admin_command hp_kill" );
exec( "logd_reg 62 admin_command hp_reset" );
return PLUGIN_CONTINUE;
}
ciao
kowalski