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

Easy Variables


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
rajabilal555
Junior Member
Join Date: Jan 2015
Old 08-26-2015 , 07:54   Easy Variables
Reply With Quote #1

Hi there,

I need some help
Code:
#include <amxmodx>
#include <amxmisc>

Public admin_motd(id,cid) {
	
	show_motd(id,"motd.txt","Message of the Day.")
	return PLUGIN_CONTINUE   
}

public plugin_init() {

    register_clcmd("say /motd","admin_motd",0,"- Shows the MOTD.")
}
In this code i wan't the File name to be a Variable that can be accessed from the config or any file that have the ability to do it but i wan't to make it so no body have to recompile it and edit the file name / change the file.
rajabilal555 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-26-2015 , 08:57   Re: Easy Variables
Reply With Quote #2

You can store the file name in a cvar.
__________________
HamletEagle is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-26-2015 , 09:39   Re: Easy Variables
Reply With Quote #3

The "public" keyword must all be lowercase letters. The "cid" that you have in admin_motd() is wrong, remove it if you are not using it or fix it if you are going to use it. By fix it, I mean that the proper arguments for a client command are "id, level, cid". To learn how to use these arguments properly, look at other plugins that use them. I'd recommend looking at admincmd.sma.
__________________
fysiks is offline
Leonidddd
Member
Join Date: Apr 2012
Old 08-27-2015 , 06:03   Re: Easy Variables
Reply With Quote #4

Quote:
Originally Posted by fysiks View Post
The "public" keyword must all be lowercase letters.
I'd prefer write "public"("procedure", maybe, better for this body) so :
PHP Code:
#include <amxmodx>

@admin_motd(id,cid) {
    
    
show_motd(id,"motd.txt","Message of the Day.");
}

@
plugin_init() {

    
register_clcmd("say /motd","admin_motd",0,"- Shows the MOTD.");


Last edited by Leonidddd; 08-27-2015 at 06:04.
Leonidddd is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-27-2015 , 09:13   Re: Easy Variables
Reply With Quote #5

Quote:
Originally Posted by Leonidddd View Post
I'd prefer write "public"("procedure", maybe, better for this body)
Huh? Even if it works, suggesting a different syntax is confusing. There is no reason that "public" shouldn't be used here.
__________________

Last edited by fysiks; 08-27-2015 at 09:44.
fysiks is offline
rajabilal555
Junior Member
Join Date: Jan 2015
Old 08-31-2015 , 06:59   Re: Easy Variables
Reply With Quote #6

Can anybody tell me how to use Cvar in file name ?
And
Quote:
Originally Posted by fysiks View Post
The "public" keyword must all be lowercase letters. The "cid" that you have in admin_motd() is wrong, remove it if you are not using it or fix it if you are going to use it. By fix it, I mean that the proper arguments for a client command are "id, level, cid". To learn how to use these arguments properly, look at other plugins that use them. I'd recommend looking at admincmd.sma.
Answer to this is that i've written this code on my mobile so definitely there will be a problem/error.

Last edited by rajabilal555; 08-31-2015 at 07:05. Reason: corrections of questions and answers
rajabilal555 is offline
rajabilal555
Junior Member
Join Date: Jan 2015
Old 09-03-2015 , 06:57   Re: Easy Variables
Reply With Quote #7

Please help !!!
Bump....
rajabilal555 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-03-2015 , 07:28   Re: Easy Variables
Reply With Quote #8

PHP Code:
new Cvar
Cvar 
register_cvar("file_name""blablabla.txt")

new 
FileName[128]
get_pcvar_string(CvarFileNamecharsmax(FileName)) 
__________________
HamletEagle is offline
rajabilal555
Junior Member
Join Date: Jan 2015
Old 09-04-2015 , 05:24   Re: Easy Variables
Reply With Quote #9

It is giving me 3 to 4 Errors

Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team

Error: Invalid function or declaration on line 52
Error: Symbol already defined: "get_pcvar_string" on line 55
Warning: Symbol is never used: "Cvar" on line 8924

2 Errors.
Could not locate output file F:\SV\Cs 1.6 Server\cstrike\addons\amxmodx\scripting\compiled\test.amx (compile failed).
rajabilal555 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-04-2015 , 05:25   Re: Easy Variables
Reply With Quote #10

How are you using it ?
__________________
HamletEagle 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 13:25.


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