PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <zriot>
#include <cstrike>
public Plugin:myinfo =
{
name = "ZR Custom CS:GO Arms Modified support ZRiot",
author = "Franc1sco franug, Modified by 2389736818",
description = "",
version = "4.0",
url = "http://www.zeuszombie.com"
};
new Handle:kv;
new String:path[PLATFORM_MAX_PATH] = "configs/zriot/zombies.txt";
new Handle:trie_zombies;
new String:manos[MAXPLAYERS+1][128];
public OnPluginStart()
{
trie_zombies = CreateTrie();
HookEvent("player_spawn", OnSpawn);
HookEvent("round_start", Restart);
for(new i = 1; i <= MaxClients; i++)
if(IsClientInGame(i)) OnClientPutInServer(i);
}
public OnClientPutInServer(client)
{
Format(manos[client], 128, "models/weapons/ct_arms_gign.mdl");
}
public OnMapStart()
{
PrecacheModel("models/weapons/ct_arms_gign.mdl");
}
public Action:OnSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if(IsPlayerAlive(client) && ZRiot_IsClientZombie(client)) GetEntPropString(client, Prop_Send, "m_szArmsModel", manos[client], 64);
Arms(client);
}
Arms(client)
{
if(!IsPlayerAlive(client)) return;
decl String:namet[64],String:model[128], String:currentmodel[128];
if(!GetTrieString(trie_zombies, namet, model, sizeof(model))) return;
GetEntPropString(client, Prop_Send, "m_szArmsModel", currentmodel, sizeof(currentmodel));
if(strlen(model) > 3)
{
if(!StrEqual(currentmodel, model)) SetEntPropString(client, Prop_Send, "m_szArmsModel", model);
//PrintToChat(client, "used %s with class %i",model, cindex);
}
else
{
if(!StrEqual(currentmodel, manos[client])) SetEntPropString(client, Prop_Send, "m_szArmsModel", manos[client]);
//PrintToChat(client, "used %s with class %i",manos[client], cindex);
}
}
public Action:Restart(Handle:event, const String:name[], bool:dontBroadcast)
{
CreateTimer(0.5, Cleaner);
CreateTimer(0.75, Cleaner);
}
public Action:Cleaner(Handle:timer)
{
for (new i = 1; i < MaxClients; i++)
if(IsClientInGame(i) && IsPlayerAlive(i))
{
Arms(i);
if(GetClientTeam(i) == CS_TEAM_T)
{
CS_SwitchTeam(i, CS_TEAM_CT);
}
else if(GetClientTeam(i) == CS_TEAM_CT)
{
CS_SwitchTeam(i, CS_TEAM_T);
}
}
}
//
public OnConfigsExecuted()
{
CreateTimer(0.2, OnConfigsExecutedPost);
}
public Action:OnConfigsExecutedPost(Handle:timer)
{
if (kv != INVALID_HANDLE)
{
CloseHandle(kv);
}
kv = CreateKeyValues("zombies");
decl String:buffer[PLATFORM_MAX_PATH];
BuildPath(Path_SM, buffer, sizeof(buffer), "%s", path);
if (!FileToKeyValues(kv, buffer))
{
SetFailState("Class data file \"%s\" not found", buffer);
}
if (KvGotoFirstSubKey(kv))
{
ClearTrie(trie_zombies);
decl String:name[64],String:model[128];
do
{
KvGetString(kv, "name", name, sizeof(name));
KvGetString(kv, "arms_path", model, sizeof(model), " ");
SetTrieString(trie_zombies, name, model);
if(strlen(model) > 3 && FileExists(model) && !IsModelPrecached(model)) PrecacheModel(model);
} while (KvGotoNextKey(kv));
}
KvRewind(kv);
}