![]() |
PHP Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
#include <sourcemod>
#include <stamm>
new Handle:hStammPoints = INVALID_HANDLE;
new Handle:hStammKnifeEnable = INVALID_HANDLE;
new Handle:hStammMinPlayer = INVALID_HANDLE;
public CountOnlinePlayer()
{
new Counter;
for (new i = 1; i <= GetMaxClients(); i++)
{
if ((IsClientInGame(i)) && IsPlayerAlive(i))
{
Counter++;
}
}
return Counter;
}
public OnPluginStart()
{
HookEvent("player_death", EventPlayerDeath);
hStammKnifeEnable = CreateConVar("sm_stammknife_enable", "1", "StammKnife aktivieren?", _, true, 0.0, true, 1.0);
hStammKnifeEnable = CreateConVar("sm_stammknife_points", "1", "Wie viele Stammpunkte soll der Spieler bekommen?");
hStammMinPlayer = FindConVar("stamm_min_player");
}
public EventPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
if(GetConVarInt(hStammKnifeEnable))
{
if(CountOnlinePlayer() >= GetConVarInt(hStammMinPlayer))
{
new String:weapon[64];
GetEventString(event, "weapon", weapon, sizeof(weapon));
new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
if(StrEqual(weapon, "weapon_knife"))
{
STAMM_AddClientPoints(attacker, GetConVarInt(hStammPoints));
}
}
}
}
|
This post has been edited 1 times, last edit by "Toastbrot_290" (Oct 27th 2013, 1:49pm)
![]() |
PHP Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
#include <sourcemod>
#include <stamm>
new Handle:hStammPoints = INVALID_HANDLE;
new Handle:hStammKnifeEnable = INVALID_HANDLE;
new Handle:hStammMinPlayer = INVALID_HANDLE;
public CountOnlinePlayer()
{
new Counter;
for (new i = 1; i <= GetMaxClients(); i++)
{
if ((IsClientInGame(i)) && IsPlayerAlive(i))
{
Counter++;
}
}
return Counter;
}
public OnPluginStart()
{
HookEvent("player_death", EventPlayerDeath);
hStammKnifeEnable = CreateConVar("sm_stammknife_enable", "1", "StammKnife aktivieren?", _, true, 0.0, true, 1.0);
hStammKnifeEnable = CreateConVar("sm_stammknife_points", "1", "Wie viele Stammpunkte soll der Spieler bekommen?");
hStammMinPlayer = FindConVar("stamm_min_player");
}
public EventPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
if(GetConVarInt(hStammKnifeEnable))
{
if(CountOnlinePlayer() >= GetConVarInt(hStammMinPlayer))
{
new String:weapon[64];
GetEventString(event, "weapon", weapon, sizeof(weapon));
new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
if(StrEqual(weapon, "weapon_knife"))
{
STAMM_AddClientPoints(attacker, GetConVarInt(hStammPoints));
}
}
}
}
|
This post has been edited 1 times, last edit by "INIURIA" (Oct 27th 2013, 8:51pm)
![]() |
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
/* Plugin Template generated by Pawn Studio */ #include <sourcemod> #include <stamm> #include <morecolors> #include <sdktools> public Plugin:myinfo = { name = "StammWeapon", author = "Toast", description = "Gives a player x Stamm Points when he kills a player with x weapon", version = "1.0", url = "sourcemod.net" } new public Handle:pack = INVALID_HANDLE; new Handle:hStammWeaponEnable = INVALID_HANDLE; new Handle:hStammMinPlayer = INVALID_HANDLE; new Handle:hStammWeaponMess = INVALID_HANDLE; public OnPluginStart() { HookEvent("player_death", EventPlayerDeath); hStammWeaponEnable = CreateConVar("sm_stammwaepon_enable", "1", "StammKnife aktivieren?", _, true, 0.0, true, 1.0); hStammWeaponMess = CreateConVar("sm_stammwaepon_message", "1", "Spielerbenachrichtigung aktivieren?", _, true, 0.0, true, 1.0); hStammMinPlayer = FindConVar("stamm_min_player"); ReadConfig(); RegConsoleCmd("sm_swreload", swreload); LoadTranslations("stammweapon.phrases"); } public EventPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) { if(GetConVarInt(hStammWeaponEnable)) { if(GetTeamCount() >= GetConVarInt(hStammMinPlayer)) { new String:weapon[64]; GetEventString(event, "weapon", weapon, sizeof(weapon)); new attackerid = GetEventInt(event, "attacker") new attacker = GetClientOfUserId(attackerid); new victimid = GetEventInt(event, "userid") new victim = GetClientOfUserId(victimid); ResetPack(pack); new String:buffer[1024]; new points = 0; ReadPackString(pack, buffer, 1024); points = ReadPackCell(pack); while(!StrEqual(weapon, buffer) && !StrEqual("",buffer)) { ReadPackString(pack, buffer, 1024); points = ReadPackCell(pack); } if(points == 0) { } else if(points >> 0) { if(GetConVarInt(hStammWeaponMess) == 1) { CPrintToChat(attacker, "%t %t","prefix", "addpoints",victim, buffer, points); } STAMM_AddClientPoints(attacker, points); } else if(points << 0) { new points2; points2 = 0 - points; if(GetConVarInt(hStammWeaponMess) == 1) { CPrintToChat(attacker, "%t %t","prefix", "delpoints",victim, buffer, points2); } STAMM_DelClientPoints(attacker, points2); } } } } public Action:swreload(client, args) { if(ReadConfig()) { ResetPack(pack); new String:buffer[1024]; new points = 0; ReadPackString(pack, buffer, 1024); points = ReadPackCell(pack); CPrintToChat(client,"%t %t","prefix", "configreload"); CPrintToChat(client,"%t %t","prefix", "configline", buffer, points); while(!StrEqual("",buffer)) { ReadPackString(pack, buffer, 1024); points = ReadPackCell(pack); if(!StrEqual("",buffer)) { CPrintToChat(client,"%t %t","prefix", "configline", buffer, points); } } } else { CPrintToChat(client,"%t %t","prefix", "configreloaderror"); } } public ReadConfig() { pack = CreateDataPack(); new Handle:keyvalues = INVALID_HANDLE; new String:swcfg[128]; keyvalues = CreateKeyValues("weapons"); BuildPath(Path_SM,swcfg,sizeof(swcfg),"configs/stammweapon.cfg"); if(FileExists(swcfg)) { FileToKeyValues(keyvalues, swcfg); if (KvGotoFirstSubKey(keyvalues)) { new String:weapon[64]; KvGetString(keyvalues, "weapon", weapon, 64, ""); new points = KvGetNum(keyvalues, "points", 0); WritePackString(pack, weapon); WritePackCell(pack, points); while (KvGotoNextKey(keyvalues)) { new String:weapon2[64]; KvGetString(keyvalues, "weapon", weapon2, 64, ""); new points2 = KvGetNum(keyvalues, "points", 0); WritePackString(pack, weapon2); WritePackCell(pack, points2); } } else { return false; } } else { return false; } return true; } |
This post has been edited 3 times, last edit by "Toastbrot_290" (Oct 31st 2013, 10:29am) with the following reason: zip Archiv hinzugefügt