Jump to content

Karuzo

Members
  • Posts

    1,213
  • Joined

  • Last visited

Everything posted by Karuzo

  1. hey guys, so i wanted to look how this pm chat system is lookin', ok, but if i turn it off , it still stays there just with an alpha of 0 . So, how could i set the visiblity completely off ? Script : --- DONT TRY TO COPY LITTLE BITCH g_LocalPlayer = getLocalPlayer() g_Root = getRootElement() g_ThisResource = getThisResource() g_ResourceRoot = getResourceRootElement(getThisResource()) chat = {} -- table to store chat windows in newmsg = {show=false, tick=getTickCount(), showtime=4500, img=nil, lbl=nil } -- new msg table anims = {} function buildPlayerList() local x,y = guiGetScreenSize() local width,height = 175,350 x = x-width y = (y-height)/2 newmsg.img = guiCreateStaticImage(681.0000,134.0000, 42.0000,34.0000, "image/chat-icon.png", false) -- mail message icon newmsg.lbl = guiCreateLabel(553.0000,175.0000, 244.0000, 19.0000, "", false) guiLabelSetColor(newmsg.lbl,0, 170, 255) guiLabelSetHorizontalAlign(newmsg.lbl, "right", true) guiSetAlpha(newmsg.img, 0) --guiSetAlpha(newmsg.lbl, 0) wndPlayers = guiCreateWindow(-1,256,222,343, "~ Özel Chat ~", false) fond = guiCreateStaticImage(0.0405,0.0525,0.9189,0.9213,"image/mtalogo.png",true,wndPlayers) grdPlayers = guiCreateGridList(0.12,0.1349,0.7450,0.7868, true, wndPlayers) colPlayers = guiGridListAddColumn(grdPlayers, "Oyuncu", 0.85) local players = getElementsByType("player") for k,v in ipairs(players) do addPlayerToList(v) end guiSetProperty(fond,"Disabled","true") guiWindowSetSizable(wndPlayers, false) guiSetProperty(wndPlayers, "RollUpEnabled", "true") guiSetProperty(wndPlayers, "Dragable", "true") guiSetAlpha(wndPlayers, 0) -- create animations for it anims.plfadein = Animation.create(wndPlayers, Animation.presets.guiFadeIn(1000)) anims.plfadeout = Animation.create(wndPlayers, Animation.presets.guiFadeOut(1000)) anims.nmfadein = Animation.create(newmsg.img, Animation.presets.guiFadeIn(1000)) anims.nmfadeout = Animation.create(newmsg.img, Animation.presets.guiFadeOut(1000)) anims.nmtextin = Animation.create(newmsg.lbl, Animation.presets.guiFadeIn(1000)) anims.nmtextout = Animation.create(newmsg.lbl, Animation.presets.guiFadeOut(1000)) --[[ local x,y = guiGetPosition(newmsg.img) outputDebugString("guigetPostions: " ..tostring(x).." "..tostring(y)) local scrx,scry = guiGetScreenSize() anims.nmslidein = Animation.create(newmsg.img, Animation.presets.guiMove(x,y))--, 1000,false, scrx,scry, false)) anims.nmslideout = Animation.create(newmsg.img, Animation.presets.guiMove(scrx,scry))--, 1000,false, x,y, false)) ]] bindKey("F4", "down", togglePmGui) end function addPlayerToList(ply) --outputDebugString("addPlayerToList:" ..string.gsub ( getPlayerName (ply), '#%x%x%x%x%x%x','' )) local row = guiGridListAddRow(grdPlayers) local name = string.gsub ( getPlayerName (ply), '#%x%x%x%x%x%x','' ) guiGridListSetItemText(grdPlayers,row,colPlayers, name, false, false) end function removePlayerFromList(ply) --outputDebugString("removePlayerFromList:" ..string.gsub ( getPlayerName (ply), '#%x%x%x%x%x%x','' )) local name=string.gsub ( getPlayerName (ply), '#%x%x%x%x%x%x','' ) for row=0,guiGridListGetRowCount(grdPlayers) do if guiGridListGetItemText(grdPlayers, row, colPlayers) == name then guiGridListRemoveRow(grdPlayers, row) outputDebugString("remove row" ..tostring(row)) end end end function showPmGui(state) if state == true then anims.plfadein:play() for k,v in pairs(chat) do guiSetVisible(chat[k].wnd,true) end showCursor(true) elseif state == false then anims.plfadeout:play() for k,v in pairs(chat) do guiSetVisible(chat[k].wnd,false) end showCursor(false) guiSetInputEnabled(false) end end function togglePmGui() if not anims.plfadein:isPlaying() and not anims.plfadeout:isPlaying() then if guiGetAlpha(wndPlayers) > .1 then showPmGui(false) else showPmGui(true) end end end function buildChatWindow(ply) local x,y = guiGetScreenSize() local width,height = 300,250 x = x*.5 y = y*.5 chat[ply] = {} chat[ply].wnd = guiCreateWindow(337,277,395,252, string.gsub ( getPlayerName (ply), '#%x%x%x%x%x%x','' ), false) chat[ply].img = guiCreateStaticImage(0.0228,0.0754,0.9544,0.8889,"image/shruk.png",true,chat[ply].wnd) chat[ply].memo = guiCreateMemo(0.043,0.1746,0.9089,0.623, "", true, chat[ply].wnd) chat[ply].edit = guiCreateEdit(0.043,0.8214,0.7089,0.1111, "", true, chat[ply].wnd) chat[ply].btnX = guiCreateButton(0.9215,0.0754,0.0557,0.0794, "X", true, chat[ply].wnd) chat[ply].btnSend = guiCreateButton(0.757,0.8135,0.2127,0.1429, "Gönder", true, chat[ply].wnd) guiSetProperty(chat[ply].img,"Disabled","true") guiMemoSetReadOnly(chat[ply].memo, true) guiWindowSetSizable(chat[ply].wnd, false) guiSetProperty(chat[ply].wnd, "RollUpEnabled", "true") guiSetProperty(chat[ply].wnd, "Dragable", "true") if anims.plfadein:isPlaying() then-- in process of fading in guiSetVisible(chat[ply].wnd, true) elseif anims.plfadeout:isPlaying() then -- in process of fading out guiSetVisible(chat[ply].wnd, false) else -- not in process of either if guiGetAlpha(wndPlayers) > .1 then guiSetVisible(chat[ply].wnd, true) -- is showing else guiSetVisible(chat[ply].wnd, false) -- isnt showing end end end function destroyChatWindow(ply) if chat[ply] and isElement(chat[ply].wnd) then destroyElement(chat[ply].wnd) chat[ply] = nil end end function sendChatMessage(ply) --outputDebugString("sendChatMessage: " .. tostring(ply)) if chat[ply] and isElement(chat[ply].wnd) then local newText = guiGetText(chat[ply].edit) if newText and string.len(newText) > 0 then local oldText = guiGetText(chat[ply].memo) if not oldText then oldText = "" end oldText = oldText .. getPlayerName(g_LocalPlayer) .. ": " .. newText .. "\n" guiSetText(chat[ply].memo, oldText) guiSetText(chat[ply].edit, "") guiMemoSetCaretIndex(chat[ply].memo, string.len(oldText)) triggerServerEvent("onGUIPrivateMessage", g_LocalPlayer, ply,newText) end end end function recieveChatMessage(ply, msg) --outputDebugString("recieveChatMessage: " .. msg) if not chat[ply] then buildChatWindow(ply) end newmsg.show = true newmsg.tick = getTickCount() ---guiSetText(newmsg.lbl, string.gsub ( getPlayerName (ply), '#%x%x%x%x%x%x','' ) .. ": " .. msg .. "\n") guiSetText(newmsg.lbl, "" .. string.gsub ( getPlayerName (ply), '#%x%x%x%x%x%x','' ) .. "\n dan Mesaj") local sound = playSound("GatkResalh~.mp3",false) setSoundVolume(sound, 0.2) anims.nmfadein:play() anims.nmtextin:play() --anims.nmslidein:play() local oldText = guiGetText(chat[ply].memo) if not oldText then oldText = "" end oldText = oldText .. string.gsub ( getPlayerName (ply), '#%x%x%x%x%x%x','' ) .. ": " .. msg .. "\n" guiSetText(chat[ply].memo, oldText) guiMemoSetCaretIndex(chat[ply].memo, string.len(oldText)) end event_resource_start = function(res) buildPlayerList() end event_resource_stop = function(res) unbindKey("F4", "down", togglePmGui) showPmGui(false) end event_player_join = function() --outputDebugString("onClientPlayerJoin") addPlayerToList(source) end event_player_quit = function() --outputDebugString("onClientPlayerQuit") removePlayerFromList(source) destroyChatWindow(source) end event_gui_click = function(button, state, absx, absy) if button == "left" and state == "up" then if getElementType(source) == "gui-button" then local parent = getElementParent(source) if parent ~= false then local ply = getPlayerFromName(guiGetText(parent)) if ply then if source == chat[ply].btnX then destroyChatWindow(ply) guiSetInputEnabled(false) elseif source == chat[ply].btnSend then sendChatMessage(ply) guiSetInputEnabled(false) end end end elseif getElementType(source) == "gui-edit" then local parent = getElementParent(source) if parent ~= false then local ply = getPlayerFromName(guiGetText(parent)) if source == chat[ply].edit then guiSetInputEnabled(true) end end else guiSetInputEnabled(false) end end end event_gui_doubleclick = function(button, state, absx, absy) if button == "left" and state == "up" then if source == grdPlayers then local row, col = guiGridListGetSelectedItem(grdPlayers) --outputDebugString("double clicked row: "..tostring(row)) if row == -1 or col == -1 then return end local name = guiGridListGetItemText(grdPlayers, row, col) local ply = getPlayerFromName(name) if not chat[ply] then buildChatWindow(ply) end guiBringToFront(chat[ply].wnd) end end end event_gui_accepted =
  2. Thank you DNL291, now it works Btw another question, i've added a Scrollbar but i don't know if this was necessary. I mean , does this scrollbar appear if i need to go down ? or was it correct that i added it ?
  3. https://community.multitheftauto.com/ind ... ils&id=727 https://community.multitheftauto.com/ind ... ls&id=5525
  4. Hey Guys, as the title says i have a problem with guiGridListGetItemText. It says bad argument at line 39 with guiGridListGetItemText expected number . Code: Para.window[1] = guiCreateWindow(left, top, windowWidth, windowHeight, "Para Gönderme Paneli", false) guiWindowSetSizable(Para.window[1], false) guiWindowSetMovable(Para.window[1], false) guiSetVisible(Para.window[1],false) guiSetAlpha(Para.window[1], 1.00) Para.gridlist[1] = guiCreateGridList(13, 36, 158, 220, false, Para.window[1]) playcol = guiGridListAddColumn(Para.gridlist[1], "Oyuncu", 0.9) guiGridListAddRow(Para.gridlist[1]) for id, playeritem in ipairs(getElementsByType("player")) do local row = guiGridListAddRow ( Para.gridlist[1] ) guiGridListSetItemText ( Para.gridlist[1], row, playcol, string.gsub ( getPlayerName (playeritem), '#%x%x%x%x%x%x','' ), false, false ) end Para.scrollbar[1] = guiCreateScrollBar(137, 0, 21, 220, false, false, Para.gridlist[1]) guiScrollBarSetScrollPosition(Para.scrollbar[1], 100.0) Para.label[1] = guiCreateLabel(185, 60, 45, 18, "Paran:", false, Para.window[1]) guiSetFont(Para.label[1], "default-bold-small") Para.label[2] = guiCreateLabel(240, 60, 133, 18, "", false, Para.window[1]) guiSetFont(Para.label[2], "default-bold-small") Para.label[3] = guiCreateLabel(185, 97, 45, 18, "Miktar:", false, Para.window[1]) guiSetFont(Para.label[3], "default-bold-small") Para.edit[1] = guiCreateEdit(240, 100, 133, 25, "", false, Para.window[1]) Para.button[1] = guiCreateButton(367, 229, 81, 27, "Kapat", false, Para.window[1]) guiSetFont(Para.button[1], "default-bold-small") guiSetProperty(Para.button[1], "NormalTextColour", "FFAAAAAA") Para.button[2] = guiCreateButton(205, 229, 138, 27, "Gönder", false, Para.window[1]) guiSetFont(Para.button[2], "default-bold-small") guiSetProperty(Para.button[2], "NormalTextColour", "FFAAAAAA") addEventHandler("onClientGUIClick", Para.button[2], function() if source == guiGridListGetItemText(Para.gridlist[1],guiGridListGetSelectedItem(Para.gridlist[1])) ~= "Oyuncu sec" then local getComboPlayer = guiGridListGetItemText(Para.gridlist[1]),guiGridListGetSelectedItem(Para.gridlist[1]) local getMoneyToSend = guiGetText(Para.edit[1]) if getComboPlayer and getMoneyToSend then triggerServerEvent("onPlayerReceiveMoney",localPlayer,getComboPlayer,getMoneyToSend) end end end ) hope you can help me .
  5. Wiki example of destroyElement: function allvehiclesaredoomed() -- get a table of all the vehicles that exist and loop through it vehicles = getElementsByType("vehicle") for i,v in ipairs(vehicles) do -- destroy every vehicle. destroyElement(v) end end --The command handler below will destroy all vehicles once --you enter /vdoom in the chat box or vdoom in the game console. addCommandHandler("vdoom", allvehiclesaredoomed) --This is very useful if you use the freeroam resource and some --heartless players start spawn spamming. --You can also set it on a timer to have your server clear all --vehicles ever 60 minutes, (1 hour). Timer below: setTimer(allvehiclesaredoomed, 3600000, 0)
  6. Well, this script is based on mysql.. So you have to get a mysql database from a free webhoster, or you're gonna use a housesystem which doesnt use mysql.
  7. Do you even have a MySQL Database ?
  8. Then tell us those errors pls.
  9. Karuzo

    car spawn

    What do you mean by 'give me element'? You can spawn cars by using createVehicle You can make a Panel by using guiCreateWindow-- and so on.. Rent a car and set new owner , to do this you have to save your owner's somewhere. Like XML, MySQL and so on. I think you should look for the community ressource just cause this is pretty difficult to do.
  10. didn't looked at your code. You've forgot the enter your MySQL datas.
  11. Hmm, i did the panel but it doesn't really work.. http://paste.ofcode.org/briFfTNSpwndebvqQjnug6
  12. Where is the marker at line 20 ? i mean addEventHandler("onClientMarkerHit", getRootElement(), giga) Where do you define that the player has to hit the markerB. i'm sorry if im wrong.
  13. Oh, didn't read the wiki. Thanks for that.
  14. What doesnt work ? Any errors in debugscript 3 ?
  15. Wassim , one question, why should i use the Server-Sided functions server-side? They're all client-side too ?
  16. Take the first one. There's also a readme how you start it.
  17. To which folder ? You clicked on 'Download single archive with all necessary files packed'?
  18. http://crystalmv.net84.net/pages/script ... raffic.php Script by CrystalMV.
  19. Thank you WASSIm., But , how should i get the Player which he selected to send the money to ?
  20. Hey Guys, so i wanted to make a Money-Send Panel which Player can use to send money to their friends. but i just don't figure it out how i could do that, or which func's i need. hope you could help me. -regards, KRZO.
  21. Just remove these lines from your mtaserver.conf : "helpmanager" startup="1" protected="0"/> "votemanager" startup="1" protected="0"/>
×
×
  • Create New...