Jump to content

kikos500

Members
  • Posts

    125
  • Joined

  • Last visited

Everything posted by kikos500

  1. my Problem is that the nitro color is the same for everyone. for example: my nitro color is yellow and another player's is blue but i see his nitro color as yellow and he sees mine as blue -- server function setNitroColor(r, g, b, player) triggerClientEvent(root , "Nitrochange", root, r, g, b, player) end -- client shader = dxCreateShader(":CCS/models/nitro.fx") function nitroColor(r, g, b, v) if v == localPlayer then dxSetShaderValue (shader, "gNitroColor", r/255, g/255, b/255 ) engineApplyShaderToWorldTexture (shader,"smoke", getPedOccupiedVehicle(v)) end end addEvent( "Nitrochange", true) addEventHandler("Nitrochange", root, nitroColor) -- shader // // nitro.fx // // Author: NeXTreme //--------------------------------------------------------------------- // Nitro settings //--------------------------------------------------------------------- float4 gNitroColor = float4(255,255,255,150); //--------------------------------------------------------------------- // These parameters are set by MTA whenever a shader is drawn //--------------------------------------------------------------------- float4x4 gWorld : WORLD; float4x4 gView : VIEW; float4x4 gProjection : PROJECTION; //------------------------------------------------------------------------------------------ // textureState - String value should be a texture number followed by 'Texture' //------------------------------------------------------------------------------------------ texture gTexture0 < string textureState="0,Texture"; >; //--------------------------------------------------------------------- // Sampler for the main texture //--------------------------------------------------------------------- sampler texsampler = sampler_state { Texture = (gTexture0); }; //--------------------------------------------------------------------- // Structure of data sent to the vertex and pixel shaders //--------------------------------------------------------------------- struct VertexShaderInput { float3 Position : POSITION0; float4 Diffuse : COLOR0; float2 TexCoords : TEXCOORD0; }; struct PixelShaderInput { float4 Position : POSITION; float4 Diffuse : COLOR0; float2 TexCoords : TEXCOORD0; }; //------------------------------------------------------------------------------------------ // VertexShaderFunction //------------------------------------------------------------------------------------------ PixelShaderInput VertexShaderFunction(VertexShaderInput In) { PixelShaderInput Out = (PixelShaderInput)0; float4 posWorld = mul(float4(In.Position,1), gWorld); float4 posWorldView = mul(posWorld, gView); Out.Position = mul(posWorldView, gProjection); Out.TexCoords = In.TexCoords; Out.Diffuse = saturate(gNitroColor); return Out; } //------------------------------------------------------------------------------------------ // PixelShaderFunction //------------------------------------------------------------------------------------------ float4 PixelShaderFunction(PixelShaderInput In) : COLOR0 { float4 texel = tex2D(texsampler, In.TexCoords); float4 finalColor = texel * In.Diffuse; finalColor *= 0.23; return finalColor; } //----------------------------------------------------------------------------- // Techniques //----------------------------------------------------------------------------- technique nitro { pass P0 { VertexShader = compile vs_2_0 VertexShaderFunction(); PixelShader = compile ps_2_0 PixelShaderFunction(); } } technique fallback { pass P0 { } }
  2. how to make nitro color visible to everyone. i mean i want each player color to be visible to the other --------------------------------------------------------------------------------- -- -- Nitro shader -- -- --------------------------------------------------------------------------------- addEventHandler("onClientResourceStart",resourceRoot, function() nitroShader = dxCreateShader("nitro.fx") end) -- This function will set the new color of the nitro function updateNitroColor(r,g,b) if nitroShader then if r and g and b then engineApplyShaderToWorldTexture (nitroShader,"smoke") dxSetShaderValue (nitroShader, "gNitroColor", r/255, g/255, b/255 ) end end end -- This function will reset the nitro back to the original function resetNitroColor() if nitroShader then engineRemoveShaderFromWorldTexture(nitroShader,"smoke") end end -- Example command use addCommandHandler("nitro", function(command,r,g,b) if r and g and b then local r,g,b = tonumber(r),tonumber(g),tonumber(b) if r <= 255 and g <= 255 and b <= 255 then updateNitroColor(r,g,b) outputChatBox("Nitro color updated!",255,255,255,true) else outputChatBox("Colors must be between 0 and 255",255,255,255,true) end else resetNitroColor() outputChatBox("Nitro color reset to original!",255,255,255,true) end end) this is not my script btw
  3. well i fixed that a couple of months ago i just didn't release it anyway i made the list 90% just the scrolling i don't have much time to do it so im releasing what i did in it https://community.multitheftauto.com/index.php?p=resources&s=details&id=13635 @[NIG]MKH, @Abu-Solo. @iPrestege, @MR.GRAND
  4. ------------ server function sendDataToClient() triggerClientEvent(getRootElement(), "rotators.data", getRootElement(), rotators) end addEvent("rotators.send", true) addEventHandler("roatators.send", getRootElement(), sendDataToClient) ------ client rotators = {} function recieveDataFromServer(data) for i,v in pairs(data) do rotators[i] = v end end -- in the function u r drawing the text add this to it triggerServerEvent("rotators.send", getLocalPlayer()) well not tested
  5. well i tried this but the rows goes out from the gridlist and hovering plus selecting doesn't work when i scroll down function createList(x,y,w,h,parent) local id = #elements_Table.list + 1 elements_Table.list[id] = {} if not x or not y or not w or not h then outputDebugString("Error: Missing some arguments (x,y,w,h)") end elements_Table.list[id].x = x elements_Table.list[id].y = y elements_Table.list[id].w = w elements_Table.list[id].h = h elements_Table.list[id].parent = parent or nil elements_Table.list[id].visible = false elements_Table.list[id].items = {} elements_Table.list[id].selected = 0 elements_Table.list[id].scroll = 0 if parent then table.insert(parent.children,elements_Table.list[id]) elements_Table.list[id].x = elements_Table.list[id].x + parent.px elements_Table.list[id].y = elements_Table.list[id].y + parent.py end return elements_Table.list[id] end function addItem(grid,text) if grid then table.insert(grid.items,{text = text, alpha = 0}) return #grid.items end return false end function onHover() for i,list in pairs(elements_Table.list) do for num,rows in pairs(list.items) do if isCursorHover(list.x,list.y+(num*20)-17,list.w,20) then rows.alpha = 150 else rows.alpha = 0 end end end end addEventHandler( "onClientRender", root, onHover) function onClick() for i,list in pairs(elements_Table.list) do for num,rows in pairs(list.items) do if isCursorHover(list.x,list.y+(num*20)-17,list.w,20) then list.selected = num end end end end addEventHandler( "onClientClick", root, onClick ) function scrollDown() for i,v in pairs(elements_Table.list) do if isCursorHover(v.x,v.y,v.w,v.h) then if v.scroll < (v.h/20) then v.scroll = v.scroll+1 end end end end bindKey("mouse_wheel_down", "down", scrollDown) function scrollUp() for i,v in pairs(elements_Table.list) do if isCursorHover(v.x,v.y,v.w,v.h) then if v.scroll > 0 then v.scroll = v.scroll-1 end end end end bindKey("mouse_wheel_up", "down", scrollUp) function renderList() for i,v in pairs(elements_Table.list) do if v.visible then dxDrawRectangle(v.x,v.y,v.w,v.h + 10,tocolor(0,0,0,150)) local num = v.h/20 for i = v.scroll, num+v.scroll do local posrow = i - v.scroll if v.items[i] then if v.selected ~= i then dxDrawRectangle( v.x, v.y+(posrow*20)-17, v.w, 20,tocolor(0,0,0,v.items[i].alpha)) else dxDrawRectangle( v.x, v.y+(posrow*20)-17, v.w, 20,tocolor(0,0,0,255)) end dxDrawText(v.items[i].text,v.x + 1,v.y+(posrow*20)-17,v.w+v.x,v.y+20,tocolor(255,255,255,255),1,"default-bold","left","top") end end end end end addEventHandler( "onClientRender", root, renderList)
  6. MarkTraf = createMarker (2430.783203125, -988.7255859375, 70.225921630859,"cylinder",2.0 , 255, 255, 0, 255) function Traf (source) for i,v in pairs(getElementsByType("player")) do if isElementWithinMarker( v, MarkTraf) then givePlayerMoney(v,500) end end end setTimer(traf,2000,0) not tested tho
  7. mate i want to create a scroll bar i am planning to use render targets after i finish the scrolling :C
  8. well i am trying to create a dx list but im stuck on creating a scroll bar well i tried in a few different ways but none worked. please give me some examples of how to make a scroll function createList(x,y,w,h,parent) local id = #elements_Table.list + 1 elements_Table.list[id] = {} if not x or not y or not w or not h then outputDebugString("Error: Missing some arguments (x,y,w,h)") end elements_Table.list[id].x = x elements_Table.list[id].y = y elements_Table.list[id].w = w elements_Table.list[id].h = h elements_Table.list[id].parent = parent or nil elements_Table.list[id].visible = false elements_Table.list[id].items = {} elements_Table.list[id].selected = 0 elements_Table.list[id].scroll = 0 if parent then table.insert(parent.children,elements_Table.list[id]) elements_Table.list[id].x = elements_Table.list[id].x + parent.px elements_Table.list[id].y = elements_Table.list[id].y + parent.py end return elements_Table.list[id] end function addItem(grid,text) if grid then table.insert(grid.items,{text = text, alpha = 0}) return #grid.items end return false end function onHover() for i,list in pairs(elements_Table.list) do for num,rows in pairs(list.items) do if isCursorHover(list.x,list.y+(num*20)-17,list.w,20) then rows.alpha = 150 else rows.alpha = 0 end end end end addEventHandler( "onClientRender", root, onHover) function onClick() for i,list in pairs(elements_Table.list) do for num,rows in pairs(list.items) do if isCursorHover(list.x,list.y+(num*20)-17,list.w,20) then list.selected = num end end end end addEventHandler( "onClientClick", root, onClick ) function renderList() for i,v in pairs(elements_Table.list) do if v.visible then dxDrawRectangle(v.x,v.y,v.w,v.h + 10,tocolor(0,0,0,150)) for num,row in pairs(v.items) do if (num*20)-v.scroll < v.h then v.showingr = num if v.selected ~= num then dxDrawRectangle( v.x, v.y+(num*20)-17, v.w, 20,tocolor(0,0,0,row.alpha)) else dxDrawRectangle( v.x, v.y+(num*20)-17, v.w, 20,tocolor(0,0,0,255)) end dxDrawText(row.text,v.x + 1,v.y+(num*20)-17,v.w+v.x,v.y+20,tocolor(255,255,255,255),1,"default-bold","left","top") end end end end end addEventHandler( "onClientRender", root, renderList)
  9. https://wiki.multitheftauto.com/wiki/GuiCreateEdit wiki #2 example read it
  10. No it returns a table with all the edit data (x,y,w,h,text,parent,color,etc) why should i add such a function while u can use edit.text its the same it will just be a pointless function but if you want it here you go function editGetText(edit) if not edit.text then return nil end return edit.text end function editSetText(edit, text) if not edit.text then return nil end edit.text = text end
  11. http://imgur.com/a/KAtGU -- screens file used in screens local screenW, screenH = guiGetScreenSize() win = createWindow(1,(screenW - 444) / 2, (screenH - 337) / 2, 444, 337,{0,0,0,150},"test") tab1 = createTab(1,9, 58, 109, 35,"Tab 1",true,win,false) tab2 = createTab(2,9, 93, 109, 35,"Tab 2",false,win,false) button1 = createButton(1,183, 110, 111, 33,"pos",tab1,{0,0,255,150},{0,0,255,255}) check = createCheckBox(1,173, 60,"CheckTab2",false,tab2) function checkfunction() if check.active then outputChatBox("Checkbox: Active") else outputChatBox("Checkbox: Not active") end end check.func = checkfunction function button() local x,y,z = getElementPosition(localPlayer) outputChatBox(getPlayerName(localPlayer)..": X = "..x.." Y = "..y.." Z = "..z.."") end button1.func = button function curs() if not win.visible then win.visible = true showCursor(true) else win.visible = false showCursor(false) end end bindKey("f","down",curs) ---------------------- well just use edit.text like local edit = createEdit(id, x, y, w, h, text, parent) outputChatBox(edit.text) --------------- Download the new version some bugs are fixed https://community.multitheftauto.com/in ... s&id=13635
  12. better get your own ideas i know that you scripted this yourself but still FFS was the one who came up with the design and the idea why do u have to copy it and release it on community after a few days? and let everyone get a hold of the script?
  13. kikos500

    [REL] dxLib

    Well im presenting a new dx library today it includes the following: Windows createWindow( id, x, y, w, h, color, text) Tabs createTab(id,x,y,w,h,text,active,parent,bord) bord = if u want the tab to be boredered Edits createEdit(id, x, y, w, h, text, parent) Checks createCheckBox(id,x,y,text,active,parent) Buttons createButton(id,x,y,w,h,text,parent,color,colorh) and there is some more things u can edit by using the class ex button = createButton(...) button.color = {0,0,0,255} thats all for now on TODO LIST: Gridlists (99.999999999%) download link? https://community.multitheftauto.com/in ... s&id=13635
  14. it says some points but still the dx window doesn't move at all function testMoving(cx,cy) for _,moving in pairs(elements_Table.windows) do if isCursorHover(moving.x,moving.y,moving.w,20) then outputChatBox("RIGHT PART") if getKeyState("mouse1") then -- if moving.movable then moving.x = moving.px - cx moving.y = moving.py - cy outputChatBox(""..moving.x.." "..moving.y) -- end end end end end addEventHandler("onClientCursorMove",root,testMoving)
  15. Yes both outputs but it doesn't move at all
  16. so i want to make a movable dx window like gui one so i have tried this but it doesn't work function moving(cx,cy) for _,moving in pairs(elements_Table.windows) do if isCursorHover(moving.x,moving.y,moving.w,20) then outputChatBox("RIGHT PART") if getKeyState("mouse1") then -- if moving.movable then moving.x = moving.px - cx moving.y = moving.py - cy outputChatBox("moving") -- end end end end end addEventHandler("onClientCursorMove",root,moving) moving.px -- the default x for the window moving.py -- the default y for the window moving.x -- the window x moving.y -- the window y
  17. i think it should be like this im not very sure tho local players_Spawn = {} function spawn(source) table.insert(players_Spawn,source) spawnThePlayer() end addCommandHandler("spawnme",spawn) function spawnThePlayer() for _,p in pairs(players_Spawn) do spawnPlayer(...) end end NOT TESTED
  18. i already solved it but thanks i have question is it better to use accountData or element datas?
  19. 2nd : i think u should use getKeyState or -- event onClientCharacter or --event onClientKey
  20. 2nd : i think u should use [lua]getKeyState or -- event onClientCharacter or --event onClientKey
  21. well this is a script that creates a table to store inside it players stats like cash wins , points ,etc but the problem is when i reconnect the script bugs out and im back at 1 like if i played 10 maps when i reconnect im back at 1 i want it to save function start() executeSQLQuery("CREATE TABLE IF NOT EXISTS stats_p (name STRING,serial STRING,played INT,wins INT,points INT,cash INT,kills INT,color STRING,wheel INT,wheelc STRING)") end addEventHandler("onResourceStart", root, start) function join() local name = getPlayerName(source) local serial = getPlayerSerial(source) local tables = executeSQLQuery("SELECT name,played,wins,points,cash,kills FROM stats_p WHERE serial=?",serial) if #tables == 0 then executeSQLQuery("INSERT INTO stats_p (name,serial,played,wins,points,cash,kills,color,wheel,wheelc) VALUES(?,?,?,?,?,?,?,?,?,?)",name,serial,1,1,1,1000,1,"#FFFFFF",1,"#FFFFFF") setElementData(source,"played",1,true) setElementData(source,"wins",1,true) setElementData(source,"points",1,true) setElementData(source,"cash",1000,true) setElementData(source,"kills",1,true) setElementData(source,"color","#FFFFFF",true) setElementData(source,"wheel",1,true) setElementData(source,"wheelc","#FFFFFF",true) else setElementData(source,"played", tables[1].played,true) setElementData(source,"wins", tables[1].wins,true) setElementData(source,"points", tables[1].points,true) setElementData(source,"cash", tables[1].cash,true) setElementData(source,"kills", tables[1].kills,true) setElementData(source,"color",tables[1].color,true) setElementData(source,"wheel",tables[1].wheel,true) setElementData(source,"wheelc",tables[1].wheelc,true) end end addEventHandler("onPlayerJoin", getRootElement(), join) function left() local played = getElementData(source,"played") local wins = getElementData(source,"wins") local points = getElementData(source,"points") local cash = getElementData(source,"cash") local kills = getElementData(source,"kills") local color = getElementData(source,"color") local wheel = getElementData(source,"wheel") local wheelc = getElementData(source,"wheelc") local name = getPlayerName(source) local serial = getPlayerSerial(source) executeSQLQuery("UPDATE stats_p SET name=?,played=?,wins=?,points=?,cash=?,kills=?,color=?,wheel=?,wheelc=? WHERE serial",name,played,wins,points,cash,kills,color,wheel,wheelc,serial) end addEventHandler("onPlayerQuit",getRootElement(),left) function stopped() for i, player in ipairs(getElementsByType("player")) do local played = getElementData(player,"played") local wins = getElementData(player,"wins") local points = getElementData(player,"points") local cash = getElementData(player,"cash") local kills = getElementData(player,"kills") local color = getElementData(player,"color") local wheel = getElementData(player,"wheel") local wheelc = getElementData(player,"wheelc") local name = getPlayerName(player) local serial = getPlayerSerial(player) executeSQLQuery("UPDATE stats_p SET name=?,played=?,wins=?,points=?,cash=?,kills=?,color=?,wheel=?,wheelc=? WHERE serial",name,played,wins,points,cash,kills,color,wheel,wheelc,serial) end end addEventHandler ( "onResourceStop", getRootElement(), stopped) function findPlayer(namepart) for i, player in ipairs(getElementsByType("player")) do local name = getPlayerName(player) if string.find(name:lower(), namepart:lower(), 1, true) then return player, name end end return false end function dms() local players = getElementsByType("player") for k,v in ipairs(players) do if #players >=2 then setElementData (v,"played",getElementData(v,"played") + 1,true) else outputChatBox("Min 2 players to count stats",getRootElement(),0,191,0) end end end addEventHandler("onMapStarting",getRootElement(),dms) function win(hh) local playername = getPlayerName(source) setElementData(source,"cash",getElementData(source,"cash")+1000,true) setElementData(source,"points",getElementData(source,"points")+10,true) outputChatBox(playername.." won this round.",getRootElement(),0,191,0) setElementData ( source ,"wins",getElementData(source, "wins") + 1,true) end addEvent("onPlayerWinDD", true) addEventHandler("onPlayerWinDD",getRootElement(),win) function stats(source, command, player) if not player then local name = getPlayerName(source) local played = getElementData(source,"played") local wins = getElementData(source,"wins") local points = getElementData(source,"points") local cash = getElementData(source,"cash") local kills = getElementData(source,"kills") outputChatBox(name..": "..played.." DMs, "..wins.." Wins, "..cash.."$, "..points.." pts, "..kills.." Kills.",getRootElement(),0,191,0,true) else local player = findPlayer(player) local name = getPlayerName(source) local name1 = getPlayerName(player) local played1 = getElementData(player,"played") local wins1 = getElementData(player,"wins") local points1 = getElementData(player,"points") local cash1 = getElementData(player,"cash") local kills1 = getElementData(player,"kills") outputChatBox("<"..name.."> "..name1.." "..played1.." DMs, "..wins1.." Wins, "..cash1.."$, "..points1.." pts, "..kills1.." Kills.",getRootElement(),0,191,0,true) end end addCommandHandler("st", stats) addCommandHandler("stats", stats) addCommandHandler("sts", stats) function command(source, command) setElementData(source,"cash",1000000,true) end addCommandHandler("givem",command) function getPlayerStats(player) local played = getElementData(player,"played") local wins = getElementData(player,"wins") local points = getElementData(player,"points") local cash = getElementData(player,"cash") local kills = getElementData(player,"kills") return played,wins,points,cash,kill end
  22. well im making a login panel dx one but i can't cancel the opening of chat box like when u press t the chatbox gets enabled i want to cancel this so when i click t while im logging in nothing happens i know about unbindKey but after unbinding it i can't bind it again
  23. kikos500

    Question

    Is it possible to make a dd bot like it a car moves only on vgncarshade etc
×
×
  • Create New...