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

some errors while compiling


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ben_yaa
Member
Join Date: Feb 2011
Old 02-08-2011 , 11:42   some errors while compiling
Reply With Quote #1

Hi,
i'm new on scripting(started learning: today ).
I started a new plugin(and didn't finish yet) and i wanted to see if what i did until now is works good.
I tried to compile it but i got those errors:
Quote:
/groups/sourcemod/upload_tmp/textzwN55A.sp(7) : error 023: array assignment must be simple assignment
/groups/sourcemod/upload_tmp/textzwN55A.sp(17) : error 055: start of function body without function header
/groups/sourcemod/upload_tmp/textzwN55A.sp(20) : error 010: invalid function or declaration
/groups/sourcemod/upload_tmp/textzwN55A.sp(30) : warning 217: loose indentation
/groups/sourcemod/upload_tmp/textzwN55A.sp(31) : warning 217: loose indentation
/groups/sourcemod/upload_tmp/textzwN55A.sp(31) : error 035: argument type mismatch (argument 1)
/groups/sourcemod/upload_tmp/textzwN55A.sp(32) : warning 217: loose indentation
What i wrong in my plugin?
PHP Code:
#include <sourcemod>
public Plugin:myinfo =
{
    
name "Ben-Command",
    
author "Ben-Yaa",
    
description "Server commands manager",
    
version 1.0,
    
url "http://www.RooT.co.il"
};

    
#define YELLOW               "\x01"
    #define LIGHTGREEN       "\x02"
    #define GREEN                "\x03"
    #define BLUE                "\x04"

public OnPluginStart
{
    
RegAdminCmd"sm_rr"BCR );

    
gPluginEnabled CreateConVar"sm_bcomm""1" );
    
CreateConVar"bcomm_version"PLUGIN_VERSION"1.0"FCVAR_PLUGIN FCVAR_SPONLY FCVAR_REPLICATED FCVAR_NOTIFY );
}

public 
Action:BCRidargs )
{    
    new 
String:name[64];
    
GetClientName(id,name,sizeof(name));
    
    new 
String:BCC[192];
        
Format(BCC,sizeof(BCC),"\x01[\x03Ben-Command\x01] \x03Admin \x04%s \x03has restarted the round!",name);
                    
PrintToChat(BCC);
    return 
Plugin_Handled;

And one more question: how can i control rcon? beacuse i wanna it to do mp_restartround 1.

Thx all!
ben_yaa is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 02-08-2011 , 11:58   Re: some errors while compiling
Reply With Quote #2

Cleaned up your code:

PHP Code:
#define PLUGIN_VERSION "0.1"

#include <sourcemod>
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_ROOT);

    
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)
{
    
ReplyToCommand(client"\x01[\x03Ben-Command\x01] \x03Admin \x04%N \x03has restarted the round!"client);
    return 
Plugin_Handled;

Just look at the difference between yours and mine lol.

ServerCommand("") executes a console command on the server.
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
ben_yaa
Member
Join Date: Feb 2011
Old 02-08-2011 , 14:23   Re: some errors while compiling
Reply With Quote #3

thx!!!!
Youre awesome!!
Just two more questions:
1. How can i do a popup menu and how i display it to a player?

2. I want that if someone write sm_tl 5 so it makes mp_teamlimit to 5 and if i'll write even 100 it will change it to 100,
how i do that?


thx again!!

Last edited by ben_yaa; 02-09-2011 at 00:28.
ben_yaa is offline
ben_yaa
Member
Join Date: Feb 2011
Old 02-09-2011 , 09:37   Re: some errors while compiling
Reply With Quote #4

anyone?
ben_yaa is offline
databomb
Veteran Member
Join Date: Jun 2009
Location: california
Old 02-09-2011 , 09:41   Re: some errors while compiling
Reply With Quote #5

http://wiki.alliedmods.net/ConVars_%...d_Scripting%29
for sm_tl

http://wiki.alliedmods.net/Menu_API_%28SourceMod%29
for menus
databomb is offline
ben_yaa
Member
Join Date: Feb 2011
Old 02-09-2011 , 10:07   Re: some errors while compiling
Reply With Quote #6

still,
i didn't get it \=
how can i do that if i'll write:
sm_tl 123
it will change mp_teamlimit to 123(for example),
can you write me how to do thah(the code)?
ben_yaa is offline
databomb
Veteran Member
Join Date: Jun 2009
Location: california
Old 02-09-2011 , 11:20   Re: some errors while compiling
Reply With Quote #7

ben, show us what you've tried and we'll help.. otherwise you might want to try the plugin ideas & requests section.
databomb is offline
ben_yaa
Member
Join Date: Feb 2011
Old 02-09-2011 , 11:32   Re: some errors while compiling
Reply With Quote #8

hmm i dont even know how to START :S
ben_yaa is offline
databomb
Veteran Member
Join Date: Jun 2009
Location: california
Old 02-09-2011 , 11:57   Re: some errors while compiling
Reply With Quote #9

Ok, so first thing is to read over the wiki, start with the first part on writing your first SourceMod plugin and then re-read the wikis on ConVars and menu handling. Second thing is to search through the API and look at any functions you have questions over. Third thing is to find some good examples to see how other people did things. The best way to do that is search through some of the approved plugins. Here's an example of using the ConVar in a simple plugin, look through his SP file to get more ideas.

http://forums.alliedmods.net/showthread.php?p=1097121
databomb is offline
ben_yaa
Member
Join Date: Feb 2011
Old 02-09-2011 , 14:06   Re: some errors while compiling
Reply With Quote #10

i know how to use concvar,
but i dont know how to use it in a custom use,
like !tl 2 for doing mp_teamlimit 2,
now do you understood what i ment to?
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 15:16.


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