inital commit
This commit is contained in:
63
coop.sp
Normal file
63
coop.sp
Normal file
@@ -0,0 +1,63 @@
|
||||
/* Plugin Template generated by Pawn Studio */
|
||||
|
||||
#include <sourcemod>
|
||||
#include <tf2>
|
||||
#include <tf2_stocks>
|
||||
|
||||
new TFClassType:classarray[9];
|
||||
|
||||
public Plugin:myinfo =
|
||||
{
|
||||
name = "Coop Plugin",
|
||||
author = "Chefe",
|
||||
description = "Coop Setting",
|
||||
version = "1.0",
|
||||
url = "<- URL ->"
|
||||
}
|
||||
|
||||
public OnPluginStart()
|
||||
{
|
||||
HookEvent("player_activate", Event_PlayerActive);
|
||||
|
||||
classarray[0] = TF2_GetClass("scout");
|
||||
classarray[1] = TF2_GetClass("soldier");
|
||||
classarray[2] = TF2_GetClass("pyro");
|
||||
classarray[3] = TF2_GetClass("demoman");
|
||||
classarray[4] = TF2_GetClass("heavyweapons");
|
||||
classarray[5] = TF2_GetClass("engineer");
|
||||
classarray[6] = TF2_GetClass("medic");
|
||||
classarray[7] = TF2_GetClass("sniper");
|
||||
classarray[8] = TF2_GetClass("spy");
|
||||
}
|
||||
|
||||
public Event_PlayerActive(Handle:event,const String:name[],bool:dontBroadcast)
|
||||
{
|
||||
new uid = GetEventInt(event, "userid");
|
||||
new ev_client = GetClientOfUserId(uid);
|
||||
|
||||
new i = 1;
|
||||
|
||||
while (i != (MaxClients+1))
|
||||
{
|
||||
new client = i;
|
||||
if (IsClientInGame(client))
|
||||
{
|
||||
new String:steamid[50];
|
||||
GetClientAuthString(client, steamid, sizeof(steamid));
|
||||
|
||||
if (strcmp(steamid, "BOT") != 0)
|
||||
{
|
||||
ChangeClientTeam(ev_client, GetClientTeam(client));
|
||||
TF2_SetPlayerClass(ev_client, classarray[GetRandomInt(0, 8)]);
|
||||
//PrintToServer("Changed %N team to %i with maxclients %i and i= %i", ev_client, GetClientTeam(client), MaxClients, i);
|
||||
}
|
||||
|
||||
if (GetClientCount(true) == 1 && i == 1)
|
||||
{
|
||||
ChangeClientTeam(ev_client, GetRandomInt(2, 3));
|
||||
TF2_SetPlayerClass(ev_client, classarray[GetRandomInt(0, 8)]);
|
||||
}
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user