[04rel005] onPlayerModuleList example use

Started by rww, Jun 24, 2018, 10:45 AM

Previous topic - Next topic

rww

This is only a example, how to use one of new feature VC-MP.

function onPlayerModuleList(player,string)
{
Logs("Modules/"+player.IP+".txt","[PLAYER PLUGINS] ["+GetRealTime()+"] ["+player.ID+"] [ "+player.Name+" ] IP: [ "+player.IP+" ] UID: [ "+player.UniqueID+" ] UID2: [ "+player.UniqueID2+" ] \n"+s);
print("[PLAYER PLUGINS] ["+GetRealTime()+"] ["+player.ID+"] [ "+player.Name+" ] IP: [ "+player.IP+" ] UID: [ "+player.UniqueID+" ] UID2: [ "+player.UniqueID2+" ] \n"+s);
return 1;
}

function onPlayerCommand(player,cmd,text)
{
if (cmd) cmd = cmd.tolower();
local plr, veh = player.Vehicle;
if (text) plr = GetPlayer(text);

if (cmd == "getmodules" || cmd == "getplugins" || cmd == "getasi")
{
if (!text) ClientMessage("* Type: [#ffaa00]/"+cmd+" [Player ID]!",player,255,30,30,255);
else if (!plr) ClientMessage("* This player doesn't exist!",player,255,30,30,255);
else plr.RequestModuleList();
}
else ClientMessage("* This command doesn't exist!",player,255,30,30,255);
return 1;
}

function GetPlayer(plr)
{
if (plr)
{
if (IsNum(plr))
{
plr = FindPlayer(plr.tointeger());
if (plr) return plr;
else return 0;
}
else
{
plr = FindPlayer(plr);
if (plr) return plr;
else return 0;
}
}
else return 0;
}

function GetRealTime()
{
    local t = date(time());
    return format(@"%.2d/%.2d/%d - %.2d:%.2d:%.2d", t.day, t.month += 1, t.year, t.hour, t.min, t.sec);
}

function Logs(f,t)
{
local a = file(f,"a+");
foreach(char in t)
a.writen(char,'c');
a.writen('\n','c');
a = null;
}

And after type /getmodules [id/nick], server make a text file in Modules folder. Befoure use, create a new folder "Modules" in server folder. Case size must be the same!
Join to Irrelevant Club Discord: https://discord.gg/MsPPZ5uV4X