You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.5 KiB
63 lines
1.5 KiB
/* 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; |
|
} |
|
} |