New Member
|
12-12-2017
, 09:04
Problem with CS:GO VIP plugin
|
#1
|
Hello, I`ve some problems with my VIP plugin from generator... I set 200$ extra for VIP every round but it`s not working, VIPs are earning extra money just only at warmup starts :/ Any ideas? Below I`m sending plugin code
Code:
#include <sourcemod>
#include <cstrike>
#include <sdktools>
#pragma semicolon 1
#pragma newdecls required
Handle WelcomeHUD;
char tag[64] = "[VIP]";
public void OnPluginStart()
{
HookEvent("bomb_planted", EventBombPlanted);
HookEvent("bomb_defused", EventBombDefused);
HookEvent("player_spawn", PlayerSpawn);
HookEvent("player_death", PlayerDeath);
WelcomeHUD = CreateHudSynchronizer();
}
public Action PlayerSpawn(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(GetEventInt(event, "userid"));
if(!IsPlayerVIP(client)) return;
SetEntProp(client, Prop_Send, "m_ArmorValue", 100);
SetEntityHealth(client, 110);
int money = GetEntProp(client, Prop_Send, "m_iAccount");
SetEntProp(client, Prop_Send, "m_iAccount", money+200);
CS_SetClientClanTag(client, tag);
if(GetClientTeam(client) == CS_TEAM_CT)
if(GetEntProp(client, Prop_Send, "m_bHasDefuser") == 0) GivePlayerItem(client, "item_defuser");
}
public Action PlayerDeath(Handle event, const char[] name, bool dontBroadcast)
{
int attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
if(!IsValidPlayer(attacker) || !IsPlayerVIP(attacker)) return;
int health = GetClientHealth(attacker);
SetEntityHealth(attacker, health+1);
int money = GetEntProp(attacker, Prop_Send, "m_iAccount");
SetEntProp(attacker, Prop_Send, "m_iAccount", money+50);
bool headshot = GetEventBool(event, "headshot", false);
if(headshot)
{
health = GetClientHealth(attacker);
SetEntityHealth(attacker, health+5);
money = GetEntProp(attacker, Prop_Send, "m_iAccount");
SetEntProp(attacker, Prop_Send, "m_iAccount", money+100);
}
if(GetClientHealth(attacker) > 125)
SetEntityHealth(attacker, 125);
}
public Action EventBombPlanted(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(GetEventInt(event, "userid"));
int money = GetEntProp(client, Prop_Send, "m_iAccount");
if(IsPlayerVIP(client))
SetEntProp(client, Prop_Send, "m_iAccount", money+50);
}
public Action EventBombDefused(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(GetEventInt(event, "userid"));
int money = GetEntProp(client, Prop_Send, "m_iAccount");
if(IsPlayerVIP(client))
SetEntProp(client, Prop_Send, "m_iAccount", money+50);
}
public void OnClientPostAdminCheck(int client)
{
if(IsPlayerVIP(client))
{
char text[100];
Format(text, sizeof(text), "%s %N \n", tag, client);
Format(text, sizeof(text), "%s wbija na serwer!", text);
SetHudTextParams(-1.0, 0.125, 7.0, 45, 209, 0, 255, 0, 0.25, 1.5, 0.5);
for(int i = 1; i <= MaxClients; i++)
if(IsValidPlayer(i))
ShowSyncHudText(i, WelcomeHUD, text);
PrintToChatAll(" %s \x03%N\x01 wbija na serwer!\x01", tag, client);
}
}
stock bool IsValidPlayer(int client)
{
if(client >= 1 && client <= MaxClients && IsClientInGame(client) && !IsFakeClient(client) && !IsClientSourceTV(client))
return true;
return false;
}
stock bool IsPlayerVIP(int client)
{
if(GetUserFlagBits(client) & ADMFLAG_CUSTOM5)
return true;
return false;
}
|
|