Jump to content

IIYAMA

Moderators
  • Posts

    6,062
  • Joined

  • Last visited

  • Days Won

    208

Everything posted by IIYAMA

  1. I recommend to create mission markers and blips clientside. Less bandwidth for players that do not do the mission, less element managing required serverside and less problems with: setElementVisibleTo Which has to be called again for new joining players. But do what suits you best!
  2. if (client) then 'client' can only be used when an addEventHandler is used. 'client' doesn't exist when you call the function like this: loginHandler("IIYAMA", "PYAMA") Also apply MORE debug lines: (You want to know everything! ) function loginHandler(username, password) outputDebugString("loginHandler has been called") if username == "user" and password == "apple" then outputDebugString("username and password do match!") Solution: ? triggerServerEvent("submitLogin", resourceRoot, player, username, password) function loginHandler(player, username, password) if (not client and isElement(player)) or client == player then addEvent("submitLogin", true) addEventHandler("submitLogin", resourceRoot, loginHandler) -- resourceRoot > prevents trigger events from other resources to trigger this event
  3. Here you have an example how to filter with specific characters: http://stackoverflow.com/questions/27321103/limitting-character-input-to-specific-characters If players can't use letters, most of the danger has been solved. No letters = no functions.
  4. Most likely the last situation. Gta san would never use xml for missions because they are user friendly to edit.
  5. local theMath = "5 * 5" local calculate = loadstring("outputChatBox(" .. theMath .. ")") calculate(); Without complex string manipulation. Yet it can contain all kinds of calculations, but you have to be careful because it can contain more than ONLY math. Security risks! Is it for public or only personal use?
  6. -- client side -- addCommandHandler ("multiply", function (commandName, number1, number2) number1 = tonumber(number1) number2 = tonumber(number2) if number1 and number2 then local result = number1 * number2 outputChatBox(result) end end) /multiply 5 5 CLIENTSIDE ?????
  7. local missionData = {} function mark1Func(hitElement) if getElementType(hitElement) == "player" and missionData[hitElement] then local playerMissionData = missionData[hitElement] removeEventHandler("onMarkerHit", source, mark1Func) playerMissionData.mark1 = nil; local mark2 = createMarker(1167.412109375, -1741.021484375, 11.5, "cylinder", 8, 255, 69, 0, 150) playerMissionData.mark2 = mark2 addEventHandler("onMarkerHit", mark2, mark2Func) if isElement(source) then destroyElement(source) end end end function mark2Func(hitElement) if getElementType(hitElement) == "player" and missionData[hitElement] then local playerMissionData = missionData[hitElement] removeEventHandler("onMarkerHit", source, mark2Func) if isElement(source) then destroyElement(source) end missionData[hitElement] = nil -- clean up outputChatBox("Вы прибыли в точку назначения!", hitElement) -- finished? Can't read this... end end addEventHandler("onPlayerQuit", root, function () local playerMissionData = missionData[source] if playerMissionData then if isElement(playerMissionData.mark1) then removeEventHandler("onMarkerHit", playerMissionData.mark1, mark1Func) destroyElement(playerMissionData.mark1) end if isElement(playerMissionData.mark2) then removeEventHandler("onMarkerHit", playerMissionData.mark2, mark2Func) destroyElement(playerMissionData.mark2) end missionData[source] = nil end end) function seatRumpo(theVehicle, seat, jacked) if(getElementModel(theVehicle) == 440 and getTeamName(getPlayerTeam(source)) ~= "Водители") then local x, y, z = getElementPosition(theVehicle) local id = getElementModel(source) spawnPlayer(source, x-1, y-2, z, 90, id) setCameraTarget(source, source) outputChatBox("У вас нет прав для доступа в данное транспортное средство", source) elseif (getElementModel(theVehicle) == 440 and getTeamName(getPlayerTeam(source)) == "Водители") then outputChatBox("Начинаем работу", source) local mark1 = createMarker(1104.0576171875, -1740.830078125, 11.5, "cylinder", 8, 255, 69, 0, 150) missionData[source] = { mark1 = mark1--, -- you can add more data here for the mission } addEventHandler("onMarkerHit", mark1, mark1Func) end end addEventHandler("onPlayerVehicleEnter", getRootElement(), seatRumpo) Not tested. ALSO it doesn't work for multiple players at the same time yet. You will have to spend more time on it to fix that. (this is all I am doing for now) This will be the next step to improve your script: https://wiki.multitheftauto.com/wiki/SetElementVisibleTo
  8. Also here you can get the max amount of gears: (which seem to be 5, not sure if you can set more) https://wiki.multitheftauto.com/wiki/GetVehicleHandling
  9. onClientProjectileCreation https://wiki.multitheftauto.com/wiki/OnClientElementDestroy (the rocket) (you will know the type of rocket) Or use: https://wiki.multitheftauto.com/wiki/OnClientExplosion (you can't retrieve the rocket type with this method, but it is simpler than the one with onClientProjectileCreation) Here you will know the creator! Want to know who you killed? > local detector = createColSphere(x,y,z,6); https://wiki.multitheftauto.com/wiki/GetElementsWithinColShape
  10. getVehicleCurrentGear local gear = getVehicleCurrentGear ( veh ) or 1 local actualspeed = ((velocityX^2 + velocityY^2 + velocityZ^2)^(0.5)) * ((11 - gear) /10) You could try something like this. Although I have no idea how to do it perfectly. Another solution would be playing another sound. Also I added the gear data to the actually speed. Which isn't really semantic solution. But you will figure it out!
  11. if isElement(element) then destroyElement(element) end Before you destroy an element, you should check if it still exist.
  12. Here you have some more: tips, optimisations and clean up. Good luck! Serverside: An account name is an 'eventManager'? 'eventVehicles' contains account names? You should name them after what they will contain or what function they have. Also you have now 2 loops per block, only the inner loop is required to operate the system: (if you don't remove this: playerCount * playerCount = loop length) for eventPlayers in pairs(WrapedPlayers) do local eventManager = getAccountName(getPlayerAccount(source)) if ( eventVehicles[eventManager] ) then for eventPlayer in pairs( WrapedPlayers ) do triggerClientEvent( eventPlayer, "toggle_client_aircars", eventPlayer ) exports.SAEGcommands:sendMessage("Vehicle Flying has been Enabled by "..getPlayerName(client), 0, 255, 0,eventPlayers) end end end Clientside: function toggle_aircars(eventVeh) function toggle_aircars(eventVeh) -- clean up function disable_aircars(eventVeh) function disable_aircars(eventVeh) -- clean up
  13. @Syntrax# Ik zal je nog wel de laatste halve update toesturen. (woensdag of zo) Op het moment is er gewoon te weinig aandacht voor en daarom heb ik het op pauze gezet.
  14. setWorldSpecialPropertyEnabled doesn't accept specific cars, it is ONLY ON or OFF per player for ALL cars. You should use(serverside) https://wiki.multitheftauto.com/wiki/OnVehicleEnter to check if he has access to the vehicle. triggerClientEvent > setWorldSpecialPropertyEnabled And(serverside) https://wiki.multitheftauto.com/wiki/OnVehicleExit + https://wiki.multitheftauto.com/wiki/OnPlayerWasted to disable it: triggerClientEvent > setWorldSpecialPropertyEnabled With other words, you have to rewrite your code from the start. Although it is written simpler than you have right now :).
  15. Ah ik voel mij al minder eenzaam. Haha Ik ben print(string.char(74,111,114,105,107)) . Ik ben 22 jaar oud en kom uit Nederland. Speel MTA sinds de beta versies. Maar scripten kwam pas veel later. Momenteel heb ik niet zo heel veel tijd voor scripten. Al mijn server projecten zijn naar de maan gegaan door mensen die niet genoeg supporten of halverwege stoppen. Dus nu ben ik lekker zelf een coop gamemode aan het bouwen. (soort van) Weet nog niet waar het naar toe gaat. Stukje bij stukje. In het verleden heb ik heel veel mensen geholpen in de scripting section, maar nu voel ik mij niet genoodzaakt meer omdat 80% van de code rechtstreeks van de community afkomstig is. De 'scripters'> dieven, proberen iets te fixed wat niet van hun is. Ik ben er klaar mee. Debuggen van code kan ik super goed, al spam ik wel veel debug informatie via de chatbox en debugconsole. (maar het werkt en daar gaat het om) En heb freaking weinig likes. Stom nieuw kut forum. (I DON'T LIKE IT!!)
  16. @Angel02 Why don't place some debuglines in your code? Simply: outputDebugString("HEY this **** is actually working!") (you can view those in your debugscript) and if it doesn't output, you know you have done something wrong in the code before that message. Easy right? Just fill up your entire code with debug messages and you will know @Angel02 "FFS"!!! what's @Angel02 "f.ing" going on! and after you showed me what's wrong, I am happy to help. YES?
  17. A counter has to have a start / number value. local counter = 10
  18. IIYAMA: "EEEEEEeeeen POST hier? Nee hier?! WAT?!" Ik ben al door mijn LUA afkick verschijnselen heen. Dus aan mij heb je voorlopig niks haha. Maar goed dat je bezig bent met lekker veel talen. (misschien een overkill) Tip: Nog geen jQuery leren, eerst JS basic!! jQuery library downloaden is zonde van je bandbreedte, tenzij het niet anders kan. Pssst... En nu begin ik weer een beetje... extreem. --FOR YOU-- print(string.char(72,65,80,80,89,32,66,73,82,84,72,68,65,89,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33)) local theString = "Secret message!" local newString = "" local length = string.len(theString) for i = 1, length do newString = newString .. string.byte(string.sub(theString, i, i)) .. (length ~= i and "," or "") end print(newString) Try out here!
  19. Deze post is in maart gepost en hij heeft maar 1 post, dus ik denk niet dat hij nog gaat reageren.
  20. You can't delete serverside-colshapes clientside. (but you can do that with objects/markers and some other elements) Try it yourself. Which means that serverside is most likely relying partly on clientside detection too.
  21. For what purpose so many colshapes? Is it serverside? Because for every time you enter/exit an colshape, you will be sending this information to the server. Also, colshapes are elements, your players might load less objects of custom maps, because of the streaming engine. It will be ok because of the streaming engine(if colshapes can be streamed out???), but there is an 'impact' in your server. You will have to test it with multiple clients.
  22. Take a look at this tutorial and the screenshots with it.
  23. if progress <= 0 then progress = 0 -- + stop it. end
  24. Maybe it is map-manager. I can assure you that the camera never fades to black, after the camera has been faded to visible. Unless a resource is doing it.
×
×
  • Create New...