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

some errors while compiling


Post New Thread Reply   
 
Thread Tools Display Modes
databomb
Veteran Member
Join Date: Jun 2009
Location: california
Old 02-09-2011 , 14:18   Re: some errors while compiling
Reply With Quote #11

Gotcha,

when you do something like
RegAdminCmd("sm_rr", Command_BCR, ADMFLAG_ROOT);
in OnPluginStart(), you can use the command in the console by typing 'sm_rr' or in chat by typine '!rr' and also add arguments after it, so
RegAdminCmd("sm_tl", Command_TeamLimit, ADMFLAG_ROOT);
would make the command.

public Action:Command_TeamLimit(client, args)

So inside your Command_TeamLimit, the args will have the teamlimit number you want. Look up GetCmdArg and SetConVarInt in the API.

http://docs.sourcemod.net/api/
databomb is offline
ben_yaa
Member
Join Date: Feb 2011
Old 02-09-2011 , 23:55   Re: some errors while compiling
Reply With Quote #12

i'm kinda confused...
can you give me an example?
and how i put in a PrintToConsole the number i chose for team limit?
ben_yaa is offline
Monkeys
Veteran Member
Join Date: Jan 2010
Old 02-10-2011 , 01:12   Re: some errors while compiling
Reply With Quote #13

Here's a simple example.

PHP Code:
#include <sourcemod>

static Handle:Convar;

public 
OnPluginStart()
{
    
RegConsoleCmd("sm_test"Command_Test"Test Command");
    
    
Convar FindConVar("any_convar_you_want");
}

public 
Action:Command_Test(ClientArgs//Client is who that used the command, Args is how many arguments he gave
{
    new 
String:Arg[32];
    
GetCmdArg(1Argsizeof(Arg)); //This reads the first argument the player gave
    
    
PrintToConsole(Client"You changed the convar to %s"Arg);
    
SetConVarInt(ConvarStringToInt(Arg));
    
    return 
Plugin_Handled;

__________________
Get a lid on that zombie,
he's never gonna be alri-i-ight.
Oooh get a lid on that zombie,
or he's gonna feed all night.
Monkeys is offline
ben_yaa
Member
Join Date: Feb 2011
Old 02-10-2011 , 08:12   Re: some errors while compiling
Reply With Quote #14

WOW!!!!!!!!!
thx!!!!!!!!!
You've really helped me!!!!
can you give me just an example to a simple popup for credits?
thx again!!!
that the last thing i need for my plugin!!
ben_yaa is offline
ben_yaa
Member
Join Date: Feb 2011
Old 02-10-2011 , 09:21   Re: some errors while compiling
Reply With Quote #15

i didnt understand how to use it :S
can you give me an example on the mp_autoteambalance cvar?
thx and sorry for all the questions..
ben_yaa is offline
honorcode23
BANNED
Join Date: Mar 2010
Location: Chile
Old 02-10-2011 , 10:06   Re: some errors while compiling
Reply With Quote #16

Just change "any_convar_you_want" to mp_autoteambalance. I honestly dont think you are trying too hard :/.
honorcode23 is offline
ben_yaa
Member
Join Date: Feb 2011
Old 02-10-2011 , 10:27   Re: some errors while compiling
Reply With Quote #17

and that all?
i thoght about that but it not looked me logical...
well thx
ben_yaa is offline
ben_yaa
Member
Join Date: Feb 2011
Old 02-10-2011 , 11:15   Re: some errors while compiling
Reply With Quote #18

not working \=
take a look of what i did and the errors while compiling:
PHP Code:
#define PLUGIN_VERSION "0.1"
    #define YELLOW               "\x01"
    #define LIGHTGREEN       "\x03"
    #define GREEN                "\x04"
    #define BLACKGREEN                "\x05"

#include <sourcemod>
static Handle:Convar;

public 
Plugin:myinfo =
{
    
name "Ben-Command",
    
author "Ben-Yaa",
    
description "Server commands manager",
    
version PLUGIN_VERSION,
    
url "http://www.RooT.co.il"
};



public 
OnPluginStart()
{
    
RegAdminCmd("sm_rr"Command_BCRADMFLAG_GENERIC);
    
RegAdminCmd("sm_teamb"Command_BCTBADMFLAG_GENERIC"mp_autoteambalance");

    
Convar FindConVar("mp_autoteambalance");

    
CreateConVar"sm_bcomm""1" );
    
CreateConVar"bcomm_version"PLUGIN_VERSION"CVAR Description here"FCVAR_PLUGIN FCVAR_SPONLY FCVAR_REPLICATED FCVAR_NOTIFY );
}

public 
Action:Command_BCR(clientargs)
{
    
ServerCommand("mp_restartgame 1")
    
PrintToChatAll(client"\x01[\x03Ben-Command\x01] Admin \x04%N \x01has restart the round!"client);
    return 
Plugin_Handled;
}  

public 
Action:Command_BCTB(clientargs)
{
    new 
String:Arg[32];
    
GetCmdArg(1Argsizeof(Arg));
    
PrintToChatAll(client"\x01[\x03Ben-Command\x01] Admin \x04%N \x01has changed \x05mp_autoteambalance \x01to \x03%s!"clientArg);
        
 
SetConVarInt(ConvarStringToInt(Arg));
    
    return 
Plugin_Handled;


the errors while compiling:
Quote:
/groups/sourcemod/upload_tmp/textLngNdH.sp(2 : warning 217: loose indentation
/groups/sourcemod/upload_tmp/textLngNdH.sp(30) : warning 217: loose indentation
/groups/sourcemod/upload_tmp/textLngNdH.sp(37) : error 035: argument type mismatch (argument 1)
/groups/sourcemod/upload_tmp/textLngNdH.sp(45) : warning 217: loose indentation
/groups/sourcemod/upload_tmp/textLngNdH.sp(45) : error 035: argument type mismatch (argument 1)
/groups/sourcemod/upload_tmp/textLngNdH.sp(47) : warning 217: loose indentation
/groups/sourcemod/upload_tmp/textLngNdH.sp(49) : warning 217: loose indentation
what wrong?
ben_yaa is offline
honorcode23
BANNED
Join Date: Mar 2010
Location: Chile
Old 02-10-2011 , 11:36   Re: some errors while compiling
Reply With Quote #19

PrintToChatAll(client, <--- Why would you specify a client when you send the message to everyone?

You have incorrect arguments there.

PrintToChatAll("text");
PrintToChatAll("some text: %i", integer);
honorcode23 is offline
ben_yaa
Member
Join Date: Feb 2011
Old 02-10-2011 , 14:14   Re: some errors while compiling
Reply With Quote #20

yeah,
i forgot to delete it after i add the "all"...
well thx!!
it work!!!!
Youre awesome!!!!
i need just three more things:
1. Can you give me an example for popup menu for credits?

2. Can i do that the "Server cvar 'mp_autoteambalance' changed to 0" wouldnt appears, if i do, can you give me an example??

3. How can i do that if the user write more the 1 like !teamb 2 so it doesnt work and will send him a message?


thx again and sorry for the many questions i asking!

Last edited by ben_yaa; 02-10-2011 at 14:20.
ben_yaa 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 01:37.


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