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

[l4d2] help : how to run a command ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dabaicai
Junior Member
Join Date: May 2011
Old 07-05-2013 , 14:16   [l4d2] help : how to run a command ?
Reply With Quote #1

like attack ,like jump , reload and so on ??
dabaicai is offline
MasterOfTheXP
Veteran Member
Join Date: Aug 2011
Location: Cloudbank
Old 07-05-2013 , 15:03   Re: [l4d2] help : how to run a command ?
Reply With Quote #2

PHP Code:
public Action:OnPlayerRunCmd(client, &buttons, &impulseFloat:vel[3], Float:ang[3], &weapon)
{
    
buttons |= IN_ATTACK// http://docs.sourcemod.net/api/index.php?fastload=file&id=47&
    
return Plugin_Changed;

Note that this will cause every player to always attack, no matter what. Here's a command that forces the user to attack once:
PHP Code:
new bool:ForceMeToAttack[MAXPLAYERS 1];

public 
OnPluginStart()
{
    
RegAdminCmd("sm_forceattack"Command_ForceAttack0);
}

public 
Action:Command_ForceAttack(clientargs)
{
    
ForceMeToAttack[client] = true;
}

public 
Action:OnPlayerRunCmd(client, &buttons, &impulseFloat:vel[3], Float:ang[3], &weapon)
{
    if (
ForceMeToAttack[client])
    {
        
buttons |= IN_ATTACK;
        
ForceMeToAttack[client] = false;
        return 
Plugin_Changed;
    }
    return 
Plugin_Continue;

__________________
Plugins / My Steam / TF2 Sandbox (plugin beta testing!)
MasterOfTheXP is offline
dabaicai
Junior Member
Join Date: May 2011
Old 07-06-2013 , 03:43   Re: [l4d2] help : how to run a command ?
Reply With Quote #3

how to run it in code ?
call sm_force ; ?
call buttons ; ?
call IN_ATTACK ; ?

i want to :
for (i=1,i < 5, i++)
{
attack ;
} // fire 5 bullet

how to do ???

Last edited by dabaicai; 07-06-2013 at 03:48.
dabaicai is offline
dabaicai
Junior Member
Join Date: May 2011
Old 07-09-2013 , 02:23   Re: [l4d2] help : how to run a command ?
Reply With Quote #4

GetClientButtons() is a get key's order ,so that

is there a putclienbuttons() order?
dabaicai is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 07-09-2013 , 11:20   Re: [l4d2] help : how to run a command ?
Reply With Quote #5

Quote:
Originally Posted by dabaicai View Post
GetClientButtons() is a get key's order ,so that

is there a putclienbuttons() order?
You change the buttons parameter in the OnPlayerRunCmd forward then return Plugin_Changed, as MasterOfTheXP already demonstrated in the second post above.
__________________
11530 is offline
dabaicai
Junior Member
Join Date: May 2011
Old 07-10-2013 , 03:30   Re: [l4d2] help : how to run a command ?
Reply With Quote #6

Quote:
Originally Posted by 11530 View Post
You change the buttons parameter in the OnPlayerRunCmd forward then return Plugin_Changed, as MasterOfTheXP already demonstrated in the second post above.

can u give an example ? a section code ?
dabaicai 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 02:56.


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