Include For Admin System
#8

Quote:
Originally Posted by KillerDVX
Посмотреть сообщение
Dude, why you would have this include ? you scripted your own FS, no need to include it.

- KillerDVX.
No, includes for admin scripts are required if someone is interested in integrating the admin system with other scripts and especially for gamemodes.

OT:
In order to make an include, you need to study your database structure, assuming you are known to such things as you coded the admin script. There is no problem in making one. You may also use PVars (https://sampwiki.blast.hk/wiki/Per-player_variable_system) only if your admin system is using it, using PVars will increase the reading and writing speed, overall performance and there would be no hassle of database structuring as well.

But in order to read player stats and records, use your database functions.

For example you are using easydb.inc, i can make a simple player admin level reader:
pawn Код:
stock GetPlayerAdminLevel(playerid) {
    new
        t_sName[MAX_PLAYER_NAME],
        t_iKey
    ;
    GetPlayerName(playerid, t_sName, MAX_PLAYER_NAME);
    t_iKey = DB::RetrieveKey(user_table, "username", t_sName);

    if (t_iKey != DB::INVALID_KEY) {
        return DB::GetIntEntry(user_table, t_iKey, "admin");
    }
   
    return 0;
}
This will read the column "adminlevel" from the specified table from a SQLITE database.

In case you are using dini:
pawn Код:
stock GetPlayerAdminLevel(playerid) {
    new
        t_sName[MAX_PLAYER_NAME],
        t_sPath[MAX_PLAYER_NAME + 20]
    ;
    GetPlayerName(playerid, t_sName, MAX_PLAYER_NAME);
    strcat(t_sPath, "AdminPath/");
    strcat(t_sPath, t_sName);
    strcat(t_sPath, ".ini");
    if (! dini_Exists(t_sPath)) {
        return 0;
    }

    return dini_Int(t_sPath, "adminlevel");
}
Reading the value from ini file(player name) situated in "AdminPath" folder.
Reply


Messages In This Thread
Include For Admin System - by Harith - 09.09.2015, 07:54
Re: Include For Admin System - by saffierr - 09.09.2015, 07:57
Re: Include For Admin System - by Harith - 09.09.2015, 08:01
Re: Include For Admin System - by saffierr - 09.09.2015, 08:07
Re: Include For Admin System - by Harith - 09.09.2015, 08:08
Re: Include For Admin System - by Harith - 09.09.2015, 08:12
Re : Include For Admin System - by KillerDVX - 09.09.2015, 10:54
Re: Re : Include For Admin System - by Gammix - 09.09.2015, 11:05
Re : Include For Admin System - by KillerDVX - 09.09.2015, 11:09
Re: Re : Include For Admin System - by Gammix - 09.09.2015, 11:10

Forum Jump:


Users browsing this thread: 1 Guest(s)