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

[Help] 3 Things


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 04-27-2012 , 18:44   [Help] 3 Things
Reply With Quote #1

im making a plugin, and i need 2 things.
1. im using a timer any 60 seconds/round_start hook that will check if there are admin in the server, if yes it will do something, else it will do something else.
how im checking if there is admin with admflag_generic? and if it will i can do something?
2. im making a command, that if im doing sm_ct 1 it will do something, and if sm_ct 0 something else, i never used arguments and didnt tried, i can have a guide or an public example? also if there are not args it will do something else.
3. how to make that to do something to SOURCETV and not to bots? if i can do only for both its ok, because i want to spectate the sourcetv any round and i dont know how to target it.

Thanks!
__________________
retired

Last edited by shavit; 04-27-2012 at 19:00.
shavit is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 04-27-2012 , 19:36   Re: [Help] 3 Things
Reply With Quote #2

1. Use CheckCommandAccess maybe - and yes, you can do something with timers

2. Yes, you can check if there are arguments to the string - something like if(args < 1) return;
Use GetCmdArg and store the command in a string - then do something if the string matches what you want it to match

3. I guess it depends on what you want to do to sourcetv... but IsClientSourceTV is what you need.
__________________
View my Plugins | Donate
TnTSCS is offline
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 04-27-2012 , 20:19   Re: [Help] 3 Things
Reply With Quote #3

Quote:
Originally Posted by TnTSCS View Post
1. Use CheckCommandAccess maybe - and yes, you can do something with timers

2. Yes, you can check if there are arguments to the string - something like if(args < 1) return;
Use GetCmdArg and store the command in a string - then do something if the string matches what you want it to match

3. I guess it depends on what you want to do to sourcetv... but IsClientSourceTV is what you need.
1. i dont know how to use 1 properly.
2. everytime im using arguments i get error/warning or its compiling and not working ingame.
3. works well .
__________________
retired
shavit is offline
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 04-27-2012 , 20:28   Re: [Help] 3 Things
Reply With Quote #4

http://docs.sourcemod.net/api/
__________________
thetwistedpanda is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 04-27-2012 , 20:56   Re: [Help] 3 Things
Reply With Quote #5

shavit - what you're asking for is pretty basic stuff - all of which is covered in one way or another in the documentation link thetwistedpanda provided.
__________________
View my Plugins | Donate
TnTSCS is offline
mcpan313
Senior Member
Join Date: Mar 2010
Old 04-28-2012 , 00:18   Re: [Help] 3 Things
Reply With Quote #6

PHP Code:
#include <sourcemod>

public OnPluginStart()
{
    
RegConsoleCmd("sm_ct"Command_Test);
    
    
CreateTimer(60.0Timer_FindAdminDoSth_TIMER_REPEAT);
}

public 
Action:Command_Test(clientargs)
{
    if (
args != 1)
    {
        
ReplyToCommand(client"Usage: !sm_ct [argument]");
        return 
Plugin_Handled;
    }
    
    
decl String:buffer[2];
    
GetCmdArg(1buffersizeof(buffer));
    new 
value StringToInt(buffer);
    
    switch (
value)
    {
        case 
0:
        {
            
// !sm_ct 0
        
}
        case 
1:
        {
            
// !sm_ct 1
        
}
    }
    
    return 
Plugin_Handled;
}

public 
Action:Timer_FindAdminDoSth(Handle:timer)
{
    for (new 
1<= MaxClientsi++)
    {
        if (
IsClientInGame(i) && !IsFakeClient(i) && (GetUserFlagBits(i) & ADMFLAG_GENERIC))
        {
            
// stuff.
        
}
    }

__________________
sorry, for my poor english.

Last edited by mcpan313; 04-28-2012 at 00:20.
mcpan313 is offline
Send a message via MSN to mcpan313
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 04-28-2012 , 06:09   Re: [Help] 3 Things
Reply With Quote #7

Quote:
Originally Posted by mcpan313 View Post
PHP Code:
#include <sourcemod>

public OnPluginStart()
{
    
RegConsoleCmd("sm_ct"Command_Test);
    
    
CreateTimer(60.0Timer_FindAdminDoSth_TIMER_REPEAT);
}

public 
Action:Command_Test(clientargs)
{
    if (
args != 1)
    {
        
ReplyToCommand(client"Usage: !sm_ct [argument]");
        return 
Plugin_Handled;
    }
    
    
decl String:buffer[2];
    
GetCmdArg(1buffersizeof(buffer));
    new 
value StringToInt(buffer);
    
    switch (
value)
    {
        case 
0:
        {
            
// !sm_ct 0
        
}
        case 
1:
        {
            
// !sm_ct 1
        
}
    }
    
    return 
Plugin_Handled;
}

public 
Action:Timer_FindAdminDoSth(Handle:timer)
{
    for (new 
1<= MaxClientsi++)
    {
        if (
IsClientInGame(i) && !IsFakeClient(i) && (GetUserFlagBits(i) & ADMFLAG_GENERIC))
        {
            
// stuff.
        
}
    }

Thank you, please close the thread .
__________________
retired
shavit is offline
Reply


Thread Tools
Display Modes

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:34.


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