Hi. I have question about this plugin.
Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <cstrike>
#include <clientprefs>
#include <colors>
#include <loghelper>
public Plugin:myinfo =
{
name = "VIP Plugin",
author = "hanys",
description = "vip plugin",
version = "1.0",
url = "http://cs-wojak.com"
};
public OnPluginStart()
{
RegConsoleCmd("say", Command_SendToAll);
RegConsoleCmd("say_team", Command_SendToTeam);
HookEvent("player_spawn", Event_OnPlayerSpawn);
HookEvent("bomb_planted", Event_BombPlanted);
HookEvent("bomb_defused", Event_BombDefused);
HookEvent("player_death", Event_PlayerDeath);
HookEvent("player_team", Event_TagTable);
HookEvent("player_spawn", Event_TagTable);
//CreateTimer(5.0, Timer_Copy, _, TIMER_REPEAT);
}
public Action:Timer_Copy(Handle:timer)
{
PrintToChatAll("\x01[\x04DEMO\x01]\x04 PLUGIN DEMO PLUGIN DEMOPLUGIN DEMOPLUGIN DEMO");
}
public Event_OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
new money = GetEntProp(client, Prop_Send, "m_iAccount");
if (client > 0 && IsPlayerAlive(client))
{
if (IsPlayerGenericAdmin(client))
{
SetEntityHealth(client, 110); //hp
SetEntProp(client, Prop_Send, "m_ArmorValue", 100, 1); //armor
GivePlayerItem(client, "weapon_smokegrenade"); //smoke
GivePlayerItem(client, "weapon_flashbang"); //flash
GivePlayerItem(client, "weapon_hegrenade"); //grenade
SetEntProp(client, Prop_Send, "m_iAccount", money + 200); //200$ plus
}
}
}
public Event_BombPlanted(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
new money = GetEntProp(client, Prop_Send, "m_iAccount");
if (IsPlayerGenericAdmin(client))
{
SetEntProp(client, Prop_Send, "m_iAccount", money + 200); //200$ plus
}
}
public Event_BombDefused(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
new money = GetEntProp(client, Prop_Send, "m_iAccount");
if (IsPlayerGenericAdmin(client))
{
SetEntProp(client, Prop_Send, "m_iAccount", money + 200); //200$ plus
}
}
public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
new money = GetEntProp(attacker, Prop_Send, "m_iAccount");
new bool:headshot = GetEventBool(event, "headshot");
if (IsPlayerGenericAdmin(attacker))
{
if(headshot){
SetEntProp(attacker, Prop_Send, "m_iAccount", money + 150); //150$ plus for hs
}else{
SetEntProp(attacker, Prop_Send, "m_iAccount", money + 100); //100$ plus for kill
}
}
}
public Action:Event_TagTable(Handle:event, String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if (IsPlayerGenericAdmin(client))
{
CS_SetClientClanTag(client, "[VIP]");
}
}
public Action:Command_SendToAll(client, args)
{
if (IsPlayerGenericAdmin(client))
{
decl String:sTextToAll[1024];
GetCmdArgString(sTextToAll, sizeof(sTextToAll));
StripQuotes(sTextToAll);
LogPlayerEvent(client, "say=", sTextToAll);
new team = GetClientTeam(client);
if(IsPlayerAlive(client) && team == 2 || team == 3)
{
PrintToChatAll("\x01[\x04VIP\x01]\x05 %N \x01%s", client, sTextToAll);
}
/* Player isn't alive and have team (no spec) */
else if(!IsPlayerAlive(client) && team == 2 || team == 3)
{
PrintToChatAll("\x01*NIE ŻYJE* [\x04VIP\x01]\x05 %N \x01%s", client, sTextToAll);
}
/* Player is in spectate */
else if(!IsPlayerAlive(client) && team != 2 && team != 3)
{
PrintToChatAll("\x01*OBSERWATOR* [\x04VIP\x01]\x05 %N \x01%s", client, sTextToAll);
}
return Plugin_Handled;
}
return Plugin_Continue;
}
public Action:Command_SendToTeam(client, args)
{
if (IsPlayerGenericAdmin(client))
{
decl String:sTextToAll[1024];
GetCmdArgString(sTextToAll, sizeof(sTextToAll));
StripQuotes(sTextToAll);
LogPlayerEvent(client, "say=", sTextToAll);
new team = GetClientTeam(client);
if(IsPlayerAlive(client) && team == 2 || team == 3)
{
for(new i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i))
{
new PlayersTeam = GetClientTeam(i);
if(PlayersTeam & team)
{
if(team == 2)
PrintToChat(i, "\x01(Terrorysta) [\x04VIP\x01]\x05 %N \x01%s", client, sTextToAll);
else
PrintToChat(i, "\x01(Antyterrorysta) [\x04VIP\x01]\x05 %N \x01%s", client, sTextToAll);
}
}
}
}
/* Player isn't alive and have team (no spec) */
else if(!IsPlayerAlive(client) && team == 2 || team == 3)
{
for(new i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i) && !IsPlayerAlive(i))
{
new PlayersTeam = GetClientTeam(i);
if(PlayersTeam & team)
{
if(team == 2)
PrintToChat(i, "\x01*NIE ŻYJE*(Terrorysta) [\x04VIP\x01]\x05 %N \x01%s", client, sTextToAll);
else
PrintToChat(i, "\x01*NIE ŻYJE*(Antyterrorysta) [\x04VIP\x01]\x05 %N \x01%s", client, sTextToAll);
}
}
}
}
/* Player is in spectate */
else if(!IsPlayerAlive(client) && team != 2 && team != 3)
{
for(new i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i) && !IsPlayerAlive(i))
{
new PlayersTeam = GetClientTeam(i);
if(PlayersTeam & team)
{
if(team == 2)
PrintToChat(i, "\x01*OBSERWATOR*(Terrorysta) [\x04VIP\x01]\x05 %N \x01%s", client, sTextToAll);
else
PrintToChat(i, "\x01*OBSERWATOR*(Antyterrorysta) [\x04VIP\x01]\x05 %N \x01%s", client, sTextToAll);
}
}
}
}
return Plugin_Handled;
}
return Plugin_Continue;
}
/*
@param client id
return bool
*/
bool:IsPlayerGenericAdmin(client)
{
if (CheckCommandAccess(client, "generic_admin", ADMFLAG_RESERVATION, false))
{
return true;
}
return false;
}
but it doesn't work. I can't compile the plugin.