Kód: Vybrat vše
#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.2.2",
url = "http://hanys.net.pl"
};
new Handle:HP;
new Handle:Smokegrenade;
new Handle:Flashbang;
new Handle:Hegrenade;
new Handle:Armorvalue;
new Handle:Bhashelmet;
new Handle:Defuser;
new Handle:Moneystart;
new Handle:Bombplanted;
new Handle:Bombdefused;
new Handle:Headshot_money;
new Handle:Headshot_hp;
new Handle:Kill_money;
new Handle:Kill_hp;
new Handle:Tagtable;
new Handle:Tagsay;
new Handle:Double_jump;
public OnPluginStart()
{
CreateConVar("sm_vip_version", "1.2.2", "VIP Plugin", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD);
HP = CreateConVar("sm_hp_start", "110", "Ilosc HP na start rundy", FCVAR_NOTIFY);
Smokegrenade = CreateConVar("sm_smokegrenade", "1", "Smoke na start rundy", FCVAR_NONE, true, 0.0, true, 1.0);
Flashbang = CreateConVar("sm_flashbang", "1", "Flash na start rundy", FCVAR_NONE, true, 0.0, true, 1.0);
Hegrenade = CreateConVar("sm_hegrenade", "1", "Granat na start rundy", FCVAR_NONE, true, 0.0, true, 1.0);
Armorvalue = CreateConVar("sm_armorvalue", "1", "Kamizelka na start rundy", FCVAR_NONE, true, 0.0, true, 1.0);
Bhashelmet = CreateConVar("sm_bhashelmet", "1", "Kask na start rundy", FCVAR_NONE, true, 0.0, true, 1.0);
Defuser = CreateConVar("sm_defuser", "1", "Zestaw do rozbrajania dla CT na start rundy", FCVAR_NONE, true, 0.0, true, 1.0);
Moneystart = CreateConVar("sm_money_start", "200", "Ilosc $ na start rundy", FCVAR_NOTIFY);
Bombplanted = CreateConVar("sm_bomb_planted", "200", "Ilosc $ za podlozenie bomby", FCVAR_NOTIFY);
Bombdefused = CreateConVar("sm_bomb_defused", "200", "Ilosc $ za rozbrojenie bomby", FCVAR_NOTIFY);
Headshot_money = CreateConVar("sm_headshot_money", "150", "Ilosc $ za Headshot", FCVAR_NOTIFY);
Headshot_hp = CreateConVar("sm_headshot_hp", "0", "Ilosc HP za Headshot", FCVAR_NOTIFY);
Kill_money = CreateConVar("sm_kill_money", "100", "Ilosc $ za fraga", FCVAR_NOTIFY);
Kill_hp = CreateConVar("sm_kill_hp", "0", "Ilosc HP za fraga", FCVAR_NOTIFY);
Tagtable = CreateConVar("sm_tag_table", "1", "Tag VIP w tabeli wynikow", FCVAR_NONE, true, 0.0, true, 1.0);
Tagsay = CreateConVar("sm_tag_say", "1", "Tag VIP + kolorowy nick w say", FCVAR_NONE, true, 0.0, true, 1.0);
Double_jump = CreateConVar("sm_double_jump", "1", "Podwojny skok", FCVAR_NONE, true, 0.0, true, 1.0);
AutoExecConfig(true, "sm_vip");
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);
}
public Event_OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
new money = GetEntProp(client, Prop_Send, "m_iAccount");
new team = GetClientTeam(client);
new g_HP = GetConVarInt(HP);
new g_moneystart = GetConVarInt(Moneystart);
if (client > 0 && IsPlayerAlive(client))
{
if (IsPlayerGenericAdmin(client))
{
SetEntityHealth(client, g_HP); //hp
if (GetConVarBool(Smokegrenade)) GivePlayerItem(client, "weapon_smokegrenade"); //smoke
if (GetConVarBool(Flashbang)) GivePlayerItem(client, "weapon_flashbang"); //flash
if (GetConVarBool(Hegrenade)) GivePlayerItem(client, "weapon_hegrenade"); //grenade
SetEntProp(client, Prop_Send, "m_iAccount", money + g_moneystart); // plus $ na start
if (GetConVarBool(Armorvalue)) SetEntProp(client, Prop_Send, "m_ArmorValue", 100); //kamizelka
if (GetConVarBool(Bhashelmet)) SetEntProp(client, Prop_Send, "m_bHasHelmet", 1); //helm
if(team == CS_TEAM_CT)
{
if (GetConVarBool(Defuser)) GivePlayerItem(client, "item_defuser"); //kombinerki
}
}
}
}
public Event_BombPlanted(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
new money = GetEntProp(client, Prop_Send, "m_iAccount");
new g_bombplanted = GetConVarInt(Bombplanted);
if (IsPlayerGenericAdmin(client))
{
SetEntProp(client, Prop_Send, "m_iAccount", money + g_bombplanted);//plus $ for Bomb Planted
}
}
public Event_BombDefused(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
new money = GetEntProp(client, Prop_Send, "m_iAccount");
new g_bombdefused = GetConVarInt(Bombdefused);
if (IsPlayerGenericAdmin(client))
{
SetEntProp(client, Prop_Send, "m_iAccount", money + g_bombdefused); //plus $ for Bomb Defused
}
}
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 health = GetEntProp(attacker, Prop_Send, "m_iHealth");
new g_headshot_money = GetConVarInt(Headshot_money);
new g_headshot_hp = GetConVarInt(Headshot_hp);
new g_kill_money = GetConVarInt(Kill_money);
new g_kill_hp = GetConVarInt(Kill_hp);
new bool:headshot = GetEventBool(event, "headshot");
if (IsPlayerGenericAdmin(attacker))
{
if(headshot){
SetEntProp(attacker, Prop_Send, "m_iAccount", money + g_headshot_money); //plus for hs
SetEntProp(attacker, Prop_Send, "m_iHealth", health + g_headshot_hp); //plus hp for hs
}else{
SetEntProp(attacker, Prop_Send, "m_iAccount", money + g_kill_money); //plus for kill
SetEntProp(attacker, Prop_Send, "m_iHealth", health + g_kill_hp); //plus hp for kill
}
}
}
public Action:Event_TagTable(Handle:event, String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if (IsPlayerGenericAdmin(client))
{
if (GetConVarBool(Tagtable)) CS_SetClientClanTag(client, "[VIP]");
}
}
public Action:Command_SendToAll(client, args)
{
if ((IsPlayerGenericAdmin(client)) && GetConVarBool(Tagsay))
{
decl String:sTextToAll[1024];
GetCmdArgString(sTextToAll, sizeof(sTextToAll));
StripQuotes(sTextToAll);
LogPlayerEvent(client, "say=", sTextToAll);
new team = GetClientTeam(client);
if(sTextToAll[0] != '@' && sTextToAll[0] != '/' && sTextToAll[0] != '!' && sTextToAll[0] > 0)
{
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)) && GetConVarBool(Tagsay))
{
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) && sTextToAll[0] != '@' && sTextToAll[0] != '/' && sTextToAll[0] != '!')
{
new PlayersTeam = GetClientTeam(i);
if(PlayersTeam & team && sTextToAll[0] > 0)
{
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 && sTextToAll[0] != '@' && sTextToAll[0] != '/' && sTextToAll[0] != '!')
{
for(new i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i) && !IsPlayerAlive(i))
{
new PlayersTeam = GetClientTeam(i);
if(PlayersTeam & team && sTextToAll[0] > 0)
{
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 && sTextToAll[0] != '@' && sTextToAll[0] != '/' && sTextToAll[0] != '!')
{
for(new i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i) && !IsPlayerAlive(i))
{
new PlayersTeam = GetClientTeam(i);
if(PlayersTeam & team && sTextToAll[0] > 0)
{
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;
}
public Action:OnPlayerRunCmd(iClient, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
{
if ((IsPlayerGenericAdmin(iClient)) && IsPlayerAlive(iClient) && GetConVarBool(Double_jump))
{
static g_fLastButtons[MAXPLAYERS+1], g_fLastFlags[MAXPLAYERS+1], g_iJumps[MAXPLAYERS+1], fCurFlags, fCurButtons;
fCurFlags = GetEntityFlags(iClient);
fCurButtons = GetClientButtons(iClient);
if (g_fLastFlags[iClient] & FL_ONGROUND && !(fCurFlags & FL_ONGROUND) && !(g_fLastButtons[iClient] & IN_JUMP) && fCurButtons & IN_JUMP) g_iJumps[iClient]++;
else if(fCurFlags & FL_ONGROUND) g_iJumps[iClient] = 0;
else if(!(g_fLastButtons[iClient] & IN_JUMP) && fCurButtons & IN_JUMP && g_iJumps[iClient] == 1)
{
g_iJumps[iClient]++;
decl Float:vVel[3];
GetEntPropVector(iClient, Prop_Data, "m_vecVelocity", vVel);
vVel[2] = 250.0;
TeleportEntity(iClient, NULL_VECTOR, NULL_VECTOR, vVel);
}
g_fLastFlags[iClient] = fCurFlags;
g_fLastButtons[iClient] = fCurButtons;
}
return Plugin_Continue;
}
/*
@param client id
return bool
*/
bool:IsPlayerGenericAdmin(client)
{
if (!CheckCommandAccess(client, "sm_vip", 0, true)) return false;
{
return true;
}
}