This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

[CS:GO] Auto Give Weapon not Giving


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DavivaD
New Member
Join Date: Dec 2015
Old 04-29-2018 , 11:31   [CS:GO] Auto Give Weapon not Giving
Reply With Quote #1

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
DavivaD is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 04-29-2018 , 15:05   Re: [CS:GO] Auto Give Weapon not Giving
Reply With Quote #2

what do you mean by its not working?
__________________
8guawong is offline
DavivaD
New Member
Join Date: Dec 2015
Old 04-29-2018 , 16:50   Re: [CS:GO] Auto Give Weapon not Giving
Reply With Quote #3

Quote:
Originally Posted by DavivaD View Post
... is not giving a revolver ...
DavivaD is offline
PinHeaDi
Senior Member
Join Date: Jul 2013
Location: Bulgaria
Old 04-29-2018 , 17:29   Re: [CS:GO] Auto Give Weapon not Giving
Reply With Quote #4

Is it giving a deagle? I have that issue with the default weapons people choose in inventory.
__________________
PinHeaDi is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:26.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode