Hi. I wrote this script (some code (almost all) is used from gunmenu lite) for automatic revolver giving on player spawn:
Code:
#include <sourcemod>
#include <sdktools>
enum Teams
{
CS_TEAM_NONE,
CS_TEAM_SPECTATOR,
CS_TEAM_T,
CS_TEAM_CT
};
public Plugin:myinfo = {
name = "Auto Give Weapon",
author = "DavivaD",
description = "Give a weapon to all players on round start.",
version = "1.0",
url = "http://www.strikezone.eu/"
};
public OnMapStart()
{
if (GetClientCount(true))
for (new client_index = 1; client_index <= MaxClients; ++client_index)
if (IsClientInGame(client_index))
{
if (IsPlayerAlive(client_index))
CreateTimer(0.1, Event_HandleSpawn, GetClientUserId(client_index));
}
}
public Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
CreateTimer(0.1, Event_HandleSpawn, GetEventInt(event, "userid"));
}
public Action:Event_HandleSpawn(Handle:timer, any:user_index)
{
new client_index = GetClientOfUserId(user_index);
if (!client_index)
return;
new Teams:client_team = Teams:GetClientTeam(client_index);
if (client_team > CS_TEAM_SPECTATOR)
{
GivePlayerItem(client_index, "weapon_revolver");
}
}
But there is one small problem. This plugin is not giving a revolver. I do something wrong? PLEASE HALP!!!111oneoneone