Jump to content

MAB

Members
  • Posts

    313
  • Joined

  • Last visited

Everything posted by MAB

  1. MAB

    Few questions.

    There are alot of examples at the wiki, check the link in below. Click_Here! If i understood it, what i am doing here? wasting time?
  2. MAB

    anti-spam

    I didn't understand your code but from this word i understood i thought that when you do "time = getTickCount" for example it starts counting from 0 not the server running time
  3. MAB

    anti-spam

    that mean "if the tick count we set to the player crossed 3000 or equal to it." so it should be if antiSpamChat[source] >= 3000 then
  4. MAB

    anti-spam

    I don't understand if not antiChatSpam[source] or antiChatSpam[source] + 3000 <= getTickCount() then antiChatSpam[source] = getTickCount()
  5. MAB

    Few questions.

    yea yea i need an example.. doesn't matter example??
  6. MAB

    !!!

    Working thanks...
  7. MAB

    anti-spam

    thanks for helping .. yes it is better to cancel event but there is no argument for reason
  8. MAB

    anti-spam

    what is the problem with that anti-spam? function unmute() if isElement(p) then setElementMuted(p,false) end end spams = {} -- anti chat spam function mute() local name = getPlayerName(source) for i,v in pairs(spams) do if v == name then setPlayerMuted(source,true) setTimer(unmute,3000,1,source) else table.insert(spams,name) end end end addEventHandler("onPlayerChat",root,mute) setTimer(function() spams={} end,3000,0)
  9. MAB

    !!!

    I am going to add more languages so this code will set them all in the same time which is not good If the player is in the last language then set his language as the first else set it the next.. hard?
  10. MAB

    Few questions.

    How to create a chat channel? How to set settings for my resources? Can i get an example of SQL codes that saves the name color or something? I know SQL but never used it with MTA.
  11. MAB

    !!!

    tell about the mistakes or don't annoy me
  12. MAB

    !!!

    the data "loginlanguage" change and "draw" function display the text of the next language and flag.. i didn't even show the full function of "draw" but the problem is that click functions doesn't work...
  13. MAB

    !!!

    nothing in debug.. i am sure that the code is right... and not working!!!!!!!!!! note that the localPlayer "loginpanel" data is set to true by another function...this isn't the full code.. it is the code that contains the problem.. when i click on the flag image nothing happens local sx,sy = guiGetScreenSize() local languages = { {name = "English",user = "Username:",pass = "Password:",login = "Login",register = "Register",flag = "images/uk.png"}, {name = "Arabic",user = "اسم المستخدم:",pass = "كلمة السر:",login = "دخول",register = "تسجيل",flag = "images/ksa.png"} } function isMouseInPosition ( x, y, width, height ) if ( not isCursorShowing ( ) ) then return false end local sx, sy = guiGetScreenSize ( ) local cx, cy = getCursorPosition ( ) local cx, cy = ( cx * sx ), ( cy * sy ) if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then return true else return false end end function draw() if getElementData(localPlayer,"loginpanel") == true then for i=1,#languages do if getElementData(localPlayer,"loginlanguage") == languages[i].name then dxDrawImage(sx - 70,10,58,34,languages[i].flag) end end end end addEventHandler("onClientRender",root,draw) function click(b,s) if getElementData(localPlayer,"loginpanel") == true then if b == "left" and s == "up" then if isMouseInPosition(sx - 70,10,58,34) then for i=1,#languages do if getElementData(localPlayer,"loginlanguage") == languages[#languages].name then setElementData(localPlayer,"loginlanguage",languages[1].name) else i = i + 1 setElementData(localPlayer,"loginlanguage",languages[i].name) end end end end end end addEventHandler("onClientClick",root,click)
  14. nah.. by thanks for the try Lindesy Stirling
  15. I am triggering an client event to add some strings to a table.. not working.. or let me by more clear.. ty is not found always... Always says "Name Joined the game." but never "Name left the game." that is because ty is not found so what to do? NOTICE: tested by increasing the time of the timer client: local sx,sy = guiGetScreenSize() local joins = {} function delete2(n,t) for i=1,#joins do if joins[i].name == n and joins[i].ty == t then table.remove(joins,i) end end end function addOnQuit(n,t) table.insert(joins,{name = n, ty = t}) setTimer(delete2,3000,1,n,t) end addEvent("addone2",true) addEventHandler("addone2",root,addOnQuit) function draw() for i=1,#joins do if joins[i].ty then local ty = joins[i].ty dxDrawImage(10,(sy/2)+(i*10),16,16,"images/quit.png") dxDrawText(joins[i].n.." left the game. ["..ty.."]",30,(sy/2)+(i*10)+3,nil,nil,tocolor(255,255,255,255),1,"default-bold") else local name = joins[i].name dxDrawImage(10,(sy/2)+(i*10),16,16,"images/join.png") dxDrawText(name.." joined the game.",30,(sy/2)+(i*10)+3,nil,nil,tocolor(255,255,255,255),1,"default-bold") end end end addEventHandler("onClientRender",root,draw) server: function trigger2(t) local name = getPlayerName(source) triggerClientEvent("addone2",root,name,t) end addEventHandler("onPlayerQuit",root,trigger2)
  16. MAB

    Save

    Answered by default..
  17. MAB

    Save

    Hi, I am working on a login panel and my question is How to save the username and the password and automaticlly set them in the edit boxes?
  18. Very nice... what about positions? X , Y ... ??
  19. Can someone make a simple dxDrawRoundedRectangle() function (Draws a rounded rectangle)
  20. MAB

    playSound

    OH MY GOD The link plays the music.. must it be downloadable so it works?
×
×
  • Create New...