Raised This Month: $32 Target: $400
 8% 

Make code for all the Terrorist


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Chokitu
Senior Member
Join Date: Oct 2013
Old 04-26-2015 , 22:00   Make code for all the Terrorist
Reply With Quote #1

How can I make this work like this
If admin type !trak
All the T's gets Ak-47
If Admin type !ctm4
All the Ct's gets m4


Code:
#include <sourcemod>
#include <sdktools_functions>

public Plugin:myinfo = {
	name = "TRAK",
	author = "Chokitu",
	description = "1.0",
	version = "1.0",
	url =""
	};
	
	public OnPluginStart()
	{
	RegAdminCmd("sm_trak", Trak, ADMFLAG_SLAY);
	RegAdminCmd("sm_ctm4", Ctm4, ADMFLAG_SLAY);
	}
	
	public Action:Trak(client, args)
	{
	GivePlayerItem(client, "weapon_ak47");
	}
	
		public Action:Ctm4(client, args)
	{
	GivePlayerItem(client, "weapon_m4a4");
	}
Chokitu is offline
Send a message via Skype™ to Chokitu
RedSword
SourceMod Plugin Approver
Join Date: Mar 2006
Location: Quebec, Canada
Old 04-26-2015 , 23:17   Re: Make code for all the Terrorist
Reply With Quote #2

Code:
#include <sdktools_functions>

public Plugin:myinfo = {
	name = "TRAK",
	author = "Chokitu",
	description = "1.0",
	version = "1.0",
	url =""
};
	
public OnPluginStart()
{
	RegAdminCmd("sm_trak", Trak, ADMFLAG_SLAY);
	RegAdminCmd("sm_ctm4", Ctm4, ADMFLAG_SLAY);
}
	
public Action:Trak(client, args)
{
	for ( new i = 1; i <= MaxClients; ++i )
		if ( IsClientInGame( i ) && GetClientTeam( i ) == 2 )
			GivePlayerItem(i, "weapon_ak47");
}
	
public Action:Ctm4(client, args)
{
	for ( new i = 1; i <= MaxClients; ++i )
		if ( IsClientInGame( i ) && GetClientTeam( i ) == 3 )
			GivePlayerItem(i, "weapon_m4a4");
}
__________________
My plugins :
Red Maze
Afk Bomb
RAWR (per player/rounds Awp Restrict.)
Kill Assist
Be Medic

You can also Donate if you appreciate my work

Last edited by RedSword; 04-26-2015 at 23:18.
RedSword is offline
BAILANDO
Senior Member
Join Date: Feb 2015
Location: Slovakia
Old 04-27-2015 , 07:32   Re: Make code for all the Terrorist
Reply With Quote #3

If you need this commands to give this weapon to all player and you need to discard actual weapon which player have, then you can use this code. I dont test it, but can works.

Code:
#include <sourcemod> #include <sdktools> #include <cstrike> //#include <sdkhooks> //#include <smlib> //#include <account> public Plugin:myinfo = {     name = "[CSS] Weapon Give with command",     author = "BAILANDO",     description = "[CSS] Weapon Give with command",     version = "1.0",     url = "http://www.urnaweb.cz" }; public OnPluginStart() {     RegAdminCmd("sm_ctm4", GiveM4ToCts, ADMFLAG_SLAY);     RegAdminCmd("sm_trak", GiveAkToTs, ADMFLAG_SLAY); } public OnMapStart() {     } public OnMapEnd() {     } public Action:GiveM4ToCts(id, args) {     new ent;     for (new i = 1; i <= MaxClients; i++) {         if (IsClientInGame(i) && GetClientTeam(i) == CS_TEAM_CT) {             if (GetPlayerWeaponSlot(i, CS_SLOT_PRIMARY) != -1) {                 ent = GetPlayerWeaponSlot(i, CS_SLOT_PRIMARY);                 RemovePlayerItem(i, ent);                 GivePlayerItem(i, "weapon_m4a1");             }         }     } } public Action:GiveAkToTs(id, args) {     new ent;     for (new i = 1; i <= MaxClients; i++) {         if (IsClientInGame(i) && GetClientTeam(i) == CS_TEAM_T) {             if (GetPlayerWeaponSlot(i, CS_SLOT_PRIMARY) != -1) {                 ent = GetPlayerWeaponSlot(i, CS_SLOT_PRIMARY);                 RemovePlayerItem(i, ent);                 GivePlayerItem(i, "weapon_ak47");             }         }     } }
BAILANDO is offline
Chokitu
Senior Member
Join Date: Oct 2013
Old 04-27-2015 , 08:10   Re: Make code for all the Terrorist
Reply With Quote #4

Yes I forgot to close I did yesterday by myself but thank you
Chokitu is offline
Send a message via Skype™ to Chokitu
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 04-28-2015 , 00:04   Re: Make code for all the Terrorist
Reply With Quote #5

Quote:
Originally Posted by BAILANDO View Post
If you need this commands to give this weapon to all player and you need to discard actual weapon which player have, then you can use this code. I dont test it, but can works.
That code will only give a player a weapon if they have one in their primary slot already. Move the GivePlayerItem call outside of that if statement. Also, why call GetPlayerWeaponSlot twice? Just save the value when you call it the first time. You should also check to see if a player is alive. I'm pretty sure if you give a weapon to a spectator, it will just spawn in the air and drop to the ground.

Last edited by bl4nk; 04-28-2015 at 00:06. Reason: additional info
bl4nk is offline
BAILANDO
Senior Member
Join Date: Feb 2015
Location: Slovakia
Old 04-28-2015 , 03:19   Re: Make code for all the Terrorist
Reply With Quote #6

yea, see, forgot to make else and spawn weapon for player who dont have primary.
BAILANDO 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:44.


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