Msypon Posted September 16, 2012 Posted September 16, 2012 I want to /modinfo But it doesnt work what is wrong? function handleOnPlayerModInfo ( source, cmd, target, filename, modList ) if ( target ) then local targetplayer = getPlayerFromName ( target ) outputChatBox( getPlayerName(targetplayer) .. " " .. filename ) for idx,mod in ipairs(modList) do local line = tostring(idx) .. ")" for k,v in pairs(mod) do line = line .. " " .. tostring(k) .. "=" .. tostring(v) end outputChatBox( line ) addEventHandler ( "onPlayerModInfo", getRootElement(), handleOnPlayerModInfo ) end end end addCommandHandler("modinfo",handleOnPlayerModInfo)
Cadu12 Posted September 16, 2012 Posted September 16, 2012 I guess you can't use onPlayerModInfo with command. onPlayerModInfo will be triggered when connect server. Ingame nick: Cadu12
Castillo Posted September 16, 2012 Posted September 16, 2012 This doesn't make any sense. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Msypon Posted September 17, 2012 Author Posted September 17, 2012 So its impossible to make a /modinfo ?
Jaysds1 Posted September 17, 2012 Posted September 17, 2012 So its impossible to make a /modinfo ? basically, because the event is the only thing that could send the mod info but I know a way EDITED: Server addCommandHandler("modinfo",function(source,_,pName) if isObjectInACLGroup("user."..getAccountName(getAccount(source)),aclGetGroup("admin"))then local player = getPlayerFromName(pName) if not player then outputChatBox("Sorry, but there's no one named "..pName,source,100,0,0) return end triggerClientEvent(player,"getModInfo",player,source) end end) addEvent("receiveModInfo",true) addEventHandler("receiveModInfo",root,function(file) if file then if outputConsole(fileRead("mods.txt",fileGetSize("mods.txt")),client) then outputChatBox("Mods Loaded, Check Console for mods info.",client,0,100,0) end else outputChatBox("There's no mods available!",client,100,0,0) end end) addEventHandler("onPlayerModInfo",root,function(filename, modList) triggerClientEvent(source,"saveModInfo",source,filename,modList) end) Client addEvent("getModInfo",true) addEventHandler("getModInfo",root,function(rPlayer) triggerServerEvent("receiveModInfo",rPlayer,fileOpen("mods.txt")) end) addEvent("saveModInfo",true) addEventHandler("saveModInfo",root,function(filename,modList) local file=fileCreate("mods.txt") if file then local mod = "File: "..filename.." Contents:\n" for _,v in ipairs(modList)do mod = mod.." "..v end fileWrite("mods.txt",mod) fileClose(file) end end) My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
Msypon Posted September 18, 2012 Author Posted September 18, 2012 Sorry it is not working but thanks anywat
Cadu12 Posted September 18, 2012 Posted September 18, 2012 Server-side only: local DataPlayer = { } function onPlayerCommand ( player, command, target ) local tp = getPlayerFromName ( target ) if ( target ) then if ( DataPlayer[tp] ) then outputChatBox( getPlayerName(tp) .. " " .. DataPlayer[tp]["filename"] ) for idx, mod in ipairs ( DataPlayer[tp]["list"] ) do local line = tostring ( idx ) .. ")" for k, v in pairs ( mod ) do line = line .. " " .. tostring ( k ) .. "=" .. tostring ( v ) end outputChatBox( line ) end end end end addCommandHandler ( "modinfo", onPlayerCommand ) function onPlayerModInfo ( filename, modlist ) if ( not DataPlayer[source] ) then DataPlayer[source] = { ["filename"] = filename, ["list"] = modlist } end end addEventHandler ( "onPlayerModInfo", getRootElement ( ), onPlayerModInfo ) Not tested yet. Ingame nick: Cadu12
Msypon Posted September 18, 2012 Author Posted September 18, 2012 Another question How to put only the name? Example: Msypon gta3.img> something.txd; something2.dff... Without id, hash...
Cadu12 Posted September 18, 2012 Posted September 18, 2012 What do you mean by that? If you want make a player offline with name or serial? Ingame nick: Cadu12
Msypon Posted September 18, 2012 Author Posted September 18, 2012 No, for example i typed /modinfo Msypon and then shows on chat: Msypon gta3.img: car.txd; someskins.dff; bike.dff... Only the name of file modified without id, hush, size and others Like this:
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now