Сделайте кому не сложно для соурс а то про неё все забыли и все прикольные плагины новые выходят для ксго :(
Код
#include <sourcemod>
#include <sdktools>
public OnPluginStart()
{
HookEvent("player_spawn", OnPlayerSpawned);
HookEvent("decoy_firing", OnDecoyFiring);
}
public OnPlayerSpawned(Handle event, char[] name, bool dontBroadcast) {
int client = GetClientOfUserId(GetEventInt(event, "userid"));
if(client && IsPlayerAlive(client) && GetClientTeam(client) > 1) GivePlayerItem(client, "weapon_decoy");
}
public OnDecoyFiring(Handle:event, const String:name[], bool:dontBroadcast) {
int client = GetClientOfUserId(GetEventInt(event, "userid"));
new Float:f_Pos[3];
new entityid = GetEventInt(event, "entityid");
f_Pos[0] = GetEventFloat(event, "x");
f_Pos[1] = GetEventFloat(event, "y");
f_Pos[2] = GetEventFloat(event, "z");
TeleportEntity(client, f_Pos, NULL_VECTOR, NULL_VECTOR);
RemoveEdict(entityid);
}
Добавлено (05.07.2018, 19:45:36)
---------------------------------------------
Вот еще один вариант если кому понравится.
Код
#include <sourcemod>
#include <sdktools>
#include <multicolors>
public Plugin:myinfo =
{
name = "[Deathrun] Decoy Teleporter",
author = "Purixi",
description = "",
version = "1.0",
url = ""
}
new g_AllowedDecoys[33];
public OnPluginStart()
{
HookEvent("decoy_firing", OnDecoyFiring);
HookEvent("round_start", OnRoundStart);
RegConsoleCmd("decoy", OnCommandExecuted);
}
public OnClientPutInServer(client)
{
if(!IsFakeClient(client)) g_AllowedDecoys[client] = 1;
}
public Action:OnCommandExecuted(client, args)
{
new flags = GetUserFlagBits(client);
if(flags & ADMFLAG_GENERIC || flags & ADMFLAG_ROOT)
{
if(g_AllowedDecoys[client] > 0)
{
g_AllowedDecoys[client]--;
GivePlayerItem(client, "weapon_decoy");
CPrintToChat(client, "{green}[Decoy Teleporter] {orange}You've been granted a {green}Decoy Teleporter{orange}. Use it with brain.");
}
else
{
CPrintToChat(client, "{green}[Decoy Teleporter] {orange}You have already used all available {green}Decoy Teleporters{orange}.");
}
}
else
{
CPrintToChat(client, "{green}[Decoy Teleporter] {orange}You don't have permissions to access following command.");
}
}
public OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
new userid = GetEventInt(event, "userid");
new client = GetClientOfUserId(userid);
g_AllowedDecoys[client] = 1;
}
public OnDecoyFiring(Handle:event, const String:name[], bool:dontBroadcast)
{
new userid = GetEventInt(event, "userid");
new client = GetClientOfUserId(userid);
new flags = GetUserFlagBits(client);
if(flags & ADMFLAG_GENERIC || flags & ADMFLAG_ROOT)
{
new Float:f_Pos[3];
new entityid = GetEventInt(event, "entityid");
f_Pos[0] = GetEventFloat(event, "x");
f_Pos[1] = GetEventFloat(event, "y");
f_Pos[2] = GetEventFloat(event, "z");
TeleportEntity(client, f_Pos, NULL_VECTOR, NULL_VECTOR);
RemoveEdict(entityid);
}
}