PDA

View Full Version : [REQ] CS:GO Plugins


Dirty king
07-05-2016, 04:08
:)Hi,Man.

I need a Plugins!

Function like this:
Each round, after the third (or fifth) player kills reward money And displayed.

such as:
Kill the first player, 5000 bonus money.
Kill the second player, reward 3000 money.
Kill the third player, 1000 bonus money.
Kill the fourth player, 500 reward money.
Kill the fifth player, 100 reward money.


:):):)thank you!



note:
I am a Chinese person, please forgive my English ...

Dirty king
07-07-2016, 08:14
I'm sure this code can be cleaned up a lot and it's probably very inefficient but here you go, I've tested it and it works fine.
#pragma semicolon 1
#pragma newdecls required

#include <sourcemod>

int g_iKiller1, g_iKiller2, g_iKiller3, g_iKiller4, g_iKiller5;
int g_iOffset;

public void OnPluginStart()
{
HookEvent("round_start", OnRoundStart);
HookEvent("player_death", OnPlayerDeath);
g_iOffset = FindSendPropInfo("CCSPlayer", "m_iAccount");
}

public Action OnRoundStart(Handle event, const char[] name, bool dontBroadcast)
{
g_iKiller1 = -1;
g_iKiller2 = -1;
g_iKiller3 = -1;
g_iKiller4 = -1;
g_iKiller5 = -1;
}

public Action OnPlayerDeath(Handle event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(GetEventInt(event, "attacker"));
if(0 < client <= MaxClients)
{
int money = GetEntData(client, g_iOffset, 4);
if(g_iKiller1 == -1)
{
g_iKiller1 = client;
GiveMoney(client, money, 5000, "1st");
}
else if(g_iKiller2 == -1)
{
g_iKiller2 = client;
GiveMoney(client, money, 3000, "2nd");
}
else if(g_iKiller3 == -1)
{
g_iKiller3 = client;
GiveMoney(client, money, 1000, "3rd");
}
else if(g_iKiller4 == -1)
{
g_iKiller4 = client;
GiveMoney(client, money, 500, "4th");
}
else if(g_iKiller5 == -1)
{
g_iKiller5 = client;
GiveMoney(client, money, 100, "5th");
}
}
}

void GiveMoney(int client, int money, int reward, char[] print)
{
int total = money + reward;
SetEntData(client, g_iOffset, total);
PrintToChat(client, "You recieved $%i for killing the %s player.", reward, print);
}
Cool, thank you!

I have another question?

Assists reward money can be obtained, and displayed?