Jump to content

IIYAMA

Moderators
  • Posts

    6,097
  • Joined

  • Last visited

  • Days Won

    218

Everything posted by IIYAMA

  1. I am confused, yesterday I made like 5 working triggers, but today I can't find what is wrong... 0 errors or warnings... --client function addCommand() outputChatBox("1") local object = createElement("flag") triggerServerEvent ("addObjectExpl",getLocalPlayer(),object) --triggerServerEvent ("addObjectExpl",localPlayer,object) end addCommandHandler ("lol", addCommand) --server local objectExpl = {} local objectExplTimer function addToObjectExpl (object) outputChatBox("2") table.insert(objectExpl,{object,20}) if not isTimer (objectExplTimer) then objectExplTimer = setTimer (objectTimer,500,0) end end addEvent("addObjectExpl", true) addEventHandler("addObjectExpl", getRootElement(), addToObjectExpl)
  2. IIYAMA

    GUI size

    Thank you all, Now I understand how it works. @Anderl yes, Gui editor is really nice. For the design them I will use Indesign. /me IIYAMA love adobe.
  3. IIYAMA

    GUI size

    I am a starter at gui's. The problem is that everybody has it's own resolution. But when I check the function "GuiCreateWindow" there are some values to fill in. x and y for position, width and height. https://wiki.multitheftauto.com/wiki/GuiCreateWindow The big problem is that I don't know what the width and height values are. %?, pixel?(72dpi), well I don't know what I must think of this..... Ws, Hs= guiGetScreenSize() outputChatBox( Ws .. " " .. HS) -- 1920 1080
  4. Woow that cost 2 years to find out....... BTW:
  5. IIYAMA

    Can't walk while aiming.

    This bug is caused by your fps limit, make sure this limit is under the 60/70 fps. 60 and 70 is ok, but when your go to 80 you won't be able to walk while shooting and also deep dive in the water will be impossible.
  6. IIYAMA

    Kill music?

    https://wiki.multitheftauto.com/wiki/PlaySound https://wiki.multitheftauto.com/wiki/StopSound Source: wiki_mta local sound --I always make everything local, it's just my thing. function wasted (killer, weapon, bodypart) sound = playSound("sounds/wasted.mp3") --sound = playSound3D("sounds/wasted.mp3",0,0,0) works also for 3D end addEventHandler("onClientPlayerWasted", getLocalPlayer(), wasted) function stopMySound() stopSound( sound ) end addCommandHandler ( "stopsound", stopMySound )
  7. IIYAMA

    explosions

    hmmm yes, thank you I will try it.
  8. IIYAMA

    explosions

    How can I stop explosion at server side? https://wiki.multitheftauto.com/wiki/OnClientExplosion If the event onClientExplosion get triggered, I am able to cancel it. (cancelEvent()) But I am not able to block the signal from sending to all players. The only things that can stop this from happening: - destroyElement() (destroy the element bevore it triggers) - SetProjectileCounter (reset the explosion counter) Note: only the creator can stop it from sending Are there server-side functions to stop this?
  9. You can also check the speed of the z as. speedx, speedy, speedz = getElementVelocity ( vehicle ) ( outputDebugString(speedz) /debugscript 3 )
  10. Check out my script, https://community.multitheftauto.com/index.php?p= ... ls&id=6177 You can take that as sample.
  11. There are some possibility's, but they aren't just one function. https://wiki.multitheftauto.com/wiki/GetPedBonePosition This means you can pick some positions of the human body. https://wiki.multitheftauto.com/wiki/ProcessLineOfSight processLineOfSight(startX,startY,startZ,endX,endY,endZ,true,true,true,true,true,false,false,false,ignorePlayer)) IgnorePlayer must be you, https://wiki.multitheftauto.com/wiki/OnClientRender Use onClientRender to check those data. This is a possibility, good luck.
  12. It's the limit of how many zombies that can spawn. ZombieLimit = default (217) newZombieLimit -- you have settings about this in the meta. >get("" .. getResourceName(startedResource) .. ".Zlimit")< Check if the meta settings are correct.
  13. Normally illegal characters are in the name of the script. Gives a warning: my script must be: my_script or myScript or myscript Or maybe you use some glyphs that can't be read in the server.
  14. IIYAMA

    Problem

    Because I though that it would make the table faster.. but I think I am wrong. btw how can I subtract tables from each other? fixed. --client
  15. My [gameplay] folder is still visible, and it stays visible. No magic. Not for the server. But the content of it is visible.
  16. Those [ ] makes your folder invisible for the server. Because they are invisible, you can't check them or what is inside.
  17. IIYAMA

    Problem

    I think it is half/fixed now, because the result is "ok" Not sure if it will lagg to much when I executed every 1 min. Thank you, for keep an eye on the mistakes I made, maybe they are still there. yes, take a look at it pls. Is table.sort() needed?
  18. IIYAMA

    Problem

    If I do that, it means it is still inside the table. I probally confused you with "vehicleInTheWorld", it was just a testhing to help with removing those vehicles. If I set the Vehicle to nil, will it then be out of the table? I getting little bit confused, code is let we say inefficient, but it almost works. --local removeNumberClient = {} local weaponObjectsVeh = {} function filterTableVeh() outputChatBox(#weaponObjectsVeh)--now I can do that... it works. for c, vehicle in pairs (weaponObjectsVeh) do if not vehicle then return end if not isElement( vehicle ) then outputChatBox ("a object is gone") -- local rangeVeh = #weaponObjectsVeh local removeNumber = nil for i=0,#weaponObjectsVeh,1 do if vehicle == weaponObjectsVeh[i] then removeNumber = i end end if removeNumber then --removeNumberClient[removeNumber]= {}-- update for the client table, no index needed outputChatBox(removeNumber) table.remove(weaponObjectsVeh,removeNumber) table.sort(weaponObjectsVeh) end else outputChatBox("spams for all existed vehicles") end end ----uit end function make_vehicle_weapon(vehicle, seat, jacked) local player = source; --local vehicle = getPedOccupiedVehicle (player) if vehicle then outputDebugString("vehicle found, IIYAMA is inside a vehicle",source) else outputDebugString("there is no vehicle, so I IIYAMA return this.",source) return end if weaponvehicles[getElementModel(vehicle)] then local tableVeh = weaponObjectsVeh[vehicle] local beReturn = false for k, picVeh in pairs (weaponObjectsVeh) do if vehicle == picVeh then beReturn = true outputChatBox("return") end end if beReturn == true then return end --table.insert(weaponObjectsVeh, vehicle) table.sort(weaponObjectsVeh) weaponObjectsVeh[#weaponObjectsVeh+1] = vehicle outputChatBox("not in table, new vehicle ",source) for k, players in pairs (getElementsByType ( "player" )) do if myPlayerData[player]["load"] then outputChatBox("trigger") triggerClientEvent(players,"addtotable",getRootElement(),vehicle) end end end end --addCommandHandler ("adds", make_vehicle_weapon) addEventHandler ("onPlayerVehicleEnter", getRootElement(), make_vehicle_weapon) finnaly it is working... and now I have too much headache to improve it -_-"
  19. IIYAMA

    Problem

    I have now this: function make_vehicle_weapon(vehicle, seat, jacked) local player = source; --local vehicle = getPedOccupiedVehicle (player) if vehicle then outputDebugString("vehicle found, IIYAMA is inside a vehicle",source) else outputDebugString("there is no vehicle, so I IIYAMA return this.",source) return end if weaponvehicles[getElementModel(vehicle)] then if not weaponObjectsVeh[vehicle] then outputChatBox("not in table, new vehicle",source) weaponObjectsVeh[#weaponObjectsVeh+1]=vehicle outputChatBox(#weaponObjectsVeh .. "wtf?") for k, players in pairs (getElementsByType ( "player" )) do if myPlayerData[player]["load"] then outputChatBox("trigger") triggerClientEvent(players,"addtotable",getRootElement(),vehicle) end end end end end --addCommandHandler ("adds", make_vehicle_weapon) addEventHandler ("onPlayerVehicleEnter", getRootElement(), make_vehicle_weapon) But how can I get the position when I know only the element that is inside? I have no idea what position this vehicle should be, at the moment I try to remove it, can't find it at the lua tutorial site. function filterTableVeh() outputChatBox(#weaponObjectsVeh) vehicleInTheWorld = getElementsByType ( "vehicle" ) for c, vehicle in pairs (weaponObjectsVeh) do if vehicle then outputChatBox ("it does work") -- output works else return end --if not isElement( vehicle ) then --outputChatBox(getElementModel(vehicle)) if not vehicleInTheWorld[vehicle] then --weaponObjectsVeh[vehicle] table.remove(weaponObjectsVeh,) outputChatBox("not element" .. c) else outputChatBox("there is") end end outputChatBox(#weaponObjectsVeh) end
  20. IIYAMA

    Problem

    hmm ok, Let me try that. "some_value" ? how do you know what value I need to set next one? (vehicle)
  21. Gamemode play/freeroam? gameplayer/freeroam(.zip)/fr_server line: 401 addEventHandler('onPlayerChat', g_Root, function(msg, type) if type == 0 then cancelEvent() if chatTime[source] and chatTime[source] + tonumber(get("*chat/mainChatDelay")) > getTickCount() then outputChatBox("Stop spamming main chat!", source, 255, 0, 0) return else chatTime[source] = getTickCount() end if get("*chat/blockRepeatMessages") == "true" and lastChatMessage[source] and lastChatMessage[source] == msg then outputChatBox("Stop repeating yourself!", source, 255, 0, 0) return else lastChatMessage[source] = msg end local r, g, b = getPlayerNametagColor(source) outputChatBox(getPlayerName(source) .. ': #FFFFFF' .. msg:gsub('#%x%x%x%x%x%x', ''), g_Root, r, g, b, true) outputServerLog( "CHAT: " .. getPlayerName(source) .. ": " .. msg ) end end )
  22. IIYAMA

    Problem

    I have never done that bevore. How can I do that? or maybe a sample. array * mytable = {} How can I make a table that stores every new object at the next open place?
  23. IIYAMA

    Problem

    local myPlayerData = {} local weaponObjectsVeh = {} local weaponvehicles = {[476]=true} function make_vehicle_weapon(vehicle, seat, jacked) local player = source; --local vehicle = getPedOccupiedVehicle (player) if vehicle then outputDebugString("vehicle found, IIYAMA is inside a vehicle",source) else outputDebugString("there is no vehicle, so I IIYAMA return this.",source) return end if weaponvehicles[getElementModel(vehicle)] then if not weaponObjectsVeh[vehicle] then outputChatBox("not in table, new vehicle",source) weaponObjectsVeh[vehicle]={} --<--<--< store my data for k, players in pairs (getElementsByType ( "player" )) do if myPlayerData[player]["load"] then outputChatBox("trigger") triggerClientEvent(players,"addtotable",getRootElement(),vehicle) end end end end end --addCommandHandler ("adds", make_vehicle_weapon) addEventHandler ("onPlayerVehicleEnter", getRootElement(), make_vehicle_weapon) function filterTableVeh() outputChatBox(#weaponObjectsVeh) for c, vehicle in pairs (weaponObjectsVeh) do if vehicle then outputChatBox ("it does work") -- output works else return end if not isElement( vehicle ) then --<--<--< check weaponObjectsVeh[vehicle]= nil outputChatBox("not element")) end end outputChatBox(#weaponObjectsVeh) end setTimer (filterTableVeh, 1000,0) I check if my tabledata and check if it is an element, but since I add it in the table it isn't a vehicle any more......... how can I turn it back to normal element/user data? and If I check with "#" it will always awsers 0, but it is there....
  24. IIYAMA

    Weapons ammo

    You calling "ammo[11]" when it does not exist in the table it self.......
  25. IIYAMA

    Weapons ammo

    local ammo = { 1,100,60,150,50,5,300 } -- 1 = 1 -- 2 = 100 -- 3 = 60 -- 4 = 150 -- 5 = 50 -- 6 = 300 giveWeapon(source,24,ammo[1],true) --= 1 ammo giveWeapon(source,27,ammo[2],true) --= 100 ammo giveWeapon(source,30,ammo[3],true) --= 60 ammo giveWeapon(source,34,ammo[4],true) --= 150 ammo
×
×
  • Create New...