sourcepawn`ики помогите, пожалйста!

Обсуждаем все, что относится к выделенным серверам *NIX (Unix, Linux) и Windows
Ответить
Сообщение
Автор
tortman
Сержант
Сержант
Сообщения: 75
Зарегистрирован: 21.11.2010

#1 Сообщение 22.01.2011, 20:50

Вот тут уже ниже висит моя темка про сшивку 2 плагов.Это плагины CSS bank и l4a armor & health system. Банк CSS, название говорит за себя, но вот он ясен пень ищет деньги которых в l4d2 нету, поэтому мне его надо сшить с health system чтоб банк считывал валюту этого плагина и заработал, я в сорпавне далеко не маг и чародей, но попытался их сшить, результат так себе, при компиляции 4 ошибки. Вот и просьба огромная, помогите доработать. Там дел для знающего всего ничего. Сильно надеюсь на помощь...

сам код в спойлере..
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>

/*
* SM Bank
* by MaTTe (mateo10)
*/


#define DWDCOUNT 7
//static String:MoneyCount[ DWDCOUNT ][] = { "1000" , "2000" , "4000" , "8000", "16000"};

new LastMenuAction[ MAXPLAYERS + 1 ];
new TargetClientMenu[ MAXPLAYERS + 1 ];
new IHateFloods[ MAXPLAYERS + 1 ];

#define VERSION "3.0"

public Plugin:myinfo =
{
name = "SM Bank",
author = "MaTTe, edit by Nican",
description = "Player is allowed to put money in his bank, and take them out when he needs them",
version = VERSION,
url = "http://www.sourcemod.net/"
};

new g_iAccount = -1;

#define ALLOWBANK 0
#define MAXBANK 1
#define DEPOSITFEE 2
#define TRANSFER 3
#define INTEREST 4
#define AUTOMONEY 5
#define PISTOLROUND 6
#define DBCONFIG 7
#define DBSAVE 8
#define MENUROUND 9
#define CSSTARTMONEY 10
#define PLUGIN_VERSION "1.2"
#define ORBS_SMOKER 2
#define ORBS_BOOMER 3
#define ORBS_HUNTER 4
#define ORBS_WITCH 10
#define ORBS_TANK 25
#define ORBS_INFECTED 1


new Handle:g_cvars[11];
new maxplayers;
new Handle:db = INVALID_HANDLE;
new Handle:L4DFirstAidKit = INVALID_HANDLE;
new Handle:L4DPainPills = INVALID_HANDLE;
new Handle:MaxHealth = INVALID_HANDLE;
new Handle:iMHealthMultiplier = INVALID_HANDLE;
new Handle:iMArmorMultiplier = INVALID_HANDLE;
new Handle:iMArmorFactor = INVALID_HANDLE;
new Handle:iOrbProbability = INVALID_HANDLE;
new iTeamBonus;

new iChokeCheck;
new iVomitCheck;
new iBoomerExplodedCheck;

new iOrbs[ MAXPLAYERS + 1];
new DBid[ MAXPLAYERS + 1];
new iMHealth[MAXPLAYERS + 1];
new iMArmor[MAXPLAYERS + 1];
new m_iArmor[MAXPLAYERS + 1];
new bool:b_ShowArmor[MAXPLAYERS + 1];
new iOrbFactor[MAXPLAYERS + 1];
new iSkill01[MAXPLAYERS + 1];
new iSkill02[MAXPLAYERS + 1];
new iSkill03[MAXPLAYERS + 1];
new iSkill04[MAXPLAYERS + 1];
new iSkill05[MAXPLAYERS + 1];
new iSkill06[MAXPLAYERS + 1];
new iSkill07[MAXPLAYERS + 1];
new iSkill08[MAXPLAYERS + 1];
new iSkill09[MAXPLAYERS + 1];
new iSkill10[MAXPLAYERS + 1];

public OnPluginStart()
{
CreateConVar("smbank_sql_version", VERSION, "SM Bank Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);

g_cvars[ALLOWBANK] = CreateConVar("sm_bank_allow","1","Allow users to use the bank");
g_cvars[TRANSFER] = CreateConVar("sm_bank_transfer","1","Allow users to transfer money to other users");
g_cvars[MAXBANK] = CreateConVar("sm_bank_max","50000","Maximun Amount of money players are allowed to have in their bank");
g_cvars[DEPOSITFEE] = CreateConVar("sm_bank_fee","250","Fee players must pay for each deposit");
g_cvars[INTEREST] = CreateConVar("sm_bank_interest","5.0","% of interest players will get per round");
g_cvars[PISTOLROUND] = CreateConVar("sm_bank_pistol","0","Set to 1 to block witdraw during pistol round");
g_cvars[DBCONFIG] = CreateConVar("sm_bank_config","default","Set the database configuration");
g_cvars[DBSAVE] = CreateConVar("sm_bank_save","2","1=disconnect, 2=round_start, 3=every change");
g_cvars[MENUROUND] = CreateConVar("sm_bank_round","500","How much the plugin will round numbers to show on the menu");
g_cvars[CSSTARTMONEY] = FindConVar("mp_startmoney");

if( g_cvars[CSSTARTMONEY] == INVALID_HANDLE ){
LogMessage("SMBANK: Could not find mp_startmoney. 800 will be used.");
}

HookConVarChange(g_cvars[DBCONFIG], BankConVarChanged);
HookConVarChange(MaxHealth, ConVarChange);

//g_cvars[AUTOMONEY] = CreateConVar("sm_bank_auto","0","Put 1 if money should be automacicly deposited/extracted");

RegAdminCmd("sm_bankadd", Command_AddtoBank, ADMFLAG_CUSTOM4);
RegAdminCmd("sm_bankset", Command_SetBank, ADMFLAG_CUSTOM4);

LoadTranslations("plugin.smbank");
AutoExecConfig(true, "l4d_survivorarmor");

RegConsoleCmd("deposit", Deposit);
RegConsoleCmd("withdraw", WithDraw);
RegConsoleCmd("bankstatus", BankStatus);
RegConsoleCmd("bank", BankMenu);
RegConsoleCmd("sm_status", CheckStatus, "Check various stats on survivor.");
RegConsoleCmd("sm_itemmenu", UpgradeMenu, "Check various upgrades on survivor.");
RegConsoleCmd("sm_skillmenu", SkillMenu, "Check various skills on survivor.");
RegConsoleCmd("sm_bonusmenu", BonusMenu, "Check various bonus rewards on survivors.");
RegConsoleCmd("sm_giveorbs", CommandGiveOrbs, "Give player specfied orbs with an amount.");

g_iAccount = FindSendPropOffs("CCSPlayer", "m_iAccount");

HookEvent("round_start", EventRoundStart);
HookEvent("player_first_spawn", event_PlayerSpawn);
HookEvent("player_spawn", event_PlayerSpawn);
HookEvent("player_transitioned", event_SetStatus);
HookEvent("survivor_rescued", event_Rescued);
HookEvent("player_bot_replace", event_PlayerReplace);
HookEvent("bot_player_replace", event_BotReplace);
HookEvent("player_left_start_area", event_LeftStart);
HookEvent("heal_success", event_HealSuccess);
HookEvent("player_hurt", event_PlayerHurt);
HookEvent("player_death", event_PlayerDeath);
HookEvent("infected_death", event_InfectedDeath);
HookEvent("award_earned", event_AwardEarned);

HookEvent("choke_start", event_ChokeStart);
HookEvent("choke_end", event_ChokeStart);
HookEvent("player_now_it", event_PlayerNowIt);
HookEvent("boomer_exploded", event_BoomerExploded);

ConnectToMysql();
}

public BankConVarChanged(Handle:convar, const String:oldValue[], const String:newValue[]){
ConnectToMysql();
}

stock ConnectToMysql(){
if(db != INVALID_HANDLE){
LogMessage("[SM Bank] Disconnecting DB connection");
CloseHandle(db);
db = INVALID_HANDLE;
}

decl String:dbname[64];
GetConVarString(g_cvars[DBCONFIG], dbname, 64);

if(!SQL_CheckConfig( dbname )){
LogMessage("[SM Bank] DB configuration '%s' does not exist, using default.", dbname );
dbname = "default";
}

SQL_TConnect(OnSqlConnect, dbname);
}

public OnSqlConnect(Handle:owner, Handle:hndl, const String:error[], any:data)
{


if (hndl == INVALID_HANDLE)
{
LogError("Database failure: %s", error);
} else {
db = hndl;

decl String:buffer[1024];

SQL_GetDriverIdent( SQL_ReadDriver(db), buffer, sizeof(buffer));
new ismysql = StrEqual(buffer,"mysql", false) ? 1 : 0;

if(ismysql == 1){
Format(buffer, sizeof(buffer), "CREATE TABLE IF NOT EXISTS `sm_users` (`id` int(11) NOT NULL auto_increment,`steam` varchar(31) NOT NULL, `money` int(11) NOT NULL,PRIMARY KEY (`id`),UNIQUE KEY `steam` (`steam`))");
}else{
Format(buffer, sizeof(buffer), "CREATE TABLE IF NOT EXISTS sm_users(id INTEGER PRIMARY KEY AUTOINCREMENT, steam TEXT UNIQUE, money INTEGER );");
}

SQL_FastQuery(db, buffer);
}
}

public OnClientPostAdminCheck(client){
DBid[ client ] = -1;

decl String:AuthStr[32];

if(IsFakeClient(client)){
return;
}

if(!GetClientAuthString(client, AuthStr, 32)){
return;
}

decl String:MysqlQuery[512];

Format(MysqlQuery, sizeof(MysqlQuery), "SELECT id, money FROM sm_users WHERE steam = '%s'", AuthStr);

//LogMessage("%s", MysqlQuery);

SQL_TQuery(db, T_NewClientConnected , MysqlQuery, GetClientUserId(client));
}

public T_NewClientConnected(Handle:owner, Handle:hndl, const String:error[], any:data)
{
new client;

/* Make sure the client didn't disconnect while the thread was running */
if ((client = GetClientOfUserId(data)) == 0)
{
return;
}

if (hndl == INVALID_HANDLE)
{
LogError("Query failed! %s", error);
} else if (!SQL_GetRowCount(hndl)) {
decl String:AuthStr[32], String:MysqlQuery[512];
if(!GetClientAuthString(client, AuthStr, 32)){
return;
}

//Client no found, add him to the table
Format(MysqlQuery, sizeof(MysqlQuery), "INSERT INTO sm_users(steam) VALUES('%s')", AuthStr);
//LogMessage("%s", MysqlQuery);

SQL_FastQuery(db, MysqlQuery);

return;
}

if(!SQL_FetchRow(hndl))
return;

DBid[ client ] = SQL_FetchInt( hndl, 0);
SetiOrbs(client, SQL_FetchInt( hndl, 1));
}


stock SaveClientInfo(client){
decl String:MysqlQuery[512];

if( DBid[ client ] == -1){
decl String:AuthStr[32];
if(!GetClientAuthString(client, AuthStr, 32)){
return;
}

Format(MysqlQuery, sizeof(MysqlQuery), "UPDATE sm_users SET money = %d WHERE steam = '%s'", iOrbs[ client ], AuthStr);
} else {
Format(MysqlQuery, sizeof(MysqlQuery), "UPDATE sm_users SET money = %d WHERE id = %d", iOrbs[ client ], DBid[ client ]);
}
//LogMessage("%s", MysqlQuery);
SQL_FastQuery(db, MysqlQuery);
}



public OnMapStart(){
maxplayers = GetMaxClients();
}

public Action:Command_AddtoBank(client, args){
if (args < 2){
ReplyToCommand(client, "[SM] Usage: sm_bankadd <#userid|name> <money>");
return Plugin_Handled;
}

decl String:arg[65];
GetCmdArg(1, arg, sizeof(arg));

new target = FindTarget(client, arg, true , false);
if (target == -1)
return Plugin_Handled;

decl String:moneys[12];
GetCmdArg(2, moneys, sizeof(moneys));
new money = StringToInt(moneys);

SetiOrbs(target, GetiOrbs(target) + money);

PrintToChatAll("[NC] \x04[SM Bank]\x01 Admin has changed your money");

return Plugin_Handled;
}

public Action:Command_SetBank(client, args){
if (args < 2){
ReplyToCommand(client, "[SM] Usage: sm_bankset <#userid|name> <money>");
return Plugin_Handled;
}

decl String:arg[65];
GetCmdArg(1, arg, sizeof(arg));

new target = FindTarget(client, arg, true , false);
if (target == -1)
return Plugin_Handled;

decl String:moneys[12];
GetCmdArg(2, moneys, sizeof(moneys));
new money = StringToInt(moneys);

SetiOrbs(target, money);

PrintToChatAll("[NC] \x04[SM Bank]\x01 Admin has changed your money");

return Plugin_Handled;
}

stock SetiOrbs(client, money){
new maxmoney = GetConVarInt(g_cvars[MAXBANK]);

if(maxmoney > 0 && money > maxmoney) money = maxmoney;
if(money < 0) money = 0;

iOrbs[ client ] = money;

if(GetConVarInt(g_cvars[DBSAVE]) == 3){
SaveClientInfo(client);
}
}

stock GetiOrbs(client){
return iOrbs[ client ];
}

public OnClientDisconnect(client){
if(GetConVarInt(g_cvars[DBSAVE]) <= 2){
SaveClientInfo(client);
}
}


public EventRoundStart(Handle:event, const String:name[], bool:dontBroadcast){

new maxmoney, curmoney, bool:ShouldSave;
decl String:MoneyGain[32];

maxmoney = GetConVarInt(g_cvars[MAXBANK]);
//auto = GetConVarBool(g_cvars[AUTOMONEY]);

ShouldSave = (GetConVarInt(g_cvars[DBSAVE]) == 2);

for(new i = 1; i <= maxplayers ; i ++){
if(!IsClientInGame(i)) continue;
//No spectators...
if(GetClientTeam(i) <= 1) continue;

if(IHateFloods){
PrintToChat(i, "%t", "Available commands", "\x04", "\x01");
IHateFloods=false;
}

if(ShouldSave){
SaveClientInfo(i);
}

//if(auto){
// WithDrawClientMoney(client, "all");
//}

//PrintToChat(i, "Adding interest to you!");

curmoney = GetiOrbs(i);

curmoney += RoundFloat(FloatMul( float (curmoney) , GetConVarFloat(g_cvars[INTEREST]) / 100.0 ));


if(maxmoney > 0 && curmoney > maxmoney ){
curmoney = maxmoney;
}

//PrintToChat(i, "Your gain is: %d", gain);

if(curmoney != GetiOrbs(i)){
IntToMoney(curmoney - GetiOrbs(i), MoneyGain, 32);
PrintToChat(i, "%t", "Interested gained", "\x04", "\x01", MoneyGain);
SetiOrbs(i, curmoney);
}

//PrintToChat(i, "loop finished!");
}
}

public Action:BankMenu(client, args){
if (!GetConVarInt(g_cvars[ALLOWBANK])){
PrintToChat(client, "%t", "Bank Disabled", "\x04", "\x01");
return Plugin_Handled;
}

new Handle:menu = CreateMenu(MenuHandler1);
SetMenuTitle(menu, "Upgrade Orbs: %d", iOrbs[client]);
AddMenuItem(menu, "dep", "Deposit");
AddMenuItem(menu, "wit", "Withdraw");
AddMenuItem(menu, "bal", "Balance");
AddMenuItem(menu, "tran", "Transfer");

DisplayMenu(menu, client, 20);

return Plugin_Handled;
}

public MenuHandler1(Handle:menu, MenuAction:action, client, param2)
{
if (!GetConVarInt(g_cvars[ALLOWBANK])){
PrintToChat(client, "%t", "Bank Disabled", "\x04", "\x01");
CloseHandle(menu);
return;
}

/* Either Select or Cancel will ALWAYS be sent! */
if (action == MenuAction_Select)
{
LastMenuAction[client] = param2;
switch( param2 ){
case 0,1: {

new Handle:menu2 = CreateMenu(DepositWithMenu);
if(param2 == 0){
SetMenuTitle(menu2, "Bank - Deposit:");

new maxmoney = GetConVarInt(g_cvars[MAXBANK]);
new iOrbs = GetiOrbs(client);
new curmoney = GetiOrbs(client);

new maxdeposit = maxiOrbs - iOrbs;

if(curmoney == 0){
PrintToChat(client, "[SM Bank] You don't have any money!");
CloseHandle(menu2);
return;
}

if(maxdeposit == 0){
PrintToChat(client, "[SM Bank] Your bank is full!");
CloseHandle(menu2);
return;
}

if(maxdeposit > curmoney) maxdeposit = curmoney;

AddMoneyItems(menu2, maxdeposit);
}else{
SetMenuTitle(menu2, "Bank - Withdraw:");
new maxamount = 16000 - GetMoney(client);
new curmoney = GetiOrbs(client);

if(maxamount == 0){
PrintToChat(client, "[SM Bank] You can not hold more money!");
CloseHandle(menu2);
return;
}

if(curmoney == 0){
PrintToChat(client, "\x04[SM Bank]\x01 You don't have any money in your bank!");
CloseHandle(menu2);
return;
}

if(maxamount > curmoney) maxamount = curmoney;

AddMoneyItems(menu2, maxamount);
}

DisplayMenu(menu2, client, 20);
}
case 2:{
ShowBankStatus(client);
}
case 3:{
if (!GetConVarInt(g_cvars[TRANSFER])){
PrintToChat(client, "%t", "No Transfer", "\x04", "\x01");
return;
}
//I can not belive I am doing String:id
new Handle:menu2 = CreateMenu(TransferMenu), String:name[64], String:id[8];
SetMenuTitle(menu2, "Bank - Tranfer:");

new count =0;
for(new i = 1; i <= maxplayers ; i ++){
if(!IsClientInGame(i)) continue;
if(client == i) continue;
if(IsFakeClient(i)) continue;

//PrintToChat(client, "Checking passed: %d", i);

count++;

GetClientName(i, name, sizeof(name));
IntToString(i, id, sizeof(id));
AddMenuItem(menu2, id, name);
}
//PrintToChat(client, "Players found: %d", count);

if(count == 0){
PrintToChat(client, "There is not one connected in the server");
CloseHandle(menu2);
return;
}

DisplayMenu(menu2, client, 20);
}
}
}

/* If the menu has ended, destroy it */
if (action == MenuAction_End)
{
CloseHandle(menu);
}
}

stock RoundOff(num, dif){
new offset = num % dif;

if(offset > (dif/2)){
return num + dif - offset;
}

return num - offset;
}

public AddMoneyItems(Handle:menu2, Money){
new String:dummy[32], String:dummy2[32];
new testint;

new PartialMoney = Money / DWDCOUNT;
new RoundTo = GetConVarInt(g_cvars[MENUROUND]);
new LastValue;

for(new i=1; i< DWDCOUNT; i++){
testint = RoundOff(PartialMoney * i, RoundTo);

if(testint > Money) testint = Money;
if(testint == LastValue) continue;

LastValue = testint;

IntToMoney( testint , dummy , sizeof(dummy) );
IntToString( testint, dummy2, sizeof(dummy2) );

AddMenuItem(menu2, dummy2, dummy);

/*testint = StringToInt( MoneyCount );
if(testint > 0){
IntToMoney( testint , dummy , 32);
AddMenuItem(menu2, MoneyCount, dummy);
}
*/
}

IntToMoney( Money, dummy , sizeof(dummy) );
IntToString( Money, dummy2, sizeof(dummy2) );

AddMenuItem(menu2, dummy2, dummy);


//AddMenuItem(menu2, "all", "All");
}

public DepositWithMenu(Handle:menu, MenuAction:action, client, param2)
{
if (!GetConVarInt(g_cvars[ALLOWBANK])){
PrintToChat(client, "%t", "Bank Disabled", "\x04", "\x01");
CloseHandle(menu);
return;
}

/* Either Select or Cancel will ALWAYS be sent! */
if (action == MenuAction_Select)
{
new String:info[32];
new bool:found = GetMenuItem(menu, param2, info, sizeof(info));

if(!found)
return;

switch( LastMenuAction [ client ]){
case 0: {
DepositClientMoney( client, info );
}
case 1: {
WithDrawClientMoney( client, info );
}
case 3:{
if (!GetConVarInt(g_cvars[TRANSFER])){
PrintToChat(client, "%t", "No Transfer", "\x04", "\x01");
CloseHandle(menu);
return;
}
TransferClientMoney( client, TargetClientMenu[ client ], info);
}
}
} else if (action == MenuAction_End)
{
CloseHandle(menu);
}
}

public TransferMenu(Handle:menu, MenuAction:action, client, param2){
if (!GetConVarInt(g_cvars[ALLOWBANK])){
PrintToChat(client, "%t", "Bank Disabled", "\x04", "\x01");
CloseHandle(menu);
return;
}

if (!GetConVarInt(g_cvars[TRANSFER])){
PrintToChat(client, "%t", "No Transfer", "\x04", "\x01");
CloseHandle(menu);
return;
}

/* Either Select or Cancel will ALWAYS be sent! */
if (action == MenuAction_Select)
{
new String:info[32];
if(!GetMenuItem(menu, param2, info, sizeof(info)))
return;

TargetClientMenu[ client ] = StringToInt(info);

if(!IsClientConnected( TargetClientMenu[ client ] )){
PrintToChat(client, "%t", "False Target", "\x04", "\x01");
CloseHandle(menu);
return;
}


GetClientName(TargetClientMenu[ client ] , info, sizeof(info));

new Handle:menu2 = CreateMenu(DepositWithMenu);
SetMenuTitle(menu2, "Tranfer money to: %s", info);


new targetmoney = GetiOrbs(TargetClientMenu[ client ]);
new clientmoney = GetiOrbs(client);
new maxmoney = GetConVarInt(g_cvars[MAXBANK]);

new maxmenu = maxmoney - targetmoney;
if(maxmenu > clientmoney) maxmenu = clientmoney;


AddMoneyItems(menu2, maxmenu);

DisplayMenu(menu2, client, 20);

} else if (action == MenuAction_End){
CloseHandle(menu);
}
}

public Action:Deposit(client, args)
{
if (!GetConVarInt(g_cvars[ALLOWBANK])){
PrintToChat(client, "%t", "Bank Disabled", "\x04", "\x01");
return Plugin_Handled;
}

if(args < 1)
{
PrintToChat(client, "%t", "Deposit usage", "\x04", "\x01");
return Plugin_Handled;
}

new String:szCmd[12];
GetCmdArg(1, szCmd, sizeof(szCmd));

DepositClientMoney(client, szCmd);

return Plugin_Handled;
}

public TransferClientMoney( client, target, String:amount[] ){
if(!IsClientConnected(client))
return;
if(!IsClientConnected(target)){
PrintToChat(client, "%t", "No Transfer", "\x04", "\x01");
return;
}
if (!GetConVarInt(g_cvars[TRANSFER])){
PrintToChat(client, "%t", "False Target", "\x04", "\x01");
return;
}

//LogMessage("Transfear: %d %d %s", client, target, amount);

new deposit,money, maxmoney, targetmoney;

money = GetiOrbs(client);
targetmoney = GetiOrbs(target);
maxmoney = GetConVarInt(g_cvars[MAXBANK]);

if(StrEqual(amount, "all"))
deposit = money;
else{
deposit = StringToInt(amount);
if(deposit > money){
PrintToChat(client, "%t", "Deposit not enough money", "\x04", "\x01");
return;
}
}

if(deposit == 0){ return; }

//LogMessage("Transfear2: %d %d %d %d", deposit,money, maxmoney, targetmoney);

//LogMessage("client: %d | Target: %d", client, target);
//LogMessage("money: %d | targetmoney: %d | deposit: %d | maxmoney: %d", money, targetmoney, deposit, maxmoney);

new String:name[32], String:targetname[32], String:depositstr[12];

GetClientName(client , name, sizeof(name));
GetClientName(target , targetname, sizeof(targetname));

/*if(maxmoney > 0 && (targetmoney + deposit) > maxmoney){
deposit = maxmoney - targetmoney;
if(deposit <= 0){
PrintToChat(client, "%t" ,"TargetTotalLimit", "\x04", "\x01", targetname);
return;
}
IntToMoney(deposit, depositstr, 12);
PrintToChat(client, "%t" ,"TargetLimit", "\x04", "\x01", targetname, depositstr);
}*/

targetmoney += deposit;
money -= deposit;

if(maxmoney > 0){
if(targetmoney > maxmoney ){
new difference = targetmoney - maxmoney;

targetmoney = maxmoney;

money += difference;
}else if(targetmoney == maxmoney ){
PrintToChat(client, "%t" ,"TargetTotalLimit", "\x04", "\x01", targetname);
return;
}
}

IntToMoney( GetiOrbs(client) - money ,depositstr, 12);

SetiOrbs(client, money);
SetiOrbs(target, targetmoney);

PrintToChat(target, "%t", "TargetDeposited","\x04", "\x01", name, depositstr);
PrintToChat(client, "%t", "ClientTargetDeposited","\x04", "\x01", targetname, depositstr);
}

public DepositClientMoney(client, String:szCmd[]){
new iOrbs, feemoney, maxmoney, money, deposit;
decl String:feestr[12], String:depositstr[12];

money = GetMoney(client);

if(StrEqual(szCmd, "all"))
deposit = money;
else
deposit = StringToInt(szCmd);

if(deposit > money){
PrintToChat(client, "%t", "Deposit not enough money", "\x04", "\x01");
return;
}

iOrbs = GetiOrbs(client);
feemoney = GetConVarInt(g_cvars[DEPOSITFEE]);
maxmoney = GetConVarInt(g_cvars[MAXBANK]);

IntToMoney(feemoney, feestr, 12);

if(deposit < feemoney){
PrintToChat(client, "%t", "You need at least", feestr ,"\x04", "\x01");
return;
}

deposit -= feemoney;
iOrbs += deposit;

if(maxmoney > 0 && iOrbs > maxmoney){
PrintToChat(client, "%t", "Bank Full", maxmoney, "\x04", "\x01");
deposit = iOrbs - maxmoney;
iOrbs = maxmoney;
if(deposit == 0)
return;
}

SetiOrbs(client, iOrbs);
SetMoney(client, money - deposit - feemoney);

//SetMoney(client, -deposit - feemoney + money);
IntToMoney(deposit, depositstr, 12);


PrintToChat(client, "%t", "Deposit successfully", depositstr, feestr ,"\x04", "\x01");
}

public Action:WithDraw(client, args)
{
if (!GetConVarInt(g_cvars[ALLOWBANK])){
PrintToChat(client, "%t", "Bank Disabled", "\x04", "\x01");
return Plugin_Handled;
}

if(args < 1)
{
PrintToChat(client, "%t", "Withdraw usage", "\x04", "\x01");
}

new String:szCmd[12];
GetCmdArg(1, szCmd, sizeof(szCmd));

WithDrawClientMoney(client, szCmd);

return Plugin_Handled;
}

public WithDrawClientMoney(client, String:szCmd[]){
if (GetConVarInt(g_cvars[PISTOLROUND]) == 1){
if(IsPistolRound()){
PrintToChat(client, "%t", "PistolRoundBlocked", "\x04", "\x01");
return;
}
}

new getmoney = GetiOrbs(client);
new AmountToWith;
if(StrEqual(szCmd, "all"))
{
new iBalance = 16000 - GetMoney(client);

if(getmoney < iBalance)
{
AmountToWith = getmoney;
}
else
{
AmountToWith = iBalance;
}
}
else
{
new iMoney = StringToInt(szCmd);

if(getmoney < iMoney)
{
PrintToChat(client, "%t", "Withdraw not enough money", "\x04", "\x01");
return;
}

if(GetMoney(client) + iMoney <= 16000)
{
AmountToWith = iMoney;
}
else
{
PrintToChat(client, "%t", "Withdraw max error", "\x04", "\x01");
return;
}
}

SetMoney(client, AmountToWith, true);
SetiOrbs(client, getmoney - AmountToWith);


new String:WithStr[12];
IntToMoney(AmountToWith, WithStr, 12);

PrintToChat(client, "%t", "Withdraw successfully", WithStr, "\x04", "\x01");
}

public Action:BankStatus(client, args)
{
ShowBankStatus(client);
return Plugin_Handled;
}

stock ShowBankStatus(client){
new String:WithStr[12];
new money;
money = GetiOrbs(client);
IntToMoney( money , WithStr, 12);
//PrintToChat(client, "%d -- %s", money, WithStr);
PrintToChat(client, "%t", "Bankstatus", WithStr, "\x04", "\x01");
}

stock SetMoney(client, amount, add = false){
if(add)
amount += GetMoney(client);
if(amount > 16000) amount = 16000;
if(amount < 0) amount = 0;

SetEntData(client,g_iAccount,amount,4,true);
}

stock GetMoney(client){
return GetEntData(client,g_iAccount,4);
}

stock IntToMoney(theint, String:result[], maxlen){
new slen, pointer, String:intstr[maxlen], bool:negative;

negative = theint < 0;
if(negative) theint *= -1;

IntToString(theint, intstr, maxlen);
slen = strlen(intstr);

theint = slen % 3;
if(theint == 0) theint = 3;
Format(result,theint + 1, "%s", intstr);

slen -= theint;
pointer = theint + 1;
for(new i = theint; i <= slen ; i += 3){
pointer += 4;
Format(result, pointer, "%s,%s",result, intstr);
}

if(negative)
Format(result, maxlen, "$-%s", result);
else
Format(result, maxlen, "$%s", result);
}

public OnClientAuthorized(id){
IHateFloods[id] = true;
}

stock bool:IsPistolRound(){
new i, startmoney;

if( g_cvars[CSSTARTMONEY] != INVALID_HANDLE )
startmoney = GetConVarInt( g_cvars[CSSTARTMONEY] );
else
startmoney = 800;


for(i=1; i<=maxplayers; i++){
if(IsClientInGame(i))
if(GetMoney(i) > startmoney)
return false;
}
return true;
}
MaxHealth = CreateConVar("survivor_max_health", "100", "Amount of life to change health to upon spawn", FCVAR_PLUGIN, true, 1.0, false, _);

iMHealthMultiplier = CreateConVar("survivor_max_health_multiplier", "20", "Maximum Multiplier of Health by 5.", FCVAR_PLUGIN, true, 1.00, true, 32.00);
iMArmorMultiplier = CreateConVar("survivor_max_armor_multiplier", "20", "Maximum Multiplier of Armor by 5.", FCVAR_PLUGIN, true, 1.00, true, 32.00);
iMArmorFactor = CreateConVar("survivor_max_armor_factor", "2", "Maximum Factor of Armor.", FCVAR_PLUGIN, true, 1.00, true, 4.00);
iOrbProbability = CreateConVar("survivor_orb_probability", "0.25", "The probability of an orb to drop.", FCVAR_PLUGIN, true, 0.00, true, 1.00);

L4DFirstAidKit = FindConVar("first_aid_kit_max_heal");
L4DPainPills = FindConVar("pain_pills_health_threshold");
}

public Action:CommandGiveOrbs(client, args)
{
if (args < 1)
{
ReplyToCommand(client, "[SM] Usage:sm_giveorbs <#userid|name> <amount>");
return Plugin_Handled;
}
decl String:arg[MAX_NAME_LENGTH], String:arg2[4];
GetCmdArg(1, arg, sizeof(arg));
if (args > 1)
{
GetCmdArg(2, arg2, sizeof(arg2));
}
decl String:target_name[MAX_TARGET_LENGTH];
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
new targetclient;
if ((target_count = ProcessTargetString(
arg,
client,
target_list,
MAXPLAYERS,
COMMAND_FILTER_ALIVE,
target_name,
sizeof(target_name),
tn_is_ml)) > 0)
{
for (new i = 0; i < target_count; i++)
{
targetclient = target_list;
iOrbs[targetclient] += StringToInt(arg2);
}
}
else
{
ReplyToTargetError(client, target_count);
}
return Plugin_Handled;
}

public ConVarChange(Handle:cvar, const String:oldVal[], const String:newVal[])
{
SetConVarInt(L4DFirstAidKit, GetConVarInt(MaxHealth));
SetConVarInt(L4DPainPills, GetConVarInt(MaxHealth));
}

public event_PlayerSpawn(Handle:event, const String:name[], bool:Broadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));

if(GetClientTeam(client) == 2)
{
SetEntData(client, FindDataMapOffs(client, "m_iMaxHealth"), 100 + iMHealth[client] * 5, 4, true);
SetEntData(client, FindDataMapOffs(client, "m_ArmorValue"), m_iArmor[client], 4, true);
}
}

public event_SetStatus(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event,"userid"));
SetEntData(client, FindDataMapOffs(client, "m_iMaxHealth"), 100 + iMHealth[client] * 5, 4, true);
SetEntData(client, FindDataMapOffs(client, "m_ArmorValue"), m_iArmor[client], 4, true);
}

public event_Rescued(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event,"victim"));
SetEntData(client, FindDataMapOffs(client, "m_iMaxHealth"), 100 + iMHealth[client] * 5, 4, true);
SetEntData(client, FindDataMapOffs(client, "m_ArmorValue"), m_iArmor[client], 4, true);
}

public event_PlayerReplace(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event,"player"));
SetEntData(client, FindDataMapOffs(client, "m_iMaxHealth"), 100 + iMHealth[client] * 5, 4, true);
SetEntData(client, FindDataMapOffs(client, "m_ArmorValue"), m_iArmor[client], 4, true);
}

public event_BotReplace(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event,"player"));
SetEntData(client, FindDataMapOffs(client, "m_iMaxHealth"), 100 + iMHealth[client] * 5, 4, true);
SetEntData(client, FindDataMapOffs(client, "m_ArmorValue"), m_iArmor[client], 4, true);
}

public event_LeftStart(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event,"userid"));
SetEntData(client, FindDataMapOffs(client, "m_iMaxHealth"), 100 + iMHealth[client] * 5, 4, true);
SetEntData(client, FindDataMapOffs(client, "m_ArmorValue"), m_iArmor[client], 4, true);
}

public Action:CheckStatus(client, args)
{
new iMaxHealth = GetEntData(client, FindDataMapOffs(client, "m_iMaxHealth"), 4);
new iHealth = GetEntData(client, FindDataMapOffs(client, "m_iHealth"), 4);
new iMaxArmor = iMArmor[client] * GetConVarInt(iMArmorFactor) * 5;
new iArmor = GetEntData(client, FindDataMapOffs(client, "m_ArmorValue"), 4);

PrintToChat(client, "\x05Health: \x01%i/%i\n\x05Armor: \x01%i/%i", iHealth, iMaxHealth, iArmor/GetConVarInt(iMArmorFactor), iMaxArmor/GetConVarInt(iMArmorFactor));

new Handle:menu = CreateMenu(StatusMenuHandler);
SetMenuTitle(menu, "Upgrade Orbs: %d", iOrbs[client]);
AddMenuItem(menu, "option1", "Апы");
AddMenuItem(menu, "option2", "Скилл");
AddMenuItem(menu, "option3", "Бонус");
AddMenuItem(menu, "option4", "Статус");
AddMenuItem(menu, "option5", "Банк");
SetMenuExitButton(menu, true);
DisplayMenu(menu, client, MENU_TIME_FOREVER);

return Plugin_Handled;
}

public StatusMenuHandler(Handle:menu, MenuAction:action, client, itemNum)
{
if (action == MenuAction_Select)
{
switch (itemNum)
{
case 0:
{
FakeClientCommand(client, "sm_itemmenu");
}
case 1:
{
FakeClientCommand(client, "sm_skillmenu");
}
case 2:
{
FakeClientCommand(client, "sm_bonusmenu");
}
case 3:
{
if(b_ShowArmor[client] == false)
{
b_ShowArmor[client] = true;
PrintToChat(client, "\x04Показатели \x01is now \x05Вкл.");
}
else
{
b_ShowArmor[client] = false;
PrintToChat(client, "\x04Показатели \x01is now \x05Выкл.");
}
}
}
}
}

public Action:UpgradeMenu(client, args)
{
new Handle:menu = CreateMenu(UpgradeMenuHandler);
SetMenuTitle(menu, "Upgrade Orbs: %d", iOrbs[client]);
AddMenuItem(menu, "option1", "Здоровье (20 Orbs)");
AddMenuItem(menu, "option2", "Броня (10 Orbs)");
AddMenuItem(menu, "option3", "Здоровье +25 (200 Orbs)");
AddMenuItem(menu, "option4", "броня +25 (100 Orbs)");
SetMenuExitButton(menu, true);
DisplayMenu(menu, client, MENU_TIME_FOREVER);

return Plugin_Handled;
}

public UpgradeMenuHandler(Handle:menu, MenuAction:action, client, itemNum)
{
if (action == MenuAction_Select)
{
switch (itemNum)
{
case 0:
{
if(iOrbs[client] >= 20)
{
if(iMHealth[client] < GetConVarInt(iMHealthMultiplier))
{
iOrbs[client] -= 20;
iMHealth[client] = iMHealth[client] + 1;

SetEntData(client, FindDataMapOffs(client, "m_iMaxHealth"), 100 + iMHealth[client] * 5, 4, true);
new iMaxHealth = GetEntData(client, FindDataMapOffs(client, "m_iMaxHealth"), 4);
new iHealth = GetEntData(client, FindDataMapOffs(client, "m_iHealth"), 4);

PrintToChat(client, "\x05Ап здоровья: \x01%i/%i", iHealth, iMaxHealth);
FakeClientCommand(client, "sm_itemmenu");
}
else
{
PrintToChat(client, "\x01У тебя \x05максимум здоровья\x01.");
}
}
else
{
PrintToChat(client, "\x01Тебе не хватает \x05Орбов\x01.");
}
}
case 1:
{
if(iOrbs[client] >= 10)
{
if(iMArmor[client] < GetConVarInt(iMArmorMultiplier))
{
iOrbs[client] -= 10;
iMArmor[client] = iMArmor[client] + 1;

new iMaxArmor = iMArmor[client] * GetConVarInt(iMArmorFactor) * 5;
new iArmor = GetEntData(client, FindDataMapOffs(client, "m_ArmorValue"), 4);

PrintToChat(client, "\x05Ап брони: \x01%i/%i", iArmor/GetConVarInt(iMArmorFactor), iMaxArmor/GetConVarInt(iMArmorFactor));
FakeClientCommand(client, "sm_itemmenu");
}
else
{
PrintToChat(client, "\x01У тебя \x05максимум брони\x01.");
}
}
else
{
PrintToChat(client, "\x01Тебе не хватает \x05Орбов\x01.");
}
}
// Health +25 Restore
case 2:
{
if(iOrbs[client] >= 100)
{
new iMaxHealth = GetEntData(client, FindDataMapOffs(client, "m_iMaxHealth"), 4);
new iHealth = GetEntData(client, FindDataMapOffs(client, "m_iHealth"), 4);
new iHealthDif = iMaxHealth - iHealth;
if(iHealthDif >= 25)
{
iOrbs[client] -= 200;
SetEntData(client, FindDataMapOffs(client, "m_iHealth"), GetEntData(client, FindDataMapOffs(client, "m_iHealth"), 4) + 25, 4, true);

PrintToChat(client, "\x05+25 Health Restored");
FakeClientCommand(client, "sm_itemmenu");
}
else
{
PrintToChat(client, "\x01You have the \x05Maximum Health\x01.");
}
}
else
{
PrintToChat(client, "\x01You do not have enough \x05Orbs\x01.");
}
}
// Armor +25 Restore
case 3:
{
if(iOrbs[client] >= 50)
{
new iMaxArmor = iMArmor[client] * GetConVarInt(iMArmorFactor) * 5;
new iArmor = GetEntData(client, FindDataMapOffs(client, "m_ArmorValue"), 4);
new iArmorDif = iMaxArmor - iArmor;
if(iArmorDif >= 25)
{
iOrbs[client] -= 100;
SetEntData(client, FindDataMapOffs(client, "m_ArmorValue"), GetEntData(client, FindDataMapOffs(client, "m_ArmorValue"), 4) + 50, 4, true);

PrintToChat(client, "\x05+25 Armor Restored");
FakeClientCommand(client, "sm_itemmenu");
}
else
{
PrintToChat(client, "\x01You have the \x05Maximum Armor\x01.");
}
}
else
{
PrintToChat(client, "\x01You do not have enough \x05Orbs\x01.");
}
}
}
}
}

public Action:SkillMenu(client, args)
{
new Handle:menu = CreateMenu(SkillMenuHandler);
SetMenuTitle(menu, "Upgrade Orbs: %d", iOrbs[client]);
AddMenuItem(menu, "option1", "BOMB (10 Orbs)");
AddMenuItem(menu, "option2", "JUMPED (10 Orbs)");
AddMenuItem(menu, "option3", "SMOKE(20 Orbs)");
AddMenuItem(menu, "option4", "HELP (10 Orbs)");
AddMenuItem(menu, "option5", "PROTECT (10 Orbs)");
AddMenuItem(menu, "option6", "ASSIST (20 Orbs)");
AddMenuItem(menu, "option7", "HEAL (10 Orbs)");
AddMenuItem(menu, "option8", "RESCUE (10 Orbs)");
AddMenuItem(menu, "option9", "UNTOUCHABLE (20 Orbs)");
AddMenuItem(menu, "option10", "MELEE (10 Orbs)");
SetMenuExitButton(menu, true);
DisplayMenu(menu, client, MENU_TIME_FOREVER);

return Plugin_Handled;
}

public SkillMenuHandler(Handle:menu, MenuAction:action, client, itemNum)
{
if (action == MenuAction_Select)
{
switch (itemNum)
{
case 0:
{
if(iOrbs[client] >= 10)
{
if(iSkill01[client] != 1)
{
iOrbs[client] -= 10;
iSkill01[client] = 1;

PrintToChat(client, "\x03BOMB\n\x01- Pipebomb/Molotov Bonus Enabled.");
FakeClientCommand(client, "sm_skillmenu");
}
else
{
PrintToChat(client, "You have already purchased this item.");
}
}
else
{
PrintToChat(client, "\x01You do not have enough \x05Orbs\x01.");
}
}
case 1:
{
if(iOrbs[client] >= 10)
{
if(iSkill02[client] != 1)
{
iOrbs[client] -= 10;
iSkill02[client] = 1;

PrintToChat(client, "\x03JUMPED\n\x01- Hunter Anti-Jump Bonus Enabled.");
FakeClientCommand(client, "sm_skillmenu");
}
else
{
PrintToChat(client, "You have already purchased this item.");
}
}
else
{
PrintToChat(client, "\x01You do not have enough \x05Orbs\x01.");
}
}
case 2:
{
if(iOrbs[client] >= 20)
{
if(iSkill03[client] != 1)
{
iOrbs[client] -= 20;
iSkill03[client] = 1;

PrintToChat(client, "\x03SMOKE\n\x01- Kill Smokers Bonus Enabled.");
FakeClientCommand(client, "sm_skillmenu");
}
else
{
PrintToChat(client, "You have already purchased this item.");
}
}
else
{
PrintToChat(client, "\x01You do not have enough \x05Orbs\x01.");
}
}
case 3:
{
if(iOrbs[client] >= 10)
{
if(iSkill04[client] != 1)
{
iOrbs[client] -= 10;
iSkill04[client] = 1;

PrintToChat(client, "\x03HELP\n\x01- Revive Player Bonus Enabled.");
FakeClientCommand(client, "sm_skillmenu");
}
else
{
PrintToChat(client, "You have already purchased this item.");
}
}
else
{
PrintToChat(client, "\x01You do not have enough \x05Orbs\x01.");
}
}
case 4:
{
if(iOrbs[client] >= 10)
{
if(iSkill05[client] != 1)
{
iOrbs[client] -= 10;
iSkill05[client] = 1;

PrintToChat(client, "\x03PROTECT\n\x01- Protect Player Bonus Enabled.");
FakeClientCommand(client, "sm_skillmenu");
}
else
{
PrintToChat(client, "You have already purchased this item.");
}
}
else
{
PrintToChat(client, "\x01You do not have enough \x05Orbs\x01.");
}
}
case 5:
{
if(iOrbs[client] >= 20)
{
if(iSkill06[client] != 1)
{
iOrbs[client] -= 20;
iSkill06[client] = 1;

PrintToChat(client, "\x03ASSIST\n\x01- Give Pills Bonus Enabled.");
FakeClientCommand(client, "sm_skillmenu");
}
else
{
PrintToChat(client, "You have already purchased this item.");
}
}
else
{
PrintToChat(client, "\x01You do not have enough \x05Orbs\x01.");
}
}
case 6:
{
if(iOrbs[client] >= 10)
{
if(iSkill07[client] != 1)
{
iOrbs[client] -= 10;
iSkill07[client] = 1;

PrintToChat(client, "\x03HEAL\n\x01- Give Medkit Bonus Enabled.");
FakeClientCommand(client, "sm_skillmenu");
}
else
{
PrintToChat(client, "You have already purchased this item.");
}
}
else
{
PrintToChat(client, "\x01You do not have enough \x05Orbs\x01.");
}
}
case 7:
{
if(iOrbs[client] >= 10)
{
if(iSkill08[client] != 1)
{
iOrbs[client] -= 10;
iSkill08[client] = 1;

PrintToChat(client, "\x03RESCUE\n\x01- Save From Special Bonus Enabled.");
FakeClientCommand(client, "sm_skillmenu");
}
else
{
PrintToChat(client, "You have already purchased this item.");
}
}
else
{
PrintToChat(client, "\x01You do not have enough \x05Orbs\x01.");
}
}
case 8:
{
if(iOrbs[client] >= 20)
{
if(iSkill09[client] != 1)
{
iOrbs[client] -= 20;
iSkill09[client] = 1;

PrintToChat(client, "\x03UNTOUCHABLE\n\x01- Perfect Tank Kill Bonus Enabled.");
FakeClientCommand(client, "sm_skillmenu");
}
else
{
PrintToChat(client, "You have already purchased this item.");
}
}
else
{
PrintToChat(client, "\x01You do not have enough \x05Orbs\x01.");
}
}
case 9:
{
if(iOrbs[client] >= 10)
{
if(iSkill10[client] != 1)
{
iOrbs[client] -= 10;
iSkill10[client] = 1;

PrintToChat(client, "\x03MELEE\n\x01- Melee Kill Bonus Enabled.");
FakeClientCommand(client, "sm_skillmenu");
}
else
{
PrintToChat(client, "You have already purchased this item.");
}
}
else
{
PrintToChat(client, "\x01You do not have enough \x05Orbs\x01.");
}
}
}
}
}

public Action:BonusMenu(client, args)
{
new Handle:menu = CreateMenu(BonusMenuHandler);
SetMenuTitle(menu, "Team Bonus: %d", iTeamBonus);
AddMenuItem(menu, "option1", "Team Heal (2000)");
SetMenuExitButton(menu, true);
DisplayMenu(menu, client, MENU_TIME_FOREVER);

return Plugin_Handled;
}

public BonusMenuHandler(Handle:menu, MenuAction:action, client, itemNum)
{
decl String:iName[MAX_NAME_LENGTH];
GetClientName(client, iName, sizeof(iName));
if (action == MenuAction_Select)
{

switch (itemNum)
{
case 0:
{
if(iTeamBonus >= 2000)
{
iTeamBonus -= 2000;

for(new i=1; i <= MaxClients; i++)
{
if(IsClientInGame(i) && GetClientTeam(i) == 2)
{
new iMaxHealth = GetEntData(i, FindDataMapOffs(i, "m_iMaxHealth"), 4);
SetEntData(i, FindDataMapOffs(i, "m_iHealth"), iMaxHealth, 4, true);
}
}

PrintToChatAll("\x03%s \x01used \x04Team Heal\x01.", iName);
FakeClientCommand(client, "sm_bonusmenu");
}
else
{
PrintToChat(client, "\x01You do not have enough \x05Team Bonus\x01.");
}
}
}
}
}

public event_AwardEarned(Handle:event, const String:name[], bool:Broadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
new achievementid = GetEventInt(event, "award");

// 15 - Explosive/Fire Kill - BOMB +100
if(achievementid == 15)
{
if(iSkill01[client] == 1)
{

iTeamBonus += 100;
PrintToChatAll("\x04BOMB \x03+100");

}
}
// 21 - Hunter AntiJump - JUMPED +50
if(achievementid == 21)
{
if(iSkill02[client] == 1)
{

iTeamBonus += 50;
PrintToChatAll("\x04JUMPED \x03+50");
}
}
// 27 - Tongue Twister - SMOKE +25
if(achievementid == 27)
{
if(iSkill03[client] == 1)
{
iTeamBonus += 25;
PrintToChatAll("\x04SMOKE \x03+25");
}
}
// 66 - Revive - HELP +25
if(achievementid == 66)
{
if(iSkill04[client] == 1)
{

iTeamBonus += 25;
PrintToChatAll("\x04HELP \x03+25");
}
}
// 67 - Protect Player - PROTECT +50
if(achievementid == 67)
{
if(iSkill05[client] == 1)
{
iTeamBonus += 50;
PrintToChatAll("\x04PROTECT \x03+50");
}
}
// 68 - Give Pills - ASSIST +50
if(achievementid == 68)
{
if(iSkill06[client] == 1)
{
iTeamBonus += 50;
PrintToChatAll("\x04ASSIST \x03+50");
}
}
// 69 - Heal Someone - HEAL +100
if(achievementid == 69)
{
if(iSkill07[client] == 1)
{
iTeamBonus += 100;
PrintToChatAll("\x04HEAL \x03+100");

}
}
// 75 - Protect From Hunter / Smoker - RESCUE +100
if(achievementid == 75)
{
if(iSkill08[client] == 1)
{
iTeamBonus += 100;
PrintToChatAll("\x04RESCUE \x03+100");
}
}
// 80 - Tank Killed (No DMG) - UNTOUCHABLE +200
if(achievementid == 80)
{
if(iSkill09[client] == 1)
{
iTeamBonus += 200;
PrintToChatAll("\x04UNTOUCHABLE \x03+200");
}
}
// 22 - Melee Kill - MELEE +25
if(achievementid == 22)
{
if(iSkill10[client] == 1)
{
iTeamBonus += 25;
PrintToChatAll("\x04MELEE\x03+25");
}
}
}

public Action:event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "attacker"));
new Victim = GetClientOfUserId(GetEventInt(event, "userid"));

decl String:VictimName[64];
GetClientName(Victim, VictimName, sizeof(VictimName));
GetEventString(event, "victimname", VictimName, sizeof(VictimName));

if(StrEqual(VictimName, "Smoker", false))
{
new OrbsCollected = ORBS_SMOKER + ORBS_SMOKER * iOrbFactor[client];
iOrbs[client] = iOrbs[client] + OrbsCollected;
if(b_ShowArmor[client] == true)
{
PrintToChat(client, "\x01You picked up \x05%i Orb(s)\x01.", OrbsCollected);
}
if (GetEventBool(event, "headshot"))
{
CreateTimer(1.0, event_HeadShotBonus);
}
if (iChokeCheck == 0)
{
CreateTimer(2.0, event_ChokeBonus);
}
iChokeCheck = 0;
}
else if(StrEqual(VictimName, "Boomer", false))
{
new OrbsCollected = ORBS_BOOMER + ORBS_BOOMER * iOrbFactor[client];
iOrbs[client] = iOrbs[client] + OrbsCollected;
if(b_ShowArmor[client] == true)
{
PrintToChat(client, "\x01You picked up \x05%i Orb(s)\x01.", OrbsCollected);
}
if (GetEventBool(event, "headshot"))
{
CreateTimer(1.0, event_HeadShotBonus);
}
if (iVomitCheck == 0)
{
CreateTimer(2.0, event_VomitBonus);
}
if (iBoomerExplodedCheck == 0)
{
CreateTimer(3.0, event_BoomerExplodedBonus);
}
iVomitCheck = 0;
iBoomerExplodedCheck = 0;
}
else if(StrEqual(VictimName, "Hunter", false))
{
new OrbsCollected = ORBS_HUNTER + ORBS_HUNTER * iOrbFactor[client];
iOrbs[client] = iOrbs[client] + OrbsCollected;
if(b_ShowArmor[client] == true)
{
PrintToChat(client, "\x01You picked up \x05%i Orb(s)\x01.", OrbsCollected);
}
if (GetEventBool(event, "headshot"))
{
CreateTimer(1.0, event_HeadShotBonus);
}
}
else if(StrEqual(VictimName, "Witch", false))
{
new OrbsCollected = ORBS_WITCH + ORBS_WITCH * iOrbFactor[client];
iOrbs[client] = iOrbs[client] + OrbsCollected;
if(b_ShowArmor[client] == true)
{
PrintToChat(client, "\x01You picked up \x05%i Orb(s)\x01.", OrbsCollected);
}
}
else if(StrEqual(VictimName, "Tank", false))
{
new OrbsCollected = ORBS_TANK + ORBS_TANK * iOrbFactor[client];
iOrbs[client] = iOrbs[client] + OrbsCollected;
if(b_ShowArmor[client] == true)
{
PrintToChat(client, "\x01You picked up \x05%i Orb(s)\x01.", OrbsCollected);
}
}
}

public Action:event_InfectedDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "attacker"));

new GetProbability = GetRandomInt(1, 100);

if(GetProbability < GetConVarFloat(iOrbProbability) * 100)
{
new OrbsCollected = ORBS_INFECTED + ORBS_INFECTED * iOrbFactor[client];
iOrbs[client] = iOrbs[client] + OrbsCollected;
if(b_ShowArmor[client] == true)
{
PrintToChat(client, "\x01You picked up \x05%i Orb(s)\x01.", OrbsCollected);
}
}
}

public event_HealSuccess(Handle:event, const String:name[], bool:Broadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "subject"));

m_iArmor[client] = iMArmor[client] * GetConVarInt(iMArmorFactor) * 5;
SetEntData(client, FindDataMapOffs(client, "m_ArmorValue"), m_iArmor[client], 4, true);
}

public event_PlayerHurt(Handle:event, const String:name[], bool:Broadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));

m_iArmor[client] = GetEntData(client, FindDataMapOffs(client, "m_ArmorValue"), 4);

if(b_ShowArmor[client] == true)
{
new iMaxHealth = GetEntData(client, FindDataMapOffs(client, "m_iMaxHealth"), 4);
new iHealth = GetEntData(client, FindDataMapOffs(client, "m_iHealth"), 4);
new iMaxArmor = iMArmor[client] * GetConVarInt(iMArmorFactor) * 5;
new iArmor = GetEntData(client, FindDataMapOffs(client, "m_ArmorValue"), 4);

PrintHintText(client, "\x05Health: %i/%i\nArmor: %i/%i", iHealth, iMaxHealth, iArmor/GetConVarInt(iMArmorFactor), iMaxArmor/GetConVarInt(iMArmorFactor));
}
}

public Action:event_HeadShotBonus(Handle:timer, any:client)
{
PrintToChatAll("\x04HEADSHOT \x03+50");
}

public Action:event_ChokeBonus(Handle:timer, any:client)
{
PrintToChatAll("\x04CHOKE FREE \x03+50");
}

public Action:event_VomitBonus(Handle:timer, any:client)
{
PrintToChatAll("\x04VOMIT BAG \x03+50");
}

public Action:event_BoomerExplodedBonus(Handle:timer, any:client)
{
PrintToChatAll("\x04DISTANT \x03+100");
}

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

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

public Action:event_BoomerExploded(Handle:event, const String:name[], bool:dontBroadcast)
{
if (GetEventInt(event, "splashedbile") == 1)
{
iVomitCheck = 1;
iBoomerExplodedCheck = 1;
}
}
Изображение
Изображение

Ответить