Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma semicolon 1
- #pragma newdecls required
- #include <sdktools>
- #include <sdkhooks>
- #define MAX 8
- char sMap[56];
- bool IsAllow[MAXPLAYERS+1];
- static const char Inflicted[MAX][] =
- {
- "models/survivors/survivor_gambler.mdl",
- "models/survivors/survivor_producer.mdl",
- "models/survivors/survivor_coach.mdl",
- "models/survivors/survivor_mechanic.mdl",
- "models/survivors/survivor_namvet.mdl",
- "models/survivors/survivor_teenangst.mdl",
- "models/survivors/survivor_biker.mdl",
- "models/survivors/survivor_manager.mdl"
- };
- static const char gMaps[MAX - 2][] =
- {
- "c7",
- "c8",
- "с9",
- "c10",
- "c11",
- "c12"
- };
- public void OnPluginStart()
- {
- HookEvent("player_spawn", KnownM);
- }
- public Action KnownM(Event event, const char[] name, bool dontbroadcast)
- {
- int client = GetClientOfUserId(event.GetInt("userid"));
- IsAllow[client] = false;
- CreateTimer(5.0, vSetModel, client);
- }
- public void OnMapStart()
- {
- GetCurrentMap(sMap, sizeof(sMap));
- SetConVarInt(FindConVar("precache_all_survivors"), 1);
- for( int i = 0; i < sizeof(Inflicted); i++ )
- {
- PrecacheModel(Inflicted[sizeof(i)][i], true);
- }
- }
- public void OnClientPutInServer(int client)
- {
- IsAllow[client] = true;
- }
- public Action vSetModel(Handle timer, int client)
- {
- if(GetClientTeam(client) == 2 && !IsFakeClient(client))
- {
- bool IsDisAllow;
- for( int i = 0; i < MAX - 2; i++ )
- {
- if(StrContains(sMap, gMaps[i]) > 1)
- {
- int random = GetRandomInt(4, 7);
- SetEntProp(client, Prop_Send, "m_survivorCharacter", random);
- if(IsModelPrecached(Inflicted[random])) SetEntityModel(client, Inflicted[random]);
- else
- {
- PrintToServer("Opps! Something wrong...");
- PrecacheModel(Inflicted[random], true);
- SetEntityModel(client, Inflicted[random]);
- IsDisAllow = true;
- }
- break;
- }
- }
- if(!IsDisAllow)
- {
- int random = GetRandomInt(0, 7);
- SetEntProp(client, Prop_Send, "m_survivorCharacter", random);
- if(IsModelPrecached(Inflicted[random])) SetEntityModel(client, Inflicted[random]);
- else
- {
- PrintToServer("Opps! Something wrong...");
- PrecacheModel(Inflicted[random], true);
- SetEntityModel(client, Inflicted[random]);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement