Raised This Month: $ Target: $400
 0% 

[Help] Make command execute on player who executed the command


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bonkorn
Senior Member
Join Date: Jul 2015
Old 08-11-2017 , 07:26   [Help] Make command execute on player who executed the command
Reply With Quote #1

When i use /demopan, the server should execute command like this sm_givew Bonkorn 50001 and sm_givew Bonkorn 50002
How do i work on it?

PHP Code:
public OnPluginStart()
{
    
RegAdminCmd("sm_demopan"DemopanWeaponsADMFLAG_CUSTOM6"");
}

public 
Action:DemopanWeapons(clientargs)
{
    
ServerCommand("sm_givew [who execute this command] 50001");
    
ServerCommand("sm_givew [who execute this command] 50002");

Bonkorn is offline
Papero
Veteran Member
Join Date: Aug 2016
Location: Italy
Old 08-11-2017 , 07:32   Re: [Help] Make command execute on player who executed the command
Reply With Quote #2

PHP Code:
public OnPluginStart() 

    
RegAdminCmd("sm_demopan"DemopanWeaponsADMFLAG_CUSTOM6""); 


public 
Action:DemopanWeapons(clientargs

    
ServerCommand("sm_givew #%i 50001"GetClientUserId(client)); 
    
ServerCommand("sm_givew #%i 50002"GetClientUserId(client));
    return 
Plugin_Handled//To avoid unknown command reply.

__________________
My Plugins
SPCode


Steam: hexer504
Telegram: Hexah
Discord: Hexah#6903

If you like my work you can donate here!

Last edited by Papero; 08-11-2017 at 07:33.
Papero is offline
Bonkorn
Senior Member
Join Date: Jul 2015
Old 08-11-2017 , 07:56   Re: [Help] Make command execute on player who executed the command
Reply With Quote #3

Thanks!
Bonkorn is offline
ThatKidWhoGames
Veteran Member
Join Date: Jun 2013
Location: IsValidClient()
Old 08-15-2017 , 06:50   Re: [Help] Make command execute on player who executed the command
Reply With Quote #4

You could do something like this as well:
Code:
pan = 264;

public OnPluginStart()
{
	RegAdminCmd("sm_pan", Command_Pan, ADMFLAG_CUSTOM1);
}

public Action:Command_Pan(client, args)
{
	new weapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
	if (IsPlayerAlive(1) && GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex") != pan && !TF2_IsPlayerInCondition(client, TFCond_Taunting) && TF2_GetPlayerClass(client) != TFClass_Spy)
	{
		TF2Items_GiveWeapon(client, pan);
	}
	else if (TF2_GetPlayerClass(client) == TFClass_Spy)
	{
		PrintToChat(client, "[SM] You can't receive this weapon as Spy.")
	}

	return Plugin_Handled;
}

Last edited by ThatKidWhoGames; 08-15-2017 at 06:51.
ThatKidWhoGames 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 10:36.


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