I have this plugin(work),but i need script Infinite Ammo/Clip for attached to this plugin.
Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>
#include <colors>
#define ADMFLAG_NEEDED ADMFLAG_CUSTOM3
#define DATA "2.0"
new Handle:trie_armas;
new Handle:timers[MAXPLAYERS+1];
new ACCOUNT_OFFSET;
public OnPluginStart()
{
CreateConVar("sm_franugvipfeatures_version", DATA, "", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
trie_armas = CreateTrie();
HookEvent("player_spawn", Event_PlayerSpawn);
HookEvent("player_spawn", Event_OnPlayerSpawn);
HookEvent("round_end", RoundEnd);
ACCOUNT_OFFSET = FindSendPropOffs("CCSPlayer", "m_iAccount");
for(new i = 1; i <= MaxClients; i++)
if(IsClientInGame(i))
{
OnClientPutInServer(i);
OnClientPostAdminCheck(i);
}
}
public Event_OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
new team = GetClientTeam(client);
new money = GetEntProp(client, Prop_Send, "m_iAccount");
if (client > 0 && IsPlayerAlive(client))
{
if ((client))
{
PrintToChat(client, "\x01[\x043Mod\x01] Primiti, helm, +5hp, +200$, setat pentru a dezarma, o parasuta si un set de grenade, pentru că tu ești un VIP");
SetEntityHealth(client, 120); //hp
SetEntProp(client, Prop_Send, "m_ArmorValue", 120, 4); //armor
SetEntProp(client, Prop_Send, "m_bHasHelmet", 1); //helm
SetEntProp(client, Prop_Send, "m_iAccount", money + 200); //200$ plus
GivePlayerItem(client, "weapon_smokegrenade"); //smoke
GivePlayerItem(client, "weapon_flashbang"); //flash
GivePlayerItem(client, "weapon_hegrenade"); //grenade
GivePlayerItem(client, "weapon_flashbang"); //flash
if(team == CS_TEAM_CT)
{
GivePlayerItem(client, "item_defuser"); //kombinerki
}
}
}
}
public OnClientPutInServer(client)
{
SDKHook(client, SDKHook_WeaponEquipPost, EventItemPickup2);
}
public OnClientPostAdminCheck(client)
{
if(GetUserFlagBits(client) & ADMFLAG_NEEDED) timers[client] = CreateTimer(3.0, Darm, client, TIMER_REPEAT);
}
public OnClientDisconnect(client)
{
if(timers[client] != INVALID_HANDLE)
{
KillTimer(timers[client]);
timers[client] = INVALID_HANDLE;
}
}
public Action:Darm(Handle:timer, any:client)
{
if(IsPlayerAlive(client))
{
new weapon = GetEntPropEnt(client, Prop_Data, "m_hActiveWeapon");
if(weapon > 0 && (weapon == GetPlayerWeaponSlot(client, CS_SLOT_PRIMARY) || weapon == GetPlayerWeaponSlot(client, CS_SLOT_SECONDARY)))
{
new warray;
decl String:classname[4];
//GetEdictClassname(weapon, classname, sizeof(classname));
Format(classname, 4, "%i", GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex"));
if(GetTrieValue(trie_armas, classname, warray))
{
//PrintToChat(client, "municion fijado a %i",warray[1]);
if(GetReserveAmmo(weapon) != warray) SetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount", warray);
}
}
}
}
stock GetReserveAmmo(weapon)
{
return GetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount");
}
public Action:EventItemPickup2(client, weapon)
{
if(weapon == GetPlayerWeaponSlot(client, CS_SLOT_PRIMARY) || weapon == GetPlayerWeaponSlot(client, CS_SLOT_SECONDARY))
{
new warray;
decl String:classname[4];
//GetEdictClassname(weapon, classname, sizeof(classname));
Format(classname, 4, "%i", GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex"));
if(!GetTrieValue(trie_armas, classname, warray))
{
warray = GetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount");
SetTrieValue(trie_armas, classname, warray);
}
else
{
if(GetUserFlagBits(client) & ADMFLAG_NEEDED) SetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount", warray);
}
}
}
public Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if(GetClientTeam(client) < 2) return;
if(!(GetUserFlagBits(client) & ADMFLAG_NEEDED)) return;
new iEnt;
while ((iEnt = GetPlayerWeaponSlot(client, 3)) != -1)
{
RemovePlayerItem(client, iEnt);
AcceptEntityInput(iEnt, "Kill");
}
GivePlayerItem(client, "weapon_hegrenade");
GivePlayerItem(client, "weapon_flashbang");
GivePlayerItem(client, "weapon_smokegrenade");
GivePlayerItem(client, "weapon_molotov");
if(GetClientTeam(client) == CS_TEAM_CT) SetEntProp(client, Prop_Send, "m_bHasDefuser", 1);
while ((iEnt = GetPlayerWeaponSlot(client, 2)) != -1)
{
RemovePlayerItem(client, iEnt);
AcceptEntityInput(iEnt, "Kill");
}
GivePlayerItem(client, "weapon_knife");
GivePlayerItem(client, "weapon_taser");
FakeClientCommand(client,"use weapon_knife");
SetEntData(client, ACCOUNT_OFFSET, GetEntData(client, ACCOUNT_OFFSET)+300);
}
public RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
if (CheckMapEnd())
{
Pasar();
}
}
Pasar()
{
for(new i=1;i<=MaxClients;++i)
{
if(!IsClientInGame(i) || GetClientTeam(i) > 1) continue;
if(!(GetUserFlagBits(i) & ADMFLAG_NEEDED)) continue;
ChangeClientTeam(i, GetRandomInt(2, 3));
}
}
bool:CheckMapEnd()
{
new win = GetConVarInt(FindConVar("mp_maxrounds"));
if(win > 0)
{
win = RoundToNearest(win/2.0);
if(GetTeamScore(CS_TEAM_CT) == win || GetTeamScore(CS_TEAM_T) == win) return true;
return false;
}
new timeleft;
GetMapTimeLeft(timeleft);
if (timeleft <= 0) return true;
return false;
}