AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   client check if file exist (force consistency method) need C++ readers to read code (https://forums.alliedmods.net/showthread.php?t=86615)

Owyn 02-28-2009 07:23

client check if file exist (force consistency method) need C++ readers to read code
 
hlguard checks .mdl files and if they are not standart hlguard kick player, my question is how to do such thing? and can it just check if file is there or not?

Arkshine 02-28-2009 08:03

Re: client file check (file force consistency (like in hlguard for .mdl files)) how?
 
Use soundcheck (metamod plugin ) or that ( amxx plugin )

Owyn 02-28-2009 08:27

Re: client file check (file force consistency (like in hlguard for .mdl files)) how?
 
thx, i found some amxx functions like force_unmodified(), but i was talking about simple check if file exist

i looked into amxx code and found function for forcing consistency


Code:

static cell AMX_NATIVE_CALL force_unmodified(AMX *amx, cell *params)
{
    int a;
   
    cell *cpVec1 = get_amxaddr(amx, params[2]);
    cell *cpVec2 = get_amxaddr(amx, params[3]);
   
    Vector vec1 = Vector((float)cpVec1[0], (float)cpVec1[1], (float)cpVec1[2]);
    Vector vec2 = Vector((float)cpVec2[0], (float)cpVec2[1], (float)cpVec2[2]);
   
    char* filename = get_amxstring(amx, params[4], 0, a);

    ForceObject* aaa = new ForceObject(filename, (FORCE_TYPE)((int)(params[1])), vec1, vec2, amx);

    if (aaa)
    {
        if (stristr(filename, ".wav"))
            g_forcesounds.put(aaa);
        else if (stristr(filename, ".mdl"))
            g_forcemodels.put(aaa);
        else
            g_forcegeneric.put(aaa);

        return 1;
    }

    return 0;
}


class ForceObject
{
    String filename;
    FORCE_TYPE type;
    Vector mins;
    Vector maxs;
    AMX* amx;
public:
    ForceObject(const char* n, FORCE_TYPE c, Vector& mi, Vector& ma, AMX* a) : filename(n), type(c), mins(mi), maxs(ma), amx(a) {}

    inline const char* getFilename() { return filename.c_str(); }
    inline AMX* getAMX() { return amx; }
   
    Vector& getMin() { return mins; }
    Vector& getMax() { return maxs; }
   
    inline FORCE_TYPE getForceType() { return type; }
};

*will appreciate any help
with force_unmodified() you can check any files and it works perfectly, so it gets crc32 from client file then it gets crc32 from server file and compares them, in my case i need to stop at getting crc32 for client file and know if file exist but amxx source looks so confusing =\

MeRcyLeZZ 03-16-2009 22:01

Re: client check if file exist (force consistency method) need C++ readers to read co
 
Quote:

Originally Posted by .Owyn.
with force_unmodified() you can check any files and it works perfectly, so it gets crc32 from client file then it gets crc32 from server file and compares them, in my case i need to stop at getting crc32 for client file and know if file exist but amxx source looks so confusing =\

I believe the CRC checking part is entirely handled by the engine, so likely there is no way of finding out whether a player has a certain file or not via AMXX.

pike 07-16-2009 23:10

Re: client check if file exist (force consistency method) need C++ readers to read co
 
Quote:

Originally Posted by MeRcyLeZZ (Post 782385)
I believe the CRC checking part is entirely handled by the engine, so likely there is no way of finding out whether a player has a certain file or not via AMXX.

but if do checking for presence exactly such file as on server ?


All times are GMT -4. The time now is 17:01.

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