-
Posts
6,097 -
Joined
-
Last visited
-
Days Won
218
Everything posted by IIYAMA
-
How to set a script serverside? https://wiki.multitheftauto.com/wiki/Meta.xml Meta.xml <script src="server.lua" /> <!-- serverside --> <script src="server.lua" type="server"/> <!-- serverside --> <script src="client.lua" type="client"/> <!-- clientside --> Serverside: Code that only runs at the 'server'. (Which can also be on a player his computer, if he is the host) Clientside: Code that runs on every player his computer.
-
Does the outputDebugString shows your username and password correctly? If so then this condition should be OK: if username == "user" and password == "apple" then This function logIn is used when you want to login with for example a GUI instead of the command: /login username password https://wiki.multitheftauto.com/wiki/LogIn If you use this function you won't have to do this: >if username == "user" and password == "apple" then< You do it like this: local account = getAccount ( username ) if account then local successfullyLoggedIn = logIn ( player, account, password ) if successfullyLoggedIn then outputDebugString("yes! Works!") else outputDebugString("Wrong password") end else outputDebugString("Account doesn't exist!") end
-
triggerServerEvent("submitLogin", resourceRoot, player, username, password) You forgot to replace a piece of code. Password is nil because you are only sending 2 arguments instead of 3. triggerServerEvent("submitLogin", resourceRoot, player, username, password)
-
and did you try this one? (making data visible) Place it between line 1 and 2. In the code you just posted. (this doesn't solve your problem yet, but it will make it partly visible) ? outputDebugString("User: " .. username .. ", password: " .. password)
-
? outputDebugString("User: " .. username .. ", password: " .. password) You also need to be a little bit creative. If you are not sure why something(username or password) is NOT equal to .... and ...., then you have to make things visible(outputDebugString). Follow these steps: You start at the beginning of the script. You add debug lines till the end of the script. You run the script. The debugconsole will show you how far the script goes. The part that doesn't get execute is most likely the part that doesn't work. You check that part and fix it. (back to step2) OR post it on the forum and show us: where the code stops / error's / warnings. You get feedback. You edit the code. (back to step2) This way you can get things done! Instead waiting for somebody to SCAN your entire code over and over, which not always gives you result. <<< Not recommended.
-
? if username and username ~= "" and password and password ~= "" then -- Is the variable something? + Is it Not an empty string?
-
Can you show your updated code?
-
Wut? How many addEventHandler's, functions, logo's do you want? 1000000? This is why it doesn't work: https://wiki.multitheftauto.com/wiki/Game_Processing_Order You can't decide when you render a GUI, that does MTA for you because they(GUI's) are elements. While with dx you can change the render order in your code. Render your logo with this, to solve the problem: dxDrawImage
-
That event triggers probably too late. Use: https://wiki.multitheftauto.com/wiki/OnClientVehicleDamage cancelEvent() You should check if theAttacker can also be a vehicle. If there is no attacker > cancelEvent(). If there is an attacker > do nothing.
-
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!
-
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
-
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.
-
Most likely the last situation. Gta san would never use xml for missions because they are user friendly to edit.
-
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?
-
-- 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 ?????
-
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
-
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
-
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
-
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!
-
if isElement(element) then destroyElement(element) end Before you destroy an element, you should check if it still exist.
-
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
-
@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.
-
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 :).
-
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!!)
