Raised This Month: $51 Target: $400
 12% 

Solved [CS GO] A few problems with spawned weapons


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ElectricStalin
Member
Join Date: Apr 2017
Old 06-23-2017 , 05:10   [CS GO] A few problems with spawned weapons
Reply With Quote #1

Hello. I'm doing a DM plugin. The weapon will spawn on the map. I also wrote a module that allows you to select an unlimited number of weapons and switch it. Everything works correctly, but there are several problems that I can not solve:
1) Switching weapons from the backpack works correctly only if the player has the option of auto-selection of weapons in the settings. There was an idea to imitate this by forced choice of the first slot at the time of changing weapons. How can this be realized?
2) The problem with ammo. I will describe in detail: the player appears with a glock. At the first picked up weapon the correct quantity of cartridges in a holder and no ammo in a reserve. Then all weapons (it is "picked up" by touch, when you choose it from "backpack" teleports to the player) infinitely many rounds, and the clip is also infinite. Do I need to somehow initialize the number of ammo in the clip?

Last edited by ElectricStalin; 06-26-2017 at 02:57.
ElectricStalin is offline
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 06-23-2017 , 06:04   Re: A few problems with spawned weapons
Reply With Quote #2

I didn't know that Sourcemod was supported by Call of Duty.
__________________
Want to check my plugins ?
Arkarr is offline
ElectricStalin
Member
Join Date: Apr 2017
Old 06-23-2017 , 06:19   Re: A few problems with spawned weapons
Reply With Quote #3

Quote:
Originally Posted by Arkarr View Post
I didn't know that Sourcemod was supported by Call of Duty.
Why Call of Duty? I speak about CS GO.
ElectricStalin is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 06-23-2017 , 08:22   Re: A few problems with spawned weapons
Reply With Quote #4

Quote:
Originally Posted by ElectricStalin View Post
Why Call of Duty? I speak about CS GO.
And know we know your asking about CSGO.
__________________
Neuro Toxin is offline
ElectricStalin
Member
Join Date: Apr 2017
Old 06-24-2017 , 06:42   Re: [CS GO] A few problems with spawned weapons
Reply With Quote #5

So, here is some code, about first problem:
Code:
....
if(clientsWeapon[client][weaponInHand[client]]!=0)
	{
		new ammotype = GetEntProp(EntRefToEntIndex(clientsWeapon[client][weaponInHand[client]]), Prop_Send, "m_iPrimaryAmmoType"); 
		weaponAmmo[client][weaponInHand[client]]=GetEntProp(client, Prop_Send, "m_iAmmo", _, ammotype);
		dropFlag=false;
		CS_DropWeapon(client, EntRefToEntIndex(clientsWeapon[client][weaponInHand[client]]), true, true);
		PrintToChat(client,"Оружие %i сброшено", clientsWeapon[client][weaponInHand[client]]);
		TeleportEntity(EntRefToEntIndex(clientsWeapon[client][weaponInHand[client]]), pos, NULL_VECTOR, NULL_VECTOR);
		dropFlag=true;
		SetEntPropEnt(EntRefToEntIndex(clientsWeapon[client][nextWeap]), Prop_Send, "m_hOwnerEntity", client);
		EquipPlayerWeapon(client, EntRefToEntIndex(clientsWeapon[client][nextWeap]));
	}
	weaponInHand[client]=nextWeap;
....
So it work perfect, if autoequip is switched on. Else, it prints to chat, that weapon was swiched, but new weapon didn't select.
ElectricStalin 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 19:16.


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