Spoiler
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#define PLUGIN_VERSION "v1.0"
public Plugin:myinfo =
{
name = "ZM Kit",
author = "Knopers",
description = "Plugin dla snickersa",
version = "PLUGIN_VERSION",
url = ""
};
public OnPluginStart()
{
CreateConVar("sm_zmkit", PLUGIN_VERSION, "version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
HookEvent("player_spawn", Event_PlayerSpawn);
PrintToServer("[Knopers]Plugin wlanczony");
RegConsoleCmd("say", CmdSay);
RegConsoleCmd("say_team", CmdSay);
}
public Action:Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if ( (IsClientInGame(client)) && (IsPlayerAlive(client) && GetClientTeam(client) > 1) )
{
GivePlayerItem(client, "weapon_hegrenade");
GivePlayerItem(client, "weapon_smokegrenade");
GivePlayerItem(client, "item_nvgs");
PrintToChatAll("\x03[KIT]\x01Granaty dodane");
}
}
public Action:CmdSay(client, args)
{
if(!IsClientInGame(client) || !IsPlayerAlive(client))
return Plugin_Continue;
new String:text[32], startidx;
GetCmdArgString(text, sizeof(text));
if(text[strlen(text)-1] == '"')
{
text[strlen(text)-1] = '\0';
startidx = 1;
}
if(strcmp(text[startidx], "!kit", false))
return Plugin_Continue;
GivePlayerItem(client, "weapon_p90");
return Plugin_Continue;
}