Jump to content

Problema Advertisements.


Recommended Posts

Salutare tuturor.

Am inceput sa lucrez la o resursa de advertisements, luata de pe comunitate.

Cam asa arata la download.

Spoiler

5xqC4BU.png

Iar asa arata acum, dupa cateva modificari.

Spoiler

0c7nZzP.png

De ce cer eu ajutor?

Pai, coloana de la telefon, sa o creez, am incercat sa o fac, o sa va las mai jos scriptul.

Cand scriu la telefon, ce scrie la telefon da pe coloana de "Reclama". Iar asta incerc sa fac de ceva timp, sa "despart" cele doua incat sa fie la fiecare in parte.

Advertisting_c.lua

Spoiler

GUIEditor = {
    gridlist = {},
    window = {},
    button = {},
    edit = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
        GUIEditor.window[1] = guiCreateWindow(477, 232, 513, 427, "Panou Reclame SF-RP", false)
        centerTheGUI( GUIEditor.window[1] )
        guiWindowSetSizable(GUIEditor.window[1], false)
    guiSetVisible ( GUIEditor.window[1], false )
        GUIEditor.gridlist[1] = guiCreateGridList(9, 27, 493, 251, false, GUIEditor.window[1])
        plrC = guiGridListAddColumn(GUIEditor.gridlist[1], "Jucator", 0.3)
        msgC = guiGridListAddColumn(GUIEditor.gridlist[1], "Reclama", 0.63)
		phone = guiGridListAddColumn(GUIEditor.gridlist[1], "Telefon", 0.2)
        GUIEditor.edit[1] = guiCreateEdit(9, 288, 420, 33, "Mesaj.", false, GUIEditor.window[1])
		GUIEditor.edit[1] = guiCreateEdit(9, 320, 420, 33, "Telefon.", false, GUIEditor.window[1])
        GUIEditor.button[1] = guiCreateButton(10, 364, 114, 41, "Trimite", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA")
        GUIEditor.button[2] = guiCreateButton(378, 364, 114, 41, "Inchide", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA")   
        guiEditSetMaxLength(GUIEditor.edit[1], 100) 
        bindKey ( getLocalPlayer(), "F7", "down", openAd )
    end
)
----
addEvent("onCountDownEnd")
 
function GuiSetTextCountDown ( guiElement , Text, count )
    if not guiElement or not Text or not tonumber(count) then
        outputDebugString("Bad arugment @ GuiSetTextCountDown ",0,255,0,0)
    return end
    guiSetText ( guiElement ,Text..' '..tonumber( count ) )
    setTimer(
        function ( )
            -- if not tonumber ( count ) then return false end
            if count <= 0 then
                triggerEvent("onCountDownEnd", localPlayer)
                return
            end
            count = count -1
            guiSetText ( guiElement ,Text..' '..tonumber( count ) )
            end , 1000, 0)
end
----
----------------------------------------------------------
local sx, sy = guiGetScreenSize()
function centerTheGUI( guiElement )
    local width, height = guiGetSize( guiElement, false )
    local x, y = sx / 2 - width / 2, sy / 2 - height / 2
    guiSetPosition( guiElement, x, y, false )
end
----------------------------------------------------------
addEventHandler ( "onClientGUIClick", root,
function()
  if source == GUIEditor.button[2] then
    guiSetVisible ( GUIEditor.window[1], false )
    showCursor (false)
  end 
end )
----------------------------------------------------------
function openAd()
  if ( guiGetVisible ( GUIEditor.window[1] ) == true ) then              
   guiSetVisible ( GUIEditor.window[1], false )
   showCursor (false)
  else              
   guiSetVisible ( GUIEditor.window[1], true )
   showCursor (true)
  end
end
bindKey ("F7", "down", openAd )
addCommandHandler( "ads", openAd )
----------------------------------------------------------

addEventHandler ("onClientGUIClick", root,
function ()
  if (source == GUIEditor.button[1]) then
if isTimer(theTimer) then
cancelEvent()
totalExecutes = getTimerDetails(theTimer)/1000
exports.UIPtexts:output ("You need to wait for "..totalExecutes.." seconds", 0, 255, 0)
GuiSetTextCountDown(GUIEditor.edit[1], "Expirare:", 60)
guiEditSetReadOnly( GUIEditor.edit[1], true )
guiSetEnabled ( GUIEditor.button[1], false )
else
     tx = guiGetText (GUIEditor.edit[1])
       if tx == "" then return end
        triggerServerEvent ("onSendMsg", localPlayer, guiGetText (GUIEditor.edit[1]))
		triggerServerEvent ("onSendPhone", localPlayer, guiGetPhone (GUIEditor.edit[1]))
theTimer = setTimer ( function() 
guiSetEnabled ( GUIEditor.button[1], true)
guiEditSetReadOnly( GUIEditor.edit[1], false ) 
guiSetText (GUIEditor.edit[1], "")
end, 123000, 1)
end
end
end)

function timeOver()
--guiSetEnabled ( GUIEditor.button[1], true)
--guiEditSetReadOnly( GUIEditor.edit[1], false )
--guiSetText (GUIEditor.edit[1], "")
end
addEventHandler ("onCountDownEnd", root, timeOver)

addEvent ("onAddMsg", true)
addEventHandler ("onAddMsg", root, function (whoSend, text)
Row = guiGridListAddRow (GUIEditor.gridlist[1])
guiGridListSetItemText(GUIEditor.gridlist[1], Row, msgC, text, false, false)
guiGridListSetItemText( GUIEditor.gridlist[1], Row, plrC, getPlayerName (whoSend), false, false )
guiGridListSetItemText(GUIEditor.gridlist[1], Row, phone, title, false, false)
setTimer ( deleteTheRow, 86400000, 0)
guiSetText (GUIEditor.edit[1], "")
end)

function deleteTheRow ()
guiGridListClear (GUIEditor.gridlist[1])
end
addEvent ("clearAds", true)
addEventHandler ("clearAds", root, deleteTheRow) 

 

Advertisting_s.lua

Spoiler

------------------------------------------------------------------------------------
--  PROJECT:     Community of Social and Transparency 1.0
--  RIGHTS:      All rights reserved by iAnnas
--  FILE:        CSTadvertising/Advertising_s.lua
--  PURPOSE:     Advertising Panel
--  DEVELOPERS:  iAnnas Ben Ahmed
------------------------------------------------------------------------------------

addEvent ("onSendMsg", true)
addEventHandler ("onSendMsg", root, function (text)
for k,v in ipairs (getElementsByType ("player")) do
triggerClientEvent (v, "onAddMsg", v, source, text)
end
end)

local Group = "Clear_Managers"
function cleargs (thePlayer)
   if not ( isObjectInACLGroup( "user." .. getAccountName( getPlayerAccount( thePlayer ) ), aclGetGroup( Group ) ) ) then return end
for k,v in ipairs (getElementsByType ("player")) do
triggerClientEvent (v, "clearAds", v, source, text)
   end
   end
addCommandHandler ( "clearads", cleargs )

 

Daca sunteti experimentati si ma puteti ajuta, lasati un raspuns cu solutia.

Multumesc anticipat!

Link to comment
  • 2 weeks later...
  • _sEEk_ locked this topic
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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