Jump to content

Help Manager


CapY

Recommended Posts

I have searched on the wiki , but i cant find the answer , i edited a helpmanager to this :

local rootElement = getRootElement() 
local thisResourceRoot = getResourceRootElement(getThisResource()) 
local pagesXml 
  
local wndHelp, wndBlock, tPanel, btnClose 
local tab = {} 
local memo = {} 
local popupQueue = {} 
local Grid = {} 
  
local HELP_KEY = "F9" 
local HELP_COMMAND = "gamehelp" 
local POPUP_TIMEOUT = 15000 --ms 
local FADE_DELTA = 10 --alpha per frame 
local MAX_ALPHA = 10 
  
  
addEvent("doShowHelp", true) 
addEvent("doHideHelp", true) 
addEvent("onHelpShown") 
addEvent("onHelpHidden") 
  
addEventHandler("onClientResourceStart", thisResourceRoot,  
    function () 
        wndHelp  = guiCreateWindow(.2, .2, .6, .6, "Help", true) 
        wndBlock = guiCreateWindow(0, 0, 1, 1, "", true) 
        tPanel   = guiCreateGridList(0.2086 ,0.1629, 0.6000, 0.6000, true, Grid)           
        btnClose = guiCreateButton(.4, .92, .2, .08, "Close", true, wndHelp) 
  
        guiSetVisible(wndHelp, false) 
        guiSetVisible(wndBlock, false) 
         
        guiWindowSetSizable(wndHelp, false) 
        guiSetAlpha(wndBlock, 0) 
         
        addEventHandler("onClientGUIClick", btnClose, 
            function() 
                if source == this then 
                    clientToggleHelp(false) 
                end 
            end 
        ) 
         
        pagesXml = xmlLoadFile("seen.xml") 
        if not pagesXml then 
            pagesXml = xmlCreateFile("seen.xml", "seen") 
        end 
         
        for i, resourceRoot in ipairs(getElementsByType("resource")) do --!w 
            local resource = getResourceFromName(getElementID(resourceRoot)) 
            if resource then 
                addHelpTabFromXML(resource) 
            end 
        end 
         
        addCommandHandler(HELP_COMMAND, clientToggleHelp) 
        bindKey(HELP_KEY, "down", clientToggleHelp) 
    end 
) 
  
addEventHandler("onClientResourceStop", thisResourceRoot, 
    function() 
        showCursor(false) 
    end 
) 
  
-- exports 
function showHelp() 
    return clientToggleHelp(true) 
end 
addEventHandler("doShowHelp", rootElement, showHelp) 
  
function hideHelp() 
    return clientToggleHelp(false) 
end 
addEventHandler("doHideHelp", rootElement, hideHelp) 
  
function addHelpTab(resource, showPopup) 
  
    if showPopup == nil then 
        showPopup = true 
    end 
     
    -- block duplicates 
    if tab[resource] then 
        return false 
    end 
     
    local tabtext = getResourceName(resource) 
     
    local helpnode = getResourceConfig(":" .. getResourceName(resource) .. "/help.xml") 
     
    if helpnode then 
     
        local nameattribute = xmlNodeGetAttribute(helpnode, "title"); 
         
        if nameattribute then 
            tabtext = nameattribute; 
        end 
         
    end 
  
    tab[resource] = guiCreateGridList( tabtext , tPanel) 
     
    if showPopup then 
        addHelpPopup(resource) 
    end 
     
    return tab[resource] 
end 
  
function removeHelpTab(resource) 
    if not tab[resource] then 
        return false 
    end 
     
    if memo[resource] then 
        destroyElement(memo[resource]) 
        memo[resource] = nil 
    end 
     
    guiGridListClear(tab[resource], tPanel) 
    tab[resource] = nil 
     
    return true 
end 
addEventHandler("onClientResourceStop", rootElement, removeHelpTab) 
  
--private 
function addHelpTabFromXML(resource) 
    -- block duplicates 
    if tab[resource] then 
        return false 
    end 
         
    local helpnode = getResourceConfig(":"..getResourceName(resource).."/help.xml") 
    if helpnode then 
        local helptext = xmlNodeGetValue(helpnode) 
        local showPopup = not (xmlNodeGetAttribute(helpnode, "popup") == "no") 
        if helptext then 
            guiGridListAddRow(resource, showPopup) 
            memo[resource] = guiCreateMemo(.01800, .00040, .08080, .09960, helptext, true, tab[resource]) 
            guiMemoSetReadOnly(memo[resource], true) 
        end 
    end 
end 
addEventHandler("onClientResourceStart", rootElement, addHelpTabFromXML) 
  
function clientToggleHelp(state) 
    if state ~= true and state ~= false then 
        state = not guiGetVisible(wndHelp) 
    end 
    guiSetVisible(wndHelp, state) 
    guiSetVisible(wndBlock, state) 
    if state == true then 
        triggerEvent("onHelpShown", localPlayer) 
        guiBringToFront(wndBlock) 
        guiBringToFront(wndHelp) 
        showCursor(true) 
    else 
        triggerEvent("onHelpHidden", localPlayer) 
        showCursor(false) 
    end 
    return true 
end 
  
local function fadeIn(wnd) 
    local function raiseAlpha() 
        local newAlpha = guiGetAlpha(wnd) + FADE_DELTA 
        if newAlpha <= MAX_ALPHA then 
            guiSetAlpha(wnd, newAlpha) 
        else 
            removeEventHandler("onClientRender", rootElement, raiseAlpha) 
        end 
    end 
    addEventHandler("onClientRender", rootElement, raiseAlpha) 
end 
  
local function fadeOut(wnd) 
    local function lowerAlpha() 
        local newAlpha = guiGetAlpha(wnd) - FADE_DELTA 
        if newAlpha >= 0 then 
            guiSetAlpha(wnd, newAlpha) 
        else 
            removeEventHandler("onClientRender", rootElement, lowerAlpha) 
            destroyElement(wnd) 
             
            table.remove(popupQueue, 1) 
            if #popupQueue > 0 then 
                showHelpPopup(popupQueue[1]) 
            end 
        end 
    end 
    addEventHandler("onClientRender", rootElement, lowerAlpha) 
end 
  
function addHelpPopup(resource) 
    local xmlContents = xmlNodeGetValue(pagesXml) 
    local seenPages = split(xmlContents, string.byte(',')) 
    local resourceName = getResourceName(resource) 
    for i, page in ipairs(seenPages) do 
        if page == resourceName then 
            return 
        end 
    end 
    xmlNodeSetValue(pagesXml, xmlContents..resourceName..",") 
    xmlSaveFile(pagesXml) 
  
    table.insert(popupQueue, resource) 
    if #popupQueue == 1 then 
        showHelpPopup(resource) 
    end 
end 
  
function showHelpPopup(resource) 
    local screenX, screenY = guiGetScreenSize() 
    local wndPopup = guiCreateWindow(0, screenY - 20, screenX, 0, '', false) --350 
     
    local restitle = getResourceName(resource) 
    local helpnode = getResourceConfig(":" .. getResourceName(resource) .. "/help.xml") 
     
    if helpnode then 
     
        local nameattribute = xmlNodeGetAttribute(helpnode, "title"); 
         
        if nameattribute then 
            restitle = nameattribute; 
        end 
         
    end 
     
    local text = 
        "Help page available for ".. restitle .."! ".. 
        "Press "..HELP_KEY.." or type /"..HELP_COMMAND.." to read it." 
         
    guiSetText(wndPopup, text) 
    guiSetAlpha(wndPopup, 0) 
    guiWindowSetMovable(wndPopup, false) 
    guiWindowSetSizable(wndPopup, false) 
     
    fadeIn(wndPopup) 
    setTimer(fadeOut, POPUP_TIMEOUT, 1, wndPopup) 
end 
  

It's supposted to look like this : http://imageshack.us/photo/my-images/51 ... 34727.png/

But it looks like this : http://imageshack.us/photo/my-images/70 ... 35320.png/ ignore the admin panel.

I did something wrong .

Anybody can help ?

Link to comment
Did i stealed something ?

Actually, yes. You stole Jake's gate code. You stole Sander's double loop idea. You're pretty much copying DKR's server name. You've talked about decompiling scripts while you were in our server. And who knows what else you've stolen from other servers.

You serialbanned Jake and I. Why? So that we couldn't see what else you've stolen/plan on stealing?

You're just a thief. Stealing from others and spamming up the forum with help topics because you can't do anything for yourself. I've got some custom models I'll be adding to my server later. Feel free to come snag them+ the clientside codes. (if you aren't smart enough to understand, that was sarcasm.)

I hope no one here decides to help you until you learn to do stuff for yourself instead of stealing and editing it.

Just thought i might add, just because something is a community resource doesn't mean you can edit and claim it as your own.

And don't tell me to "Get a life" like you tell everyone else who won't help you.

Link to comment

"get a life 2" Well considering i have internet, and living i sure do have a life unlike you who has to go and steal clients and try to get people to help u well im not gunna argue anymore u aint worth it, stop stealing learn to script and stop asking help to fix stolen code have a nice day!

Link to comment
Did i stealed something ?

Actually, yes. You stole Jake's gate code. You stole Sander's double loop idea. You're pretty much copying DKR's server name. You've talked about decompiling scripts while you were in our server. And who knows what else you've stolen from other servers.

You serialbanned Jake and I. Why? So that we couldn't see what else you've stolen/plan on stealing?

You're just a thief. Stealing from others and spamming up the forum with help topics because you can't do anything for yourself. I've got some custom models I'll be adding to my server later. Feel free to come snag them+ the clientside codes. (if you aren't smart enough to understand, that was sarcasm.)

I hope no one here decides to help you until you learn to do stuff for yourself instead of stealing and editing it.

Just thought i might add, just because something is a community resource doesn't mean you can edit and claim it as your own.

And don't tell me to "Get a life" like you tell everyone else who won't help you.

Well said, I'm furious about CapY releasing the freeroam code to the forums (noob-.-) and if you want I'll do some spying for you. :twisted: (a temporary friendship?)

My guess is that you have a very bad reputation in the MTA Forums.

Link to comment
Well said, I'm furious about CapY releasing the freeroam code to the forums (noob-.-) and if you want I'll do some spying for you. :twisted: (a temporary friendship?)

My guess is that you have a very bad reputation in the MTA Forums.

Wouldn't surprise me if he serial-banned you too now.

Link to comment

Okay i will repeat for 3rd time ..Jake, Slayer, Qaisjp get a life, dont comment my topics / posts , stay away from my topics, stop complain, stop accuse , act like my topics doesnt exist, if you cant help ( what actually is true ) then stay away and dont go offtopic. Thank you !

Link to comment
Okay i will repeat for 3rd time ..Jake, Slayer, Qaisjp get a life, dont comment my topics / posts , stay away from my topics, stop complain, stop accuse , act like my topics doesnt exist, if you cant help ( what actually is true ) then stay away and dont go offtopic. Thank you !

And who are you to tell me what to do? I will stop complaining/accusing when you stop stealing other people's scripts and learn to script for yourself without posting posting 'it broke, wat do??' every time you break something. You even admitted to stealing my code, then soon afterwards you serialban me. Why? So that I can't see you stealing any other of my scripts? Wouldn't surprise me if you had. Shame you have to steal other people's work/ideas because you can't make your own. You're lucky the script you stole from my Admin Base was a public resource, I have a right mind to tell you to remove it and disallow you from using it.

Link to comment

Why should I act for someone who steals my server's script and on top of that put it on here. I will not act like your topics do not exists and if you remember I am trying to help, help YOU get a life. Also, i asked you "Is it fixed yet" so pwned. This forum is owned by Multi Theft Auto (or phpBB?) so I don't have to listen to your warning/order "Stay away from my topics", I will complain since i want to prevent shit happening to others.

Oh look, you got the attention of [DKR]Oz. Think of your own ideas! 16 people looking at your topic, i wonder what they think.

Link to comment
Okay i will repeat for 3rd time ..Jake, Slayer, Qaisjp get a life, dont comment my topics / posts , stay away from my topics, stop complain, stop accuse , act like my topics doesnt exist, if you cant help ( what actually is true ) then stay away and dont go offtopic. Thank you !

Don't tell me not to accuse you of anything when all the evidence is right in front of our faces.

If you didn't steal ideas and scripts I wouldn't be commenting here right now.

So thank yourself for that.

I don't want to descend on your level, oh qaisjp now i stealed something yours , really , from where you get that stupid idea anyway.

Do you mean ascend? I'm pretty sure everyone else (myself included) is on a much higher level than you seeing as we can script and model our own stuff+get it into the server flawlessly. On two occasions I've seen you steal some code and then ask for help to fix or change it (minus the countless things that look VERY similar to certain servers, which I'm sure you didn't have first).

I'm just trying to make it obvious (if it isn't already) that you're a code stealer who leeches off the community for help. So far no one has gotten a half intelligent reply from you. You continue to steal and don't deny it when someone accuses you of thieving. You completely ignore their accusation(s) and continue what you were doing before, stealing a code then posting on the forums shortly after you break the stolen it.

and Slayer .. you, Sander and Jake are banned for a reason , remind yourself why .

I don't know why I was banned (since you didn't ban my serial whilst I was online), refresh my memory?

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...