AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Easy Variables (https://forums.alliedmods.net/showthread.php?t=270655)

rajabilal555 08-26-2015 07:54

Easy Variables
 
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.

HamletEagle 08-26-2015 08:57

Re: Easy Variables
 
You can store the file name in a cvar.

fysiks 08-26-2015 09:39

Re: Easy Variables
 
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.

Leonidddd 08-27-2015 06:03

Re: Easy Variables
 
Quote:

Originally Posted by fysiks (Post 2337036)
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.");



fysiks 08-27-2015 09:13

Re: Easy Variables
 
Quote:

Originally Posted by Leonidddd (Post 2337303)
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.

rajabilal555 08-31-2015 06:59

Re: Easy Variables
 
Can anybody tell me how to use Cvar in file name ?
And
Quote:

Originally Posted by fysiks (Post 2337036)
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.

rajabilal555 09-03-2015 06:57

Re: Easy Variables
 
Please help !!!
Bump....

HamletEagle 09-03-2015 07:28

Re: Easy Variables
 
PHP Code:

new Cvar
Cvar 
register_cvar("file_name""blablabla.txt")

new 
FileName[128]
get_pcvar_string(CvarFileNamecharsmax(FileName)) 


rajabilal555 09-04-2015 05:24

Re: Easy Variables
 
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).


HamletEagle 09-04-2015 05:25

Re: Easy Variables
 
How are you using it ?


All times are GMT -4. The time now is 22:13.

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