Code:
#pragma semicolon 2
#include <sourcemod>
#include <sdktools>
#include <cstrike>
public OnPluginStart()
{
RegServerCmd("sm_speed", CmdSpeed);
}
public Action:CmdSpeed(client, args)
{
if (args < 2)
{
ReplyToCommand(client, "[SM] Usage: sm_speed <target> <multiplier>");
return Plugin_Handled;
}
decl String:pattern[MAX_NAME],String:buffer[MAX_NAME],String:mul[MAX_ID];
GetCmdArg(1,pattern,sizeof(pattern));
GetCmdArg(2,mul,sizeof(mul));
new Float:mult = StringToFloat(mul);
new targets[MAX_CLIENTS],bool:ml = false;
new count = ProcessTargetString(pattern,client,targets,sizeof(targets),FILTER_ALIVE,buffer,sizeof(buffer),ml);
if (count <= 0) ReplyToCommand(client,"%t",(count < 0)?"Bad target":"No target",YELLOW,TEAMCOLOR,pattern,YELLOW);
else for (new i = 0; i < count; i++)
{
new t = targets[i];
SetEntPropFloat(t, Prop_Data, "m_flLaggedMovementValue", mult);
if (g_bLog) LogAction(client,t,"\"%L\" set speed of player \"%L\" to %.1f",client,t,mult);
}
return Plugin_Handled;
}
Is this correct? and would "RegServerCmd("sm_speed", CmdSpeed);" make it able to use the sm_speed for other scripts..? where you just input "sm_speed target 2.0" or must i use RegConsoleCmd? AdminCmd? or any other?