Raised This Month: $ Target: $400
 0% 

Basic rules plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OneMoreLevel
Senior Member
Join Date: Aug 2009
Location: Look behind you... Very
Old 10-08-2009 , 17:28   Basic rules plugin
Reply With Quote #1

Hi, Im making a basic rules plugin, i know there are alot out there, hence im not going to publish it.
Although when I compile it, I get this:
Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

Error: Invalid expression, assumed zero on line 24
Warning: Expression has no effect on line 24
Error: Invalid expression, assumed zero on line 24
Warning: Expression has no effect on line 24
Error: Expected token: ";", but found ")" on line 24
Error: Too many error messages on one line on line 24

Compilation aborted.
4 Errors.
Could not locate output file C:\Program Files\AMX Mod X\amxxstudio\Untitled.amx (compile failed).
And my code is:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define ADMIN_ALL0
#define PLUGIN "Jailbreak Rules"
#define VERSION "1.0"
#define AUTHOR "OneMoreLevel"
new const message [][] =
{
"If you typed /rules, and you see this, then the plug-in is working."
}
new const 
header [][] =
{
    
"Rules header"
}
public 
plugin_init() {
    
register_plugin("Rules""1.0""OneMoreLevel")
    
    
register_clcmd ("say /rules","jbrules","Show the rules")
}
public 
jbrules() {
    
    
show_motd 1, const message, const header 

I see nothing wrong with it, but me as being a newbie, of course there is.

Another bonus question: How can I make it so that when A person has a text file in the same folder as there motd.txt file is, and that file is named "rules.txt", it reads from that file to put it in the motd.

Any help would be greatly appreciated.
__________________
60/100 60%
[||||||||||||||||||||]
Project: Warfighter mod
Blog:
http://sites.google.com/site/dailymultitasker/
PHP Code:
   if ( i_help_you "Yes" ) == )
    
set_user_karma(onemorelevel,add,+1

Last edited by OneMoreLevel; 10-08-2009 at 17:49.
OneMoreLevel is offline
OneMoreLevel
Senior Member
Join Date: Aug 2009
Location: Look behind you... Very
Old 10-08-2009 , 17:58   Re: Basic rules plugin
Reply With Quote #2

Nevermind guys, I got it working, my code so far is:

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Jailbreak Rules"
#define VERSION "1.0"
#define AUTHOR "OneMoreLevel"

new const message[] =
{
"here are the rules"
}
new const 
header[] =
{
"This is a header"
}

public 
plugin_init() {
    
register_plugin("Jailbreak Rules""1.0""OneMoreLevel")
    
    
register_clcmd ("say /rules""jbrules"0"Show the rules")
}
public 
jbrules(id)
{    
    
show_motd(idmessageheader

But I still have this question:
How can I make it so that when A person has a text file in the same folder as there motd.txt file is, and that file is named "rules.txt", it reads from that file to put it in the motd.
__________________
60/100 60%
[||||||||||||||||||||]
Project: Warfighter mod
Blog:
http://sites.google.com/site/dailymultitasker/
PHP Code:
   if ( i_help_you "Yes" ) == )
    
set_user_karma(onemorelevel,add,+1
OneMoreLevel is offline
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 10-08-2009 , 18:16   Re: Basic rules plugin
Reply With Quote #3

http://amxmodx.org/funcwiki.php?go=func&id=21

Quote:
message can either be a filename or a string formatted message. With VGUI2, the message can be HTML formatted.
So there's no problem in displaying a rules.txt. I'm not exactly sure whether you need to precache it, though.

/edit: This all happens serverside - just so you know. You can't display a file that exists on the client. To check wether rules.txt exists on the server use file_exists( file[] )
__________________
In Flames we trust!
Nextra is offline
izzle
Senior Member
Join Date: Aug 2009
Old 10-08-2009 , 20:27   Re: Basic rules plugin
Reply With Quote #4

Quote:
Originally Posted by OneMoreLevel View Post
Nevermind guys, I got it working, my code so far is:But I still have this question:
How can I make it so that when A person has a text file in the same folder as there motd.txt file is, and that file is named "rules.txt", it reads from that file to put it in the motd.
You can do it like this

PHP Code:
#include <amxmodx>
#include <amxmisc>


public plugin_init() {
    
register_plugin("JailBreakRules""1.0""izzle");
    
    
register_clcmd("say /rules""JailBreakRules"0"JailBreakRules");
}


public 
JailBreakRules(id) {
    
show_motd(id"rules.txt""JailBreakRules");
    return 
PLUGIN_HANDLED;

izzle is offline
OneMoreLevel
Senior Member
Join Date: Aug 2009
Location: Look behind you... Very
Old 10-08-2009 , 20:43   Re: Basic rules plugin
Reply With Quote #5

thank you, I figured it out before, but thanks for the reply
__________________
60/100 60%
[||||||||||||||||||||]
Project: Warfighter mod
Blog:
http://sites.google.com/site/dailymultitasker/
PHP Code:
   if ( i_help_you "Yes" ) == )
    
set_user_karma(onemorelevel,add,+1
OneMoreLevel is offline
izzle
Senior Member
Join Date: Aug 2009
Old 10-08-2009 , 20:46   Re: Basic rules plugin
Reply With Quote #6

izzle 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 22:33.


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