Jump to content

Polak0

Members
  • Posts

    12
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Polak0's Achievements

Square

Square (6/54)

1

Reputation

  1. Good job man, keep going at this what you're doing.
  2. I heard about this script, but I don't wanna use it. I want to create script just for one vehicle that I can drive, spawn whenever I want - and I don't know how I can do it. I tried something with setElementModel, but it still not working.
  3. Hello, I want to create a test script for unique vehicle using "engineRequestModel". I have problem, because i don't know how I can give vehicle ID from c.side to s.side. c. side script. [lua] function sultan_create (heatchback) id_sultan = engineRequestModel("vehicle", 560) local txd = engineLoadTXD("sultan.txd") engineImportTXD(txd, id_sultan) local dff = engineLoadDFF("sultan.dff") engineReplaceModel(dff, id_sultan, true) outputChatBox("created") end addEvent( "sultan:heatchback", true ) addEventHandler( "sultan:heatchback", localPlayer, sultan_create, id_sultan, heatchback ) [/lua] s. side script: [lua] addCommandHandler ( "sultan_heachback", function (thePlayer ) local x,y,z = getElementPosition(thePlayer) heatchback = createVehicle(560, x, y+2.5, z+0.5, 0, 0, 0) triggerClientEvent ( thePlayer, "sultan:heatchback", thePlayer, id_sultan, heachback) end) [/lua]
  4. Hello. I created emergency light system. Everyone can see lights, but it's bugging when you turn off all of these cuz it's blinking I don't know why. If I turn on "swiatla poscigowe" and turn it off, it's okey. The same thing is "swiatla ostrzegawcze". But if I turn on "swiatla poscigowe" and "swiatla ostrzegawcze" and turn it off it's bugging like that: local screenW, screenH = guiGetScreenSize() local sx, sy = guiGetScreenSize() function isMouseIn(psx,psy,pssx,pssy,abx,aby) if not isCursorShowing() then return end cx,cy=getCursorPosition() cx,cy=cx*sx,cy*sy if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then return true,cx,cy else return false end end shader = dxCreateShader("i/shader.fx") -- Blinkers local animShads = {} p_swiatla={} p_swiatla1={} timer={} timer1={} timer2={} timer3={} timer4={} timer5={} zapalone_lg = dxCreateTexture("i/swiatla_gora_zapalone_lewa.bmp") zapalone_pg = dxCreateTexture("i/swiatla_gora_zapalone_prawa.bmp") --------------------------------- ---////// GUI local gui = false function gui_swiatla() local veh = getPedOccupiedVehicle( localPlayer ) local id = getElementModel ( veh ) local wariant = getVehicleVariant(veh) if not veh then return end if getElementModel(veh)==582 then-- NEWSVAN dxDrawImage(screenW * 0.8100, screenH * 0.3500, screenW * 0.1500, screenH * 0.2000, "i/tlo.png", 0, 0, 0, tocolor(255, 255, 255), false) if getElementData(veh, "bok_lewy") == true then exports["NS_dxGui"]:createCustomButton("Wyłącz światła górne\nna lewym boku", screenW * 0.8200, screenH * 0.3750, screenW * 0.1300, screenH * 0.0720, tocolor(255, 255, 255, 255), false) else exports["NS_dxGui"]:createCustomButton("Włącz światła górne\nna lewym boku", screenW * 0.8200, screenH * 0.3750, screenW * 0.1300, screenH * 0.0720, tocolor(255, 255, 255, 255), false) end if getElementData(veh, "bok_prawy") == true then exports["NS_dxGui"]:createCustomButton("Wyłącz światła górne\nna prawym boku", screenW * 0.8200, screenH * 0.4550, screenW * 0.1300, screenH * 0.0720, tocolor(255, 255, 255, 255), false) else exports["NS_dxGui"]:createCustomButton("Włącz światła górne\nna prawym boku", screenW * 0.8200, screenH * 0.4550, screenW * 0.1300, screenH * 0.0720, tocolor(255, 255, 255, 255), false) end end if getElementModel(veh)==599 or getElementModel(veh) ==596 then --POLICE RANCHER I LS POLICE dxDrawImage(screenW * 0.8100, screenH * 0.3500, screenW * 0.1500, screenH * 0.1500, "i/tlo.png", 0, 0, 0, tocolor(255, 255, 255), false) if getElementData(veh, "poscigowe") == true then exports["NS_dxGui"]:createCustomButton("Wyłącz światła pościgowe", screenW * 0.8200, screenH * 0.3750, screenW * 0.1300, screenH * 0.0420, tocolor(255, 255, 255, 255), false) else exports["NS_dxGui"]:createCustomButton("Włącz światła pościgowe", screenW * 0.8200, screenH * 0.3750, screenW * 0.1300, screenH * 0.0420, tocolor(255, 255, 255, 255), false) end if getElementData(veh, "ostrzegawcze") == true then exports["NS_dxGui"]:createCustomButton("Wyłącz światła ostrzegawcze", screenW * 0.8200, screenH * 0.4350, screenW * 0.1300, screenH * 0.0420, tocolor(255, 255, 255, 255), false) else exports["NS_dxGui"]:createCustomButton("Włącz światła ostrzegawcze", screenW * 0.8200, screenH * 0.4350, screenW * 0.1300, screenH * 0.0420, tocolor(255, 255, 255, 255), false) end end if getElementModel(veh)==416 then -- AMBULANS dxDrawImage(screenW * 0.8100, screenH * 0.3500, screenW * 0.1500, screenH * 0.1500, "i/tlo.png", 0, 0, 0, tocolor(255, 255, 255), false) if getElementData(veh, "sygnalki1") == true then exports["NS_dxGui"]:createCustomButton("Wyłącz światła", screenW * 0.8200, screenH * 0.3750, screenW * 0.1300, screenH * 0.0420, tocolor(255, 255, 255, 255), false) else exports["NS_dxGui"]:createCustomButton("Włącz światła", screenW * 0.8200, screenH * 0.3750, screenW * 0.1300, screenH * 0.0420, tocolor(255, 255, 255, 255), false) end if getElementData(veh, "ostrzegawcze") == true then exports["NS_dxGui"]:createCustomButton("Wyłącz światła ostrzegawcze", screenW * 0.8200, screenH * 0.4350, screenW * 0.1300, screenH * 0.0420, tocolor(255, 255, 255, 255), false) else exports["NS_dxGui"]:createCustomButton("Włącz światła ostrzegawcze", screenW * 0.8200, screenH * 0.4350, screenW * 0.1300, screenH * 0.0420, tocolor(255, 255, 255, 255), false) end end if getElementModel(veh)==427 then -- Enforcer dxDrawImage(screenW * 0.8100, screenH * 0.3500, screenW * 0.1500, screenH * 0.1500, "i/tlo.png", 0, 0, 0, tocolor(255, 255, 255), false) if getElementData(veh, "sygnalki1") == true then exports["NS_dxGui"]:createCustomButton("Wyłącz światła", screenW * 0.8200, screenH * 0.3750, screenW * 0.1300, screenH * 0.0420, tocolor(255, 255, 255, 255), false) else exports["NS_dxGui"]:createCustomButton("Włącz światła", screenW * 0.8200, screenH * 0.3750, screenW * 0.1300, screenH * 0.0420, tocolor(255, 255, 255, 255), false) end if getElementData(veh, "ostrzegawcze") == true then exports["NS_dxGui"]:createCustomButton("Wyłącz światła ostrzegawcze", screenW * 0.8200, screenH * 0.4350, screenW * 0.1300, screenH * 0.0420, tocolor(255, 255, 255, 255), false) else exports["NS_dxGui"]:createCustomButton("Włącz światła ostrzegawcze", screenW * 0.8200, screenH * 0.4350, screenW * 0.1300, screenH * 0.0420, tocolor(255, 255, 255, 255), false) end end if getElementModel(veh)==426 and getElementData(veh, "veh:sapd", true) then -- Premier dxDrawImage(screenW * 0.8100, screenH * 0.3500, screenW * 0.1500, screenH * 0.1500, "i/tlo.png", 0, 0, 0, tocolor(255, 255, 255), false) if getElementData(veh, "poscigowe") == true then exports["NS_dxGui"]:createCustomButton("Wyłącz światła", screenW * 0.8200, screenH * 0.3750, screenW * 0.1300, screenH * 0.0420, tocolor(255, 255, 255, 255), false) else exports["NS_dxGui"]:createCustomButton("Włącz światła", screenW * 0.8200, screenH * 0.3750, screenW * 0.1300, screenH * 0.0420, tocolor(255, 255, 255, 255), false) end if getElementData(veh, "ostrzegawcze") == true then exports["NS_dxGui"]:createCustomButton("Wyłącz światła ostrzegawcze", screenW * 0.8200, screenH * 0.4350, screenW * 0.1300, screenH * 0.0420, tocolor(255, 255, 255, 255), false) else exports["NS_dxGui"]:createCustomButton("Włącz światła ostrzegawcze", screenW * 0.8200, screenH * 0.4350, screenW * 0.1300, screenH * 0.0420, tocolor(255, 255, 255, 255), false) end end end --////// ODPALANIE GUI bindKey( "lalt", "down", function() local veh = getPedOccupiedVehicle( localPlayer ) if not veh then return end local id = getElementModel ( veh ) if getElementModel(veh)==426 and getElementData(veh, "veh:sapd", true) or getElementModel(veh)==427 or getElementModel(veh)==416 or getElementModel(veh)==599 or getElementModel(veh)==596 or getElementModel(veh)==582 then if gui then gui = false removeEventHandler("onClientRender", root, gui_swiatla) showCursor(false) else gui = true addEventHandler("onClientRender", root, gui_swiatla) showCursor(true, false) end end end) function updateShaders(veh) local state1 = getElementData(veh,"signal1") --local state2 = getElementData(veh,"signal2") -- LEWY BOK NEWSVAN if state1 == 0 then engineRemoveShaderFromWorldTexture( shader, "swiatla_gora_lewe", veh ) elseif state1 == 1 then engineApplyShaderToWorldTexture( shader,"swiatla_gora_lewe",veh ) dxSetShaderValue (shader, "gTexture", zapalone_lg, veh) elseif state1 == 2 then -- prawy bok newsvan engineRemoveShaderFromWorldTexture( shader, "swiatla_gora_prawe", veh ) elseif state1 == 3 then engineApplyShaderToWorldTexture( shader,"swiatla_gora_prawe",veh ) dxSetShaderValue (shader, "gTexture", zapalone_pg, veh) -- wylacz poscigowe elseif state1==4 then if isTimer(timer[veh]) then killTimer(timer[veh]) end if isTimer(timer2[veh]) then killTimer(timer2[veh]) end engineRemoveShaderFromWorldTexture(shader, "zgaszony_niebieski", veh) engineRemoveShaderFromWorldTexture(shader, "zgaszony_czerwony", veh) setElementData(veh, "poscigowe", false) p_swiatla[veh]=0 elseif state1==5 then -- wlacz poscgiowe setElementData(veh, "poscigowe", true) timer[veh] = setTimer( function() -- Niebieskie if(p_swiatla[veh] == 0) or (p_swiatla[veh] == nil) then p_swiatla[veh] = 1 engineApplyShaderToWorldTexture(shader, "zgaszony_niebieski", veh) dxSetShaderValue (shader, "gTexture", zapalone_pg, veh) else p_swiatla[veh]=0 engineRemoveShaderFromWorldTexture(shader, "zgaszony_niebieski", veh) end end, 150, 0) timer2[veh] = setTimer( function() -- Czerwone if(p_swiatla[veh] == 0) or (p_swiatla[veh] == nil) then p_swiatla[veh] = 1 engineApplyShaderToWorldTexture(shader, "zgaszony_czerwony", veh) dxSetShaderValue (shader, "gTexture", zapalone_pg, veh) else p_swiatla[veh]=0 engineRemoveShaderFromWorldTexture(shader, "zgaszony_czerwony", veh) end end, 150/2, 0) elseif state1==6 then if isTimer(timer3[veh]) then killTimer(timer3[veh]) end if isTimer(timer4[veh]) then killTimer(timer4[veh]) end if isTimer(timer5[veh]) then killTimer(timer5[veh]) end engineRemoveShaderFromWorldTexture(shader, "zgaszony_pomaranczowy", veh) engineRemoveShaderFromWorldTexture(shader, "zgaszony_pomaranczowy1", veh) engineRemoveShaderFromWorldTexture(shader, "zgaszone_bialy", veh) setElementData(veh, "ostrzegawcze", false) p_swiatla1[veh]=0 elseif state1==7 then setElementData(veh, "ostrzegawcze", true) timer3[veh]= setTimer( function() -- pomaranczowe if(p_swiatla1[veh]==0) then p_swiatla1[veh] = 2 engineApplyShaderToWorldTexture(shader, "zgaszony_pomaranczowy", veh) dxSetShaderValue (shader, "gTexture", zapalone_pg, veh) else p_swiatla1[veh]=0 engineRemoveShaderFromWorldTexture(shader, "zgaszony_pomaranczowy", veh) end end, 275, 0) timer4[veh] = setTimer( function() -- biale if(p_swiatla1[veh]==0) then p_swiatla1[veh] = 2 engineApplyShaderToWorldTexture(shader, "zgaszone_bialy", veh) dxSetShaderValue (shader, "gTexture", zapalone_pg, veh) else p_swiatla1[veh]=0 engineRemoveShaderFromWorldTexture(shader, "zgaszone_bialy", veh) end end, 275/2, 0) timer5[veh] = setTimer( function() -- Czerwone if(p_swiatla1[veh] == 0) or (p_swiatla[veh] == nil) then p_swiatla1[veh] = 2 engineApplyShaderToWorldTexture(shader, "zgaszony_pomaranczowy1", veh) dxSetShaderValue (shader, "gTexture", zapalone_pg, veh) else p_swiatla1[veh]=0 engineRemoveShaderFromWorldTexture(shader, "zgaszony_pomaranczowy1", veh) end end, 150/2, 0) end end ------------------------------------------------------------- local last = 0 function updateMultipliers() local cur = getTickCount()-last last = getTickCount() for k,v in pairs(animShads) do v[2] = v[2] + cur/1000 dxSetShaderValue(v[1],"gMultiplier",v[2]) if v[2] >= 1 then destroyElement(v[1]) setVehicleOverrideLights(k, 2 ) setVehicleHeadLightColor(k,0,0,0) animShads[k] = nil --setVehicleHeadLightColor(veh,0,0,0) end end end addEventHandler("onClientRender",root,updateMultipliers) --/////// WŁĄCZANIE ŚWIATEŁ addEventHandler("onClientClick", root, function(b, s) local veh = getPedOccupiedVehicle( localPlayer ) if not veh then return end if b ~= "state" and s ~= "down" then return end local cur = getElementData(veh,"signal1") if gui then if isMouseIn(screenW * 0.8200, screenH * 0.3750, screenW * 0.1300, screenH * 0.0720) then if getVehicleController(veh) ~= localPlayer then return end if cur == 1 then setElementData(veh,"signal1",0) setElementData(veh, "bok_lewy", false) else setElementData(veh,"signal1",1) setElementData(veh, "bok_lewy", true) end end if isMouseIn(screenW * 0.8200, screenH * 0.4550, screenW * 0.1300, screenH * 0.0720) then if getVehicleController(veh) ~= localPlayer then return end if cur == 3 then setElementData(veh,"signal1",2) setElementData(veh, "bok_prawy", false) else setElementData(veh,"signal1",3) setElementData(veh, "bok_prawy", true) end end -- POLICJA if isMouseIn(screenW * 0.8200, screenH * 0.3750, screenW * 0.1300, screenH * 0.0420) then -- POSCIGOWE if cur == 5 then setElementData(veh,"signal1",4) setElementData(veh, "poscigowe", false) else setElementData(veh,"signal1",5) setElementData(veh, "poscigowe", true) end end if isMouseIn(screenW * 0.8200, screenH * 0.4350, screenW * 0.1300, screenH * 0.0420) then -- OSTRZEGAWCZE if cur == 7 then setElementData(veh,"signal1",6) else setElementData(veh,"signal1",7) end end end end) addEventHandler ( "onClientElementDataChange", getRootElement(), function ( dataName ) if getElementType ( source ) == "vehicle" then if dataName == "signal1" then updateShaders(source) elseif dataName == "lights" then updateLights(source) end end end) I think it's something wrong with "updateShaders", but I don't know what.
  5. Hi. How can I attach dynamic light to vehicle? I tried attachElements, but it doesn't work. bindKey("l", "down", function() local veh = getPedOccupiedVehicle( localPlayer ) local x,y,z = getElementPosition(veh) if getElementModel(veh)==582 then if getElementData(veh, "light_left_on") == true then setElementData(veh, "light_left_on", false) exports["dynamic_lighting"]:destroyLight(light_leftside) else setElementData(veh, "light_left_on", true) --posX,posY,posZ,colorR,colorG,colorB,colorA,dirX,dirY,dirZ,isEuler,falloff,theta,phi,attenuation,...) light_leftside = exports["dynamic_lighting"]:createSpotLight(x,y+1.5,z, 1, 1, 1, 1, 0, 0, 0, 2, 40, 0.55, 8, 10) attachElements(light_leftside, veh) end end end)
  6. Hello everyone. I have one problem, i create building in 3DS Max, and I was try to create "windows" in barrier, but it doesn't work. Any help?
  7. The same problem. [21:41:20] ERROR: [scripts]\Event2\sourceS.lua:49: attempt to call upvalue 'player' (a number value) \\Edit New Problem. [21:46:34] ERROR: [Scripts]\Event2\sourceS.lua:50: attempt to compare string with number local Event = false local player = 0 function Event_start(plr) if Event == false then Event = true outputChatBox("Save on event is ON, write /join to join on event.", plr, 255, 255, 255, true) elseif Event == true then Event = false outputChatBox("Saves are OFF.", plr, 255, 255, 255, true) end end addCommandHandler("event_saves", Event_start) addCommandHandler("event_create", function(plr, cmd, t2, t1, value, ...) if not t2 or not t1 or not ... or not tonumber(value) then outputChatBox("Correct CMD is /event_create <event name> <the number of players>", plr, 255, 255, 255) end local name_event = table.concat({t2}) local value = table.concat({t1}) if tonumber(value) < 8 then outputChatBox("You write too small number of players !", plr, 255, 255, 255) return end if tonumber(value) > 64 then outputChatBox("You write too big number of players !", plr, 255, 255, 255) return end if tonumber(value) > 0 then local name = getPlayerName(plr) outputChatBox("Administrator: #008000"..name.." #FFFFFFinvite on event #008000"..name_event.."#FFFFFF , free places: #0080000/"..value.."", getRootElement(), 255, 255, 255, true) return end end) local function Join_event(plr, cmd, t1, value, player) if not Event == true then return end local value = table.concat({t1}) if getElementData(plr, "player:event") then outputChatBox("You are in event!", plr, 255, 255, 255, true) return end setElementData(plr, "player:event", true) player = (tonumber(player) or 0)+1 if player > value then outputChatBox("The event is have maximum number of players.", getRootElement(), 255, 255, 255, true) return end setElementPosition(plr, -2422.37842, -607.25677, 132.56250) outputChatBox("W E L C O M E on the event !", plr, 255, 255, 255, true) end addCommandHandler("join", Join_event) function lols(plr) setElementData(plr, "player:event", false) end addCommandHandler("s", lols)
  8. I have problem with event system. [11:03:18] ERROR: [scripts]\Event2\sourceS.lua:49: attempt to perform arithmetic on local 'player' (a nil value) local Event = false local player = 0 function Event_start(plr) if Event == false then Event = true outputChatBox("Save on event is ON, write /join to join on event.", plr, 255, 255, 255, true) elseif Event == true then Event = false outputChatBox("Saves are OFF.", plr, 255, 255, 255, true) end end addCommandHandler("event_saves", Event_start) addCommandHandler("event_create", function(plr, cmd, t2, t1, value, ...) if not t2 or not t1 or not ... or not tonumber(value) then outputChatBox("Correct CMD is /event_create <event name> <the number of players>", plr, 255, 255, 255) end local name_event = table.concat({t2}) local value = table.concat({t1}) if tonumber(value) < 8 then outputChatBox("You write too small number of players !", plr, 255, 255, 255) return end if tonumber(value) > 64 then outputChatBox("You write too big number of players !", plr, 255, 255, 255) return end if tonumber(value) > 0 then local name = getPlayerName(plr) outputChatBox("Administrator: #008000"..name.." #FFFFFFinvite on event #008000"..name_event.."#FFFFFF , free places: #0080000/"..value.."", getRootElement(), 255, 255, 255, true) return end end) local function Join_event(plr, cmd, t1, value, player) if not Event == true then return end local value = table.concat({t1}) if getElementData(plr, "player:event") then outputChatBox("You are in event!", plr, 255, 255, 255, true) return end setElementData(plr, "player:event", true) player = player+1 if player > value then outputChatBox("The event is have maximum number of players.", getRootElement(), 255, 255, 255, true) return end setElementPosition(plr, -2422.37842, -607.25677, 132.56250) outputChatBox("W E L C O M E on the event !", plr, 255, 255, 255, true) end addCommandHandler("join", Join_event) function lols(plr) setElementData(plr, "player:event", false) end addCommandHandler("s", lols)
  9. Hello everybody. It's me again. I have a problem with the model. I have a script, which drives compile the *.dff models. But idk where is the problem. PLS help. script on the server's type: function code(name) local f = fileOpen(name) f:read(34) f:setPos(0) b = f:read(34) f:setPos(0) f:write("123456789012345678901234567890") f:setPos(f.size) f:write(string.reverse(b)) f:write("123456789012345678901234567890") f:write(teaEncode("123456789012345678901234567890",math.random(999999))) f:close(f) end code("1337.dff") script on the client's type: local txd = engineLoadTXD("1337.txd", 1337) engineImportTXD(txd, 1337) local dff = engineLoadDFF("1337.dff", true) engineReplaceModel(dff, 1337, true) local col = engineLoadCOL ("1337.col") engineReplaceCOL (col, 1337) engineSetModelLODDistance(1337, 300) Meta.xml: <meta> <oop>true</oop> <file src="1337.dff"/> <file src="1337.txd"/> <file src="1337.col"/> <script src="s.lua" type="server" cache="false"></script> <script src="c.lua" type="client" cache="false"></script> </meta> DB3 errors: Download error: HTTP server file mismatch (TEST-RESOURCE) 1337.dff [Got size:15544 MD5:28CB5633BB549D939E86F4CCB17521EB, wanted MD5:557CDB674F012AD8BE1CA52516449E8E] [18:54:48] DIAGNOSTIC: l3g3nd4 #1013 HTTP server file mismatch (TEST-RESOURCE) 1337.dff [Got size:15544 MD5:28CB5633BB549D939E86F4CCB17521EB, wanted MD5:557CDB674F012AD8BE1CA52516449E8E] c.lua:4: Bad usage @ 'EngineReplaceModel' , [Model ID 1337 replace failed]
  10. Okay, you could give this code because I do not understand a bit lua .
  11. Hello. For some time I have been making models for MTA:SA, and I am wondering if one can encode * .dff, * .txd and * .col files? If so, how, I do not mean methods such as (dff protection by 3ds max *the LOCK DFF* option, but for something else, to change the format other than dff, col and txd. Sorry for my english, i've using google translate ;v
×
×
  • Create New...