Jump to content

Problem with script


pocko

Recommended Posts

Hi all i tryed to make somethink like pm script but in gui window.But somewhere have problem please help :x

local Window = {} 
local Memo ={} 
local Edit = {} 
local Button = {} 
local Label = {} 
  
local g_Me = getLocalPlayer() 
local g_ResRoot = getResourceRootElement() 
local g_Root = getRootElement() 
local w,h = guiGetScreenSize( ) 
  
active,typing,out = 0 
  
local function click(button,state) 
    if button ~= "left" then return end      
    local pname = getElementType(source) == "gui-window" and string.sub(guiGetText(source),13) or string.sub(guiGetText(getElementParent(source)),13)    
    guiSetVisible(Label[pname][1],false) 
    guiSetVisible(Label[pname][2],false) 
    active = pname 
    guiSetInputEnabled(false) 
    if source == Edit[pname] then guiSetInputEnabled(true) 
    elseif getElementType(source) == "gui-button" then 
        if guiGetText(source) == "Close" then 
            guiSetVisible(Window[pname],false) 
            active = nil 
            showCursor(false) 
            guiSetVisible(Label[pname][1],true) 
            guiSetVisible(Label[pname][2],true) 
            guiSetInputEnabled(false) 
        end 
    elseif guiGetText(source) == "Ignore" then 
        pm_ignore(pname,source) 
    end 
end 
  
function openPM(pname,quiet) 
    pname = string.upper(pname)  
    if Window[pname] then 
        if guiGetAlpha(Window[pname]) < 0.11 then 
            guiSetAlpha(Window[pname],0.6) 
            if quiet then setTimer(loseAlpha,2000,1,Window[pname]) end 
        else 
            guiSetVisible(Window[pname],not guiGetVisible(Window[pname])) 
            if quiet and guiGetVisible(Window[pname]) then setTimer(loseAlpha,2000,1,Window[pname]) end 
        end 
        return  
    end 
    Window[pname] = guiCreateWindow(0.55*w,0.55*h,0.35*w,0.225*h,"PM Window - " .. tostring(pname),false) 
    guiSetAlpha(Window[pname],0.6) 
    guiWindowSetSizable(Window[pname],false) 
    local w,h = guiGetSize(Window[pname],false) 
    Memo[pname] = guiCreateMemo(0.025*w,25,0.95*w,h-25-(0.225*h),"",false,Window[pname]) 
    guiMemoSetReadOnly(Memo[pname],true) 
    guiSetProperty(Memo[pname],"ForceVertScrollbar","True") 
    guiSetProperty(Memo[pname],"VertScrollPosition","0.5") 
    Edit[pname] = guiCreateEdit(0.025*w,h-(0.2*h),0.5*w,0.25*h,"",false,Window[pname]) 
    guiEditSetMaxLength ( Edit[pname], 128 )     
    addEventHandler('onClientGUIAccepted', Edit[pname],function(active) sendText(active); end) 
    addEventHandler('onClientGUIClick', Window[pname], click) 
     
    Button[#Button+1] = guiCreateButton(0.75*w,h-(0.2*h),0.225*w,0.25*h,"Close",false,Window[pname]) 
    Button[#Button+1] = guiCreateCheckBox(0.54*w,h-(0.2*h),0.225*w,0.25*h,"Ignore",false,false,Window[pname]) 
     
    local ilist,xml,xmlNode,serial = nil, xmlLoadFile("pm_settings.xml") 
    if xml then 
        xmlNode = xmlFindChild( xml , "ignore" , 0 ) 
        ilist = xmlNodeGetValue(xmlNode) 
        serial = getElementData(getPlayerFromName(pname),"serial") 
        if serial and string.find(ilist," "..serial.." ",0,true) then 
            guiCheckBoxSetSelected( Button[#Button] , true ) 
        end 
    end 
     
    Label[pname] = {} 
    Label[pname][1] = guiCreateLabel(0,0,1,1,"Press F3 to get mouse control",true,Memo[pname])   
    guiLabelSetColor(Label[pname][1],255,0,0) 
    guiLabelSetVerticalAlign(Label[pname][1],"center") 
    guiLabelSetHorizontalAlign(Label[pname][1],"center") 
    guiSetVisible(Label[pname][1],false) 
    guiSetEnabled(Label[pname][1],false) 
    Label[pname][2] = guiCreateLabel(0.02,0,1,1,"Click here to type",true,Edit[pname]) 
    guiLabelSetColor(Label[pname][2],255,0,0) 
    guiLabelSetVerticalAlign(Label[pname][2],"center") 
    guiLabelSetHorizontalAlign(Label[pname][2],"left") 
    guiSetVisible(Label[pname][2],false) 
    guiSetEnabled(Label[pname][2],false) 
     
    if not quiet then showCursor(true) 
    else guiSetVisible(Label[pname][1],true);guiSetVisible(Label[pname][2],true);setTimer(loseAlpha,2000,1,Window[pname]) 
    end 
end 
  
addEvent("newNick",true) 
addEventHandler("newNick",g_Root, 
    function(old,new) 
        old = string.upper(old) 
        new = string.upper(new) 
        if not Window[old] or Window[new] then return end 
        Window[new] = Window[old] 
        Label[new] = Label[old] 
        Edit[new] = Edit[old] 
        Memo[new] = Memo[old] 
        guiSetText(Window[new],"PM Window - " .. tostring(new)) 
        Window[old] = nil 
        Label[old] = nil 
        Edit[old] = nil 
        Memo[old] = nil 
    end 
) 
  
function loseAlpha(elem) 
    setTimer(dissapear,50,5,elem) 
end 
function dissapear(elem) 
    guiSetAlpha(elem,guiGetAlpha(elem)-0.1) 
end 
  
addEventHandler( "onClientMouseEnter", g_Root,  
    function() 
        if getElementType(source) == "gui-window" and string.sub(guiGetText(source),0,9) == "PM Window" and guiGetAlpha(source) < 0.11 then guiSetAlpha(source,0.6) end 
    end 
) 
  
function pm_ignore( who , check ) 
    if guiCheckBoxGetSelected(check) then 
        local ilist,xml,xmlNode = nil 
        xml = xmlLoadFile("pm_settings.xml") 
        if not xml then xml = xmlCreateFile("pm_settings.xml", "settings") end 
        xmlNode = xmlFindChild(xml, "ignore" , 0) 
        local serial = getElementData(getPlayerFromName(who),"serial") 
        if not xmlNode then xmlNode = xmlCreateChild(xml, "ignore"); ilist = " "..serial.." " 
        else ilist = xmlNodeGetValue(xmlNode).." "..serial.." " 
        end 
        ilist = string.gsub(ilist,"  "," ") 
        xmlNodeSetValue(xmlNode, ilist )             
        xmlSaveFile(xml) 
    else 
        local ilist,xml,xmlNode = nil, xmlLoadFile("pm_settings.xml") 
        if xml then 
            xmlNode = xmlFindChild( xml , "ignore" , 0 ) 
            ilist = xmlNodeGetValue(xmlNode) 
            ilist = string.gsub(ilist," "..getElementData(getPlayerFromName(who),"serial").." "," ") 
            xmlNodeSetValue(xmlNode, ilist ) 
            xmlSaveFile(xml) 
        end 
    end 
end 
  
function sendText( active ) 
    if not active then outputChatBox("No active chat"); return end 
    if not isCursorShowing(g_Me) then return end 
    active = string.sub(guiGetText(getElementParent(active)),13) 
    local text = guiGetText ( Edit[active] ) 
    if not text or string.len(text) < 1 then return end 
    guiSetText( Edit[active] , "" ) 
    guiSetText( Memo[active] , (guiGetText(Memo[active]) ~= "\n" and guiGetText(Memo[active]) or "") .. getPlayerName(g_Me) .. ": " .. text ) 
    triggerServerEvent( "sendText" , g_ResRoot , g_Me , active , text ) 
    guiMemoSetCaretIndex(Memo[active],#guiGetText(Memo[active])) 
end 
function getText(from,text) 
    local name = from 
    from = string.upper(from) 
     
    local ilist,xml,xmlNode = nil, xmlLoadFile("pm_settings.xml") 
    if not getElementData(getPlayerFromName(from),"admin") and xml then 
        xmlNode = xmlFindChild( xml , "ignore" , 0 ) 
        ilist = xmlNodeGetValue(xmlNode) 
        local serial = getElementData(getPlayerFromName(from),"serial") 
        if serial and string.find(ilist," "..serial.." ",0,true) then return end 
    end 
     
    if not Window[from] or not guiGetVisible(Window[from]) then openPM(from,true) end 
    guiSetText(Memo[from], (guiGetText(Memo[from]) ~= "\n" and guiGetText(Memo[from]) or "") .. name .. ": " .. text)    
    guiMemoSetCaretIndex(Memo[from],#guiGetText(Memo[from])) 
end 
  
addEvent("openPM",true) 
addEventHandler( "openPM" , g_ResRoot , openPM) 
addEvent("getText",true) 
addEventHandler( "getText" , g_ResRoot , getText) 

Edited by Guest
Link to comment
Hi all i tryed to make somethink like pm script but in gui window.But somewhere have problem please help :x
local Window = {} 
local Memo ={} 
local Edit = {} 
local Button = {} 
local Label = {} 
  
local g_Me = getLocalPlayer() 
local g_ResRoot = getResourceRootElement() 
local g_Root = getRootElement() 
local w,h = guiGetScreenSize( ) 
  
active,typing,out = 0 
  
local function click(button,state) 
    if button ~= "left" then return end      
    local pname = getElementType(source) == "gui-window" and string.sub(guiGetText(source),13) or string.sub(guiGetText(getElementParent(source)),13)    
    guiSetVisible(Label[pname][1],false) 
    guiSetVisible(Label[pname][2],false) 
    active = pname 
    guiSetInputEnabled(false) 
    if source == Edit[pname] then guiSetInputEnabled(true) 
    elseif getElementType(source) == "gui-button" then 
        if guiGetText(source) == "Close" then 
            guiSetVisible(Window[pname],false) 
            active = nil 
            showCursor(false) 
            guiSetVisible(Label[pname][1],true) 
            guiSetVisible(Label[pname][2],true) 
            guiSetInputEnabled(false) 
        end 
    elseif guiGetText(source) == "Ignore" then 
        pm_ignore(pname,source) 
    end 
end 
  
function openPM(pname,quiet) 
    pname = string.upper(pname)  
    if Window[pname] then 
        if guiGetAlpha(Window[pname]) < 0.11 then 
            guiSetAlpha(Window[pname],0.6) 
            if quiet then setTimer(loseAlpha,2000,1,Window[pname]) end 
        else 
            guiSetVisible(Window[pname],not guiGetVisible(Window[pname])) 
            if quiet and guiGetVisible(Window[pname]) then setTimer(loseAlpha,2000,1,Window[pname]) end 
        end 
        return  
    end 
    Window[pname] = guiCreateWindow(0.55*w,0.55*h,0.35*w,0.225*h,"PM Window - " .. tostring(pname),false) 
    guiSetAlpha(Window[pname],0.6) 
    guiWindowSetSizable(Window[pname],false) 
    local w,h = guiGetSize(Window[pname],false) 
    Memo[pname] = guiCreateMemo(0.025*w,25,0.95*w,h-25-(0.225*h),"",false,Window[pname]) 
    guiMemoSetReadOnly(Memo[pname],true) 
    guiSetProperty(Memo[pname],"ForceVertScrollbar","True") 
    guiSetProperty(Memo[pname],"VertScrollPosition","0.5") 
    Edit[pname] = guiCreateEdit(0.025*w,h-(0.2*h),0.5*w,0.25*h,"",false,Window[pname]) 
    guiEditSetMaxLength ( Edit[pname], 128 )     
    addEventHandler('onClientGUIAccepted', Edit[pname],function(active) sendText(active); end) 
    addEventHandler('onClientGUIClick', Window[pname], click) 
     
    Button[#Button+1] = guiCreateButton(0.75*w,h-(0.2*h),0.225*w,0.25*h,"Close",false,Window[pname]) 
    Button[#Button+1] = guiCreateCheckBox(0.54*w,h-(0.2*h),0.225*w,0.25*h,"Ignore",false,false,Window[pname]) 
     
    local ilist,xml,xmlNode,serial = nil, xmlLoadFile("pm_settings.xml") 
    if xml then 
        xmlNode = xmlFindChild( xml , "ignore" , 0 ) 
        ilist = xmlNodeGetValue(xmlNode) 
        serial = getElementData(getPlayerFromName(pname),"serial") 
        if serial and string.find(ilist," "..serial.." ",0,true) then 
            guiCheckBoxSetSelected( Button[#Button] , true ) 
        end 
    end 
     
    Label[pname] = {} 
    Label[pname][1] = guiCreateLabel(0,0,1,1,"Press F3 to get mouse control",true,Memo[pname])   
    guiLabelSetColor(Label[pname][1],255,0,0) 
    guiLabelSetVerticalAlign(Label[pname][1],"center") 
    guiLabelSetHorizontalAlign(Label[pname][1],"center") 
    guiSetVisible(Label[pname][1],false) 
    guiSetEnabled(Label[pname][1],false) 
    Label[pname][2] = guiCreateLabel(0.02,0,1,1,"Click here to type",true,Edit[pname]) 
    guiLabelSetColor(Label[pname][2],255,0,0) 
    guiLabelSetVerticalAlign(Label[pname][2],"center") 
    guiLabelSetHorizontalAlign(Label[pname][2],"left") 
    guiSetVisible(Label[pname][2],false) 
    guiSetEnabled(Label[pname][2],false) 
     
    if not quiet then showCursor(true) 
    else guiSetVisible(Label[pname][1],true);guiSetVisible(Label[pname][2],true);setTimer(loseAlpha,2000,1,Window[pname]) 
    end 
end 
  
addEvent("newNick",true) 
addEventHandler("newNick",g_Root, 
    function(old,new) 
        old = string.upper(old) 
        new = string.upper(new) 
        if not Window[old] or Window[new] then return end 
        Window[new] = Window[old] 
        Label[new] = Label[old] 
        Edit[new] = Edit[old] 
        Memo[new] = Memo[old] 
        guiSetText(Window[new],"PM Window - " .. tostring(new)) 
        Window[old] = nil 
        Label[old] = nil 
        Edit[old] = nil 
        Memo[old] = nil 
    end 
) 
  
function loseAlpha(elem) 
    setTimer(dissapear,50,5,elem) 
end 
function dissapear(elem) 
    guiSetAlpha(elem,guiGetAlpha(elem)-0.1) 
end 
  
addEventHandler( "onClientMouseEnter", g_Root,  
    function() 
        if getElementType(source) == "gui-window" and string.sub(guiGetText(source),0,9) == "PM Window" and guiGetAlpha(source) < 0.11 then guiSetAlpha(source,0.6) end 
    end 
) 
  
function pm_ignore( who , check ) 
    if guiCheckBoxGetSelected(check) then 
        local ilist,xml,xmlNode = nil 
        xml = xmlLoadFile("pm_settings.xml") 
        if not xml then xml = xmlCreateFile("pm_settings.xml", "settings") end 
        xmlNode = xmlFindChild(xml, "ignore" , 0) 
        local serial = getElementData(getPlayerFromName(who),"serial") 
        if not xmlNode then xmlNode = xmlCreateChild(xml, "ignore"); ilist = " "..serial.." " 
        else ilist = xmlNodeGetValue(xmlNode).." "..serial.." " 
        end 
        ilist = string.gsub(ilist,"  "," ") 
        xmlNodeSetValue(xmlNode, ilist )             
        xmlSaveFile(xml) 
    else 
        local ilist,xml,xmlNode = nil, xmlLoadFile("pm_settings.xml") 
        if xml then 
            xmlNode = xmlFindChild( xml , "ignore" , 0 ) 
            ilist = xmlNodeGetValue(xmlNode) 
            ilist = string.gsub(ilist," "..getElementData(getPlayerFromName(who),"serial").." "," ") 
            xmlNodeSetValue(xmlNode, ilist ) 
            xmlSaveFile(xml) 
        end 
    end 
end 
  
function sendText( active ) 
    if not active then outputChatBox("No active chat"); return end 
    if not isCursorShowing(g_Me) then return end 
    active = string.sub(guiGetText(getElementParent(active)),13) 
    local text = guiGetText ( Edit[active] ) 
    if not text or string.len(text) < 1 then return end 
    guiSetText( Edit[active] , "" ) 
    guiSetText( Memo[active] , (guiGetText(Memo[active]) ~= "\n" and guiGetText(Memo[active]) or "") .. getPlayerName(g_Me) .. ": " .. text ) 
    triggerServerEvent( "sendText" , g_ResRoot , g_Me , active , text ) 
    guiMemoSetCaretIndex(Memo[active],#guiGetText(Memo[active])) 
end 
function getText(from,text) 
    local name = from 
    from = string.upper(from) 
     
    local ilist,xml,xmlNode = nil, xmlLoadFile("pm_settings.xml") 
    if not getElementData(getPlayerFromName(from),"admin") and xml then 
        xmlNode = xmlFindChild( xml , "ignore" , 0 ) 
        ilist = xmlNodeGetValue(xmlNode) 
        local serial = getElementData(getPlayerFromName(from),"serial") 
        if serial and string.find(ilist," "..serial.." ",0,true) then return end 
    end 
     
    if not Window[from] or not guiGetVisible(Window[from]) then openPM(from,true) end 
    guiSetText(Memo[from], (guiGetText(Memo[from]) ~= "\n" and guiGetText(Memo[from]) or "") .. name .. ": " .. text)    
    guiMemoSetCaretIndex(Memo[from],#guiGetText(Memo[from])) 
end 
  
addEvent("openPM",true) 
addEventHandler( "openPM" , g_ResRoot , openPM) 
addEvent("getText",true) 
addEventHandler( "getText" , g_ResRoot , getText) 

what problem?

Link to comment
Hi all i tryed to make somethink like pm script but in gui window.But somewhere have problem please help :x
local Window = {} 
local Memo ={} 
local Edit = {} 
local Button = {} 
local Label = {} 
  
local g_Me = getLocalPlayer() 
local g_ResRoot = getResourceRootElement() 
local g_Root = getRootElement() 
local w,h = guiGetScreenSize( ) 
  
active,typing,out = 0 
  
local function click(button,state) 
    if button ~= "left" then return end      
    local pname = getElementType(source) == "gui-window" and string.sub(guiGetText(source),13) or string.sub(guiGetText(getElementParent(source)),13)    
    guiSetVisible(Label[pname][1],false) 
    guiSetVisible(Label[pname][2],false) 
    active = pname 
    guiSetInputEnabled(false) 
    if source == Edit[pname] then guiSetInputEnabled(true) 
    elseif getElementType(source) == "gui-button" then 
        if guiGetText(source) == "Close" then 
            guiSetVisible(Window[pname],false) 
            active = nil 
            showCursor(false) 
            guiSetVisible(Label[pname][1],true) 
            guiSetVisible(Label[pname][2],true) 
            guiSetInputEnabled(false) 
        end 
    elseif guiGetText(source) == "Ignore" then 
        pm_ignore(pname,source) 
    end 
end 
  
function openPM(pname,quiet) 
    pname = string.upper(pname)  
    if Window[pname] then 
        if guiGetAlpha(Window[pname]) < 0.11 then 
            guiSetAlpha(Window[pname],0.6) 
            if quiet then setTimer(loseAlpha,2000,1,Window[pname]) end 
        else 
            guiSetVisible(Window[pname],not guiGetVisible(Window[pname])) 
            if quiet and guiGetVisible(Window[pname]) then setTimer(loseAlpha,2000,1,Window[pname]) end 
        end 
        return  
    end 
    Window[pname] = guiCreateWindow(0.55*w,0.55*h,0.35*w,0.225*h,"PM Window - " .. tostring(pname),false) 
    guiSetAlpha(Window[pname],0.6) 
    guiWindowSetSizable(Window[pname],false) 
    local w,h = guiGetSize(Window[pname],false) 
    Memo[pname] = guiCreateMemo(0.025*w,25,0.95*w,h-25-(0.225*h),"",false,Window[pname]) 
    guiMemoSetReadOnly(Memo[pname],true) 
    guiSetProperty(Memo[pname],"ForceVertScrollbar","True") 
    guiSetProperty(Memo[pname],"VertScrollPosition","0.5") 
    Edit[pname] = guiCreateEdit(0.025*w,h-(0.2*h),0.5*w,0.25*h,"",false,Window[pname]) 
    guiEditSetMaxLength ( Edit[pname], 128 )     
    addEventHandler('onClientGUIAccepted', Edit[pname],function(active) sendText(active); end) 
    addEventHandler('onClientGUIClick', Window[pname], click) 
     
    Button[#Button+1] = guiCreateButton(0.75*w,h-(0.2*h),0.225*w,0.25*h,"Close",false,Window[pname]) 
    Button[#Button+1] = guiCreateCheckBox(0.54*w,h-(0.2*h),0.225*w,0.25*h,"Ignore",false,false,Window[pname]) 
     
    local ilist,xml,xmlNode,serial = nil, xmlLoadFile("pm_settings.xml") 
    if xml then 
        xmlNode = xmlFindChild( xml , "ignore" , 0 ) 
        ilist = xmlNodeGetValue(xmlNode) 
        serial = getElementData(getPlayerFromName(pname),"serial") 
        if serial and string.find(ilist," "..serial.." ",0,true) then 
            guiCheckBoxSetSelected( Button[#Button] , true ) 
        end 
    end 
     
    Label[pname] = {} 
    Label[pname][1] = guiCreateLabel(0,0,1,1,"Press F3 to get mouse control",true,Memo[pname])   
    guiLabelSetColor(Label[pname][1],255,0,0) 
    guiLabelSetVerticalAlign(Label[pname][1],"center") 
    guiLabelSetHorizontalAlign(Label[pname][1],"center") 
    guiSetVisible(Label[pname][1],false) 
    guiSetEnabled(Label[pname][1],false) 
    Label[pname][2] = guiCreateLabel(0.02,0,1,1,"Click here to type",true,Edit[pname]) 
    guiLabelSetColor(Label[pname][2],255,0,0) 
    guiLabelSetVerticalAlign(Label[pname][2],"center") 
    guiLabelSetHorizontalAlign(Label[pname][2],"left") 
    guiSetVisible(Label[pname][2],false) 
    guiSetEnabled(Label[pname][2],false) 
     
    if not quiet then showCursor(true) 
    else guiSetVisible(Label[pname][1],true);guiSetVisible(Label[pname][2],true);setTimer(loseAlpha,2000,1,Window[pname]) 
    end 
end 
  
addEvent("newNick",true) 
addEventHandler("newNick",g_Root, 
    function(old,new) 
        old = string.upper(old) 
        new = string.upper(new) 
        if not Window[old] or Window[new] then return end 
        Window[new] = Window[old] 
        Label[new] = Label[old] 
        Edit[new] = Edit[old] 
        Memo[new] = Memo[old] 
        guiSetText(Window[new],"PM Window - " .. tostring(new)) 
        Window[old] = nil 
        Label[old] = nil 
        Edit[old] = nil 
        Memo[old] = nil 
    end 
) 
  
function loseAlpha(elem) 
    setTimer(dissapear,50,5,elem) 
end 
function dissapear(elem) 
    guiSetAlpha(elem,guiGetAlpha(elem)-0.1) 
end 
  
addEventHandler( "onClientMouseEnter", g_Root,  
    function() 
        if getElementType(source) == "gui-window" and string.sub(guiGetText(source),0,9) == "PM Window" and guiGetAlpha(source) < 0.11 then guiSetAlpha(source,0.6) end 
    end 
) 
  
function pm_ignore( who , check ) 
    if guiCheckBoxGetSelected(check) then 
        local ilist,xml,xmlNode = nil 
        xml = xmlLoadFile("pm_settings.xml") 
        if not xml then xml = xmlCreateFile("pm_settings.xml", "settings") end 
        xmlNode = xmlFindChild(xml, "ignore" , 0) 
        local serial = getElementData(getPlayerFromName(who),"serial") 
        if not xmlNode then xmlNode = xmlCreateChild(xml, "ignore"); ilist = " "..serial.." " 
        else ilist = xmlNodeGetValue(xmlNode).." "..serial.." " 
        end 
        ilist = string.gsub(ilist,"  "," ") 
        xmlNodeSetValue(xmlNode, ilist )             
        xmlSaveFile(xml) 
    else 
        local ilist,xml,xmlNode = nil, xmlLoadFile("pm_settings.xml") 
        if xml then 
            xmlNode = xmlFindChild( xml , "ignore" , 0 ) 
            ilist = xmlNodeGetValue(xmlNode) 
            ilist = string.gsub(ilist," "..getElementData(getPlayerFromName(who),"serial").." "," ") 
            xmlNodeSetValue(xmlNode, ilist ) 
            xmlSaveFile(xml) 
        end 
    end 
end 
  
function sendText( active ) 
    if not active then outputChatBox("No active chat"); return end 
    if not isCursorShowing(g_Me) then return end 
    active = string.sub(guiGetText(getElementParent(active)),13) 
    local text = guiGetText ( Edit[active] ) 
    if not text or string.len(text) < 1 then return end 
    guiSetText( Edit[active] , "" ) 
    guiSetText( Memo[active] , (guiGetText(Memo[active]) ~= "\n" and guiGetText(Memo[active]) or "") .. getPlayerName(g_Me) .. ": " .. text ) 
    triggerServerEvent( "sendText" , g_ResRoot , g_Me , active , text ) 
    guiMemoSetCaretIndex(Memo[active],#guiGetText(Memo[active])) 
end 
function getText(from,text) 
    local name = from 
    from = string.upper(from) 
     
    local ilist,xml,xmlNode = nil, xmlLoadFile("pm_settings.xml") 
    if not getElementData(getPlayerFromName(from),"admin") and xml then 
        xmlNode = xmlFindChild( xml , "ignore" , 0 ) 
        ilist = xmlNodeGetValue(xmlNode) 
        local serial = getElementData(getPlayerFromName(from),"serial") 
        if serial and string.find(ilist," "..serial.." ",0,true) then return end 
    end 
     
    if not Window[from] or not guiGetVisible(Window[from]) then openPM(from,true) end 
    guiSetText(Memo[from], (guiGetText(Memo[from]) ~= "\n" and guiGetText(Memo[from]) or "") .. name .. ": " .. text)    
    guiMemoSetCaretIndex(Memo[from],#guiGetText(Memo[from])) 
end 
  
addEvent("openPM",true) 
addEventHandler( "openPM" , g_ResRoot , openPM) 
addEvent("getText",true) 
addEventHandler( "getText" , g_ResRoot , getText) 

I doubt you made this alone if you do not even know what is a debug script.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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