AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   fix small code (https://forums.alliedmods.net/showthread.php?t=320774)

Sanjay Singh 01-08-2020 12:01

fix small code
 
Error
PHP Code:

AMX Mod X Compiler 1.10.0.5388
Copyright 
(c1997-2006 ITB CompuPhase
Copyright 
(c2004-2013 AMX Mod X Team

H
:\AMX\scripting\AmxXDMT.sma(32) : error 017undefined symbol "GetFileTime"
H:\AMX\scripting\AmxXDMT.sma(36) : error 088number of arguments does not match definition
H
:\AMX\scripting\AmxXDMT.sma(56) : error 017undefined symbol "fmt" 

PHP Code:

#include <amxmodx>
#include <cromchat>

new g_szInputFileName[] = "discord_messages_i.txt";

new 
g_iInputTemp;
new 
g_iInputFileModTime;
new 
g_szInputFileLoc[64];
new 
g_szInputMessage[256];

new 
g_szOutputFileName[] = "discord_messages_o.txt";
new 
g_szOutputFileLoc[64];

public 
plugin_init()
{
    
register_plugin("AmxXDMT""1.0b""thEsp");

    
get_datadir(g_szInputFileLoccharsmax(g_szInputFileLoc));
    
format(g_szOutputFileLoccharsmax(g_szOutputFileLoc), "%s\%s"g_szInputFileLocg_szOutputFileName); // Use this first
    
format(g_szInputFileLoccharsmax(g_szInputFileLoc), "%s\%s"g_szInputFileLocg_szInputFileName);

    
register_clcmd("say""cmdMessage");

    
set_task(0.1"tskReadLine", .flags "b");
}

public 
tskReadLine()
{
    if(!
file_exists(g_szInputFileLoc))
        return;

    
g_iInputTemp GetFileTime(g_szInputFileLocFileTime_LastChange);

    if (
g_iInputFileModTime != g_iInputTemp)
    {
        
read_file(g_szInputFileLoc0g_szInputMessagecharsmax(g_szInputMessage));
        
CC_SendMessage(0g_szInputMessage);
        
g_iInputFileModTime g_iInputTemp;
    }
}

public 
cmdMessage(id)
{
    new 
szMessage[128], szTime[16], szTeam[16];
    
read_args(szMessagecharsmax(szMessage));
    
    
remove_quotes(szMessage);
    
trim(szMessage);
    
    if(
equal(szMessage""))
        return;
    
    
get_time("%H:%M:%S"szTimecharsmax(szTime));
    
get_user_team(idszTeamcharsmax(szTeam));

    
write_file(g_szOutputFileLocfmt("[%s] %s %n: %s"szTimeszTeamidszMessage), 0);
}

stock get_datadir(name[], len)
{
    return 
get_localinfo("amxx_datadir"namelen);



OciXCrom 01-08-2020 15:34

Re: fix small code
 
The plugin requires AMXX 1.9 or above.

Sanjay Singh 01-09-2020 01:10

Re: fix small code
 
Quote:

Originally Posted by OciXCrom (Post 2679440)
The plugin requires AMXX 1.9 or above.

Read error first line amx 1.10

OciXCrom 01-09-2020 06:52

Re: fix small code
 
What error?

iceeedr 01-09-2020 08:16

Re: fix small code
 
Quote:

Originally Posted by Sanjay Singh (Post 2679488)
Read error first line amx 1.10

You have not updated amx correctly.

PHP Code:

AMX Mod X Compiler 1.10.0.5377
Copyright 
(c1997-2006 ITB CompuPhase
Copyright 
(c2004-2013 AMX Mod X Team

Header size
:            732 bytes
Code size
:             4412 bytes
Data size
:             4244 bytes
Stack
/heap size:      16384 bytes
Total requirements
:   25772 bytes
Done
.
[
Finished in 0.2s


Sanjay Singh 01-09-2020 10:35

Re: fix small code
 
Quote:

Originally Posted by iceeedr (Post 2679506)
You have not updated amx correctly.

PHP Code:

AMX Mod X Compiler 1.10.0.5377
Copyright 
(c1997-2006 ITB CompuPhase
Copyright 
(c2004-2013 AMX Mod X Team

Header size
:            732 bytes
Code size
:             4412 bytes
Data size
:             4244 bytes
Stack
/heap size:      16384 bytes
Total requirements
:   25772 bytes
Done
.
[
Finished in 0.2s


Edit: Plugin Compiled in 1.10 , idk exactly how.

Can you guys convert this plugin to 1.8.2?

DruGzOG 01-09-2020 10:57

Re: fix small code
 
Quote:

Originally Posted by Sanjay Singh (Post 2679519)
Edit: Plugin Compiled in 1.10 , idk exactly how.

Can you guys convert this plugin to 1.8.2?

Wouldn't work. Best to upgrade your amxmodx and compile the plugin.
Why are you even using 1.8.2?

Sanjay Singh 01-09-2020 11:13

Re: fix small code
 
Quote:

Originally Posted by DruGzOG (Post 2679521)
Wouldn't work. Best to upgrade your amxmodx and compile the plugin.
Why are you even using 1.8.2?

most of my plugins are in 1.8.2 and also some old plugins which I don't have source.

DruGzOG 01-09-2020 11:43

Re: fix small code
 
Quote:

Originally Posted by Sanjay Singh (Post 2679522)
most of my plugins are in 1.8.2 and also some old plugins which I don't have source.

And you're aware that its backwards compatible? Meaning a lot of what was functioning in 1.8.2 should work on the latest stable builds

OciXCrom 01-09-2020 13:26

Re: fix small code
 
You can replace "fmt" with "formatex", but there is no "GetFileTime" alternative in 1.8.2.

There's no reason to still use 1.8.2 - plugins will still work even if not compiled under newer versions.

Quote:

Originally Posted by DruGzOG (Post 2679528)
Meaning a lot of what was functioning in 1.8.2 should work on the latest stable builds

Not a lot, but all of it. That's the point of backwards-compatibility. If something isn't working, it should reported and it will be fixed ASAP.


All times are GMT -4. The time now is 02:48.

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