AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   [REQ] sm_delayed like on ES (https://forums.alliedmods.net/showthread.php?t=278055)

spancer35 01-23-2016 18:28

[REQ] sm_delayed like on ES
 
Hi guys i found this plugin (https://forums.alliedmods.net/showthread.php?t=134288) but this plugin work with min. but i need second. method any one can edit this plugin or make a better plugin than this.


and sorry for my bad english :(

Grey83 01-23-2016 19:19

PHP Code:

#include <sourcemod>
#include <sdktools>
#define PLUGIN_VERSION "1.2.0_sec"


public Plugin:myinfo 
{
    
name "Command Time-Traveler",
    
author "DarthNinja",
    
description "Run commands in future... NOW!",
    
version PLUGIN_VERSION,
    
url "DarthNinja.com"
}

public 
OnPluginStart()
{
        
RegAdminCmd("sm_future"CmdFutureADMFLAG_ROOT);
        
CreateConVar("sm_futureexe_version"PLUGIN_VERSION"Plugin Version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
}

public 
Action:CmdFuture(clientargs)
{
    if (
args != 2)
    {
        
ReplyToCommand(client"[SM] Usage: sm_future <Time in seconds> \"Command +Args\"");
        return 
Plugin_Handled;    
    }
    
decl String:Fcmd[255];
    
decl String:time_S[25];
    
GetCmdArg(1time_Ssizeof(time_S));
    
GetCmdArg(2Fcmdsizeof(Fcmd));
    
ShowActivity2(client"[SM] ","Executing \"%s\" in %s seconds"Fcmdtime_S);
    new 
Float:time_float;
    
time_float StringToFloat(time_S);
    
    
decl String:name[255]
    
decl String:steamid[255]
    if (
client != 0)
    {
        
GetClientName(clientnamesizeof(name));
        
GetClientAuthString(clientsteamidsizeof(steamid));
    }
    else if (
client == 0)
    {
        
strcopy(namesizeof(name), "CONSOLE");
        
strcopy(steamidsizeof(steamid), "CONSOLE");
    }
    
LogAction(client, -1"%L used Future-Execute to execute command %s in %s seconds."clientFcmdtime_S); //log
    //Fix quotes
    
ReplaceString(Fcmdsizeof(Fcmd), "'","\"")
    
    new 
Handle:pack
    CreateDataTimer
(time_floatTimer_FUExecpack)
    
WritePackString(packname); //Client's name
    
WritePackString(packsteamid); //Client's steamid
    
WritePackString(pack,Fcmd); //command + args
    
WritePackString(pack,time_S); //time as string
    
return Plugin_Handled;
}


public 
Action:Timer_FUExec(Handle:timerHandle:pack)
{
    
decl String:cmd[255]
    
decl String:time[25]
    
decl String:name[255]
    
decl String:steamid[255]
    
    
ResetPack(pack)
    
ReadPackString(packnamesizeof(name))
    
ReadPackString(packsteamidsizeof(steamid))
    
ReadPackString(packcmdsizeof(cmd))
    
ReadPackString(packtimesizeof(time))
    
    
LogAction(-1,-1,"\"%s\"(%s) used Future-Execute to execute command %s: Called %s seconds ago."namesteamidcmdtime); //log
    
ServerCommand("%s"cmd)
    
    return 
Plugin_Stop;



spancer35 01-24-2016 08:13

Re: [REQ] sm_delayed like on ES
 
Quote:

Originally Posted by Grey83 (Post 2385894)
PHP Code:

#include <sourcemod>
#include <sdktools>
#define PLUGIN_VERSION "1.2.0_sec"


public Plugin:myinfo 
{
    
name "Command Time-Traveler",
    
author "DarthNinja",
    
description "Run commands in future... NOW!",
    
version PLUGIN_VERSION,
    
url "DarthNinja.com"
}
Much thanks m8I'll try it
public OnPluginStart()
{
        RegAdminCmd("sm_future", CmdFuture, ADMFLAG_ROOT);
        CreateConVar("sm_futureexe_version", PLUGIN_VERSION, "Plugin Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
}

public Action:CmdFuture(client, args)
{
    if (args != 2)
    {
        ReplyToCommand(client, "[SM] Usage: sm_future <Time in seconds> \"Command +Args\"");
        return Plugin_Handled;    
    }
    decl String:Fcmd[255];
    decl String:time_S[25];
    GetCmdArg(1, time_S, sizeof(time_S));
    GetCmdArg(2, Fcmd, sizeof(Fcmd));
    ShowActivity2(client, "[SM] ","Executing \"%s\" in %s seconds", Fcmd, time_S);
    new Float:time_float;
    time_float = StringToFloat(time_S);
    
    decl String:name[255]
    decl String:steamid[255]
    if (client != 0)
    {
        GetClientName(client, name, sizeof(name));
        GetClientAuthString(client, steamid, sizeof(steamid));
    }
    else if (client == 0)
    {
        strcopy(name, sizeof(name), "CONSOLE");
        strcopy(steamid, sizeof(steamid), "CONSOLE");
    }
    LogAction(client, -1, "%L used Future-Execute to execute command %s in %s seconds.", client, Fcmd, time_S); //log
    //Fix quotes
    ReplaceString(Fcmd, sizeof(Fcmd), "'","
\"")
    
    new 
Handle:pack
    CreateDataTimer
(time_floatTimer_FUExecpack)
    
WritePackString(packname); //Client's name
    
WritePackString(packsteamid); //Client's steamid
    
WritePackString(pack,Fcmd); //command + args
    
WritePackString(pack,time_S); //time as string
    
return Plugin_Handled;
}


public 
Action:Timer_FUExec(Handle:timerHandle:pack)
{
    
decl String:cmd[255]
    
decl String:time[25]
    
decl String:name[255]
    
decl String:steamid[255]
    
    
ResetPack(pack)
    
ReadPackString(packnamesizeof(name))
    
ReadPackString(packsteamidsizeof(steamid))
    
ReadPackString(packcmdsizeof(cmd))
    
ReadPackString(packtimesizeof(time))
    
    
LogAction(-1,-1,"\"%s\"(%s) used Future-Execute to execute command %s: Called %s seconds ago."namesteamidcmdtime); //log
    
ServerCommand("%s"cmd)
    
    return 
Plugin_Stop;





All times are GMT -4. The time now is 08:11.

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