public OnPluginStart() { ServerCommand("sv_hudhint_sound 0"); HookEvent("round_start", Event_RoundStart); HookEvent("round_end", Event_RoundEnd); }
public Action:Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast) { x = 0; xx = 0; if (GAP_Timer != INVALID_HANDLE) { KillTimer(GAP_Timer); GAP_Timer = INVALID_HANDLE; } GAP_Timer = CreateTimer(1.0, GAP_TimerTell, _, TIMER_REPEAT); }
public Action:Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast) { x = 0; xx = 0; if (GAP_Timer != INVALID_HANDLE) { KillTimer(GAP_Timer); GAP_Timer = INVALID_HANDLE; } }
public Action:GAP_TimerTell(Handle:timer) { x = 0; xx = 0; for (new i = 1; i <= MaxClients; i++) { if (IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == 2) { x++; } } for (new i = 1; i <= MaxClients; i++) { if (IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == 3) { xx++; } } PrintHintTextToAll("%d T:%d CT", x, xx); return Plugin_Continue; }
public Plugin:myinfo = { name = "fast spectator teamchange", author = "ilga80", description = "Быстрый переход в наблюдатели", version = PLUGIN_VERSION, url = "http://ufaplay-css.ucoz.ru/" }
public OnPluginStart() { AddCommandListener(say, "say"); AddCommandListener(say, "say_team"); }
Измененные сообщения о подключении игроков и смене команды PHP код:
#include <sourcemod> new String:teams[3][] = {"CCCCCCSpectators","FF4040Terrorist \x01force","99CCFFCounter-Terrorist \x01force"}
public Plugin:myinfo = { name = " [KDLP]Game Events", author = "KorDen", description = "", version = "1.0", url = "css32.ru" } public OnPluginStart() { HookEvent("player_disconnect", event_PlayerConn, EventHookMode_Pre); HookEvent("player_connect", event_PlayerConn, EventHookMode_Pre); HookEvent("player_team", event_PlayerTeam, EventHookMode_Pre); } //GameEvents Begin public Action:event_PlayerTeam(Handle:event, const String:name[], bool:dontBroadcast) { new client=GetClientOfUserId(GetEventInt(event, "userid")) if (!dontBroadcast && !GetEventBool(event,"disconnect") && !GetEventBool(event,"silent") && IsClientConnected(client)) { SetEventBroadcast(event, true); PrintToChatAll("\x04%N \x01зашел за \x07%s",client,teams[GetEventInt(event,"team")-1]); } } public Action:event_PlayerConn(Handle:event, const String:name[], bool:dontBroadcast) { if (!dontBroadcast) SetEventBroadcast(event, true); decl String:rawmsg[255]; decl String:rawadmmsg[255]; decl String:steam[24]; decl String:nick[48]; decl String:ip[16]; decl String:reason[192]; GetEventString(event, "networkid", steam, sizeof(steam)); GetEventString(event, "name", nick, sizeof(nick)); if (strcmp(name,"player_connect")) { new client=GetClientOfUserId(GetEventInt(event,"userid")) if(client<1) return; GetEventString(event, "reason", reason, sizeof(reason)); GetClientIP(client, ip, sizeof(ip)); // В player_disconnect нет address ReplaceString(reason, sizeof(reason), "\n", " "); Format(rawadmmsg,sizeof(rawadmmsg),"\x01Игрок \x07FF0000%s \x01| \x07228B22%s \x01| \x03%s \x01 отключился - \x03%s", nick, steam, i p, reason); Format(rawmsg,sizeof(rawmsg),"\x01Игрок \x04%s \x01отключился\x07FFFF00 - %s", nick, reason); } else { GetEventString(event, "address", ip, sizeof(ip)); SplitString(ip,":",ip,sizeof(ip)); Format(rawmsg,sizeof(rawmsg), "\x01Игрок \x04%s \x01вступает в игру", nick); Format(rawadmmsg,sizeof(rawadmmsg), "\x01Игрок \x070099FF%s \x01| \x07228B22%s \x01| \x03%s \x01подключается", nick, steam, ip); }
for (new i = 1; i <= MaxClients; i++) if(IsClientConnected(i) && IsClientInGame(i)) if (GetUserFlagBits(i)) PrintToChat(i, "%s", rawadmmsg); else PrintToChat(i, "%s", rawmsg); }