Jump to content

IIYAMA

Moderators
  • Posts

    6,089
  • Joined

  • Last visited

  • Days Won

    216

Everything posted by IIYAMA

  1. Big dreams, maybe pay Google a little bit with your privacy, by using the search bar and button. It is a lot cheaper you know? No-cure-no-pay, seriously? ? Zombie bots. <<< Topic doesn't fit within this section, LOCKED
  2. The variable victim contains extra information. It is optional. function cameraFireing(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement) iprint("event is fired") if getElementData(localPlayer, "char.inMarkerZone") then iprint("source is in zone") local victim = isElement(hitElement) and getElementType(hitElement) == "player" and hitElement or false local zoneName = getElementData(localPlayer,"char.MarkerZoneName") triggerServerEvent("sendGroupMessage", resourceRoot, victim, victim and getPlayerName(victim), zoneName) end end addEventHandler("onClientPlayerWeaponFire", localPlayer, cameraFireing) addEvent("sendGroupMessage", true) addEventHandler("sendGroupMessage", resourceRoot, function (victim, victimName, zoneName) local message = "#ffffffThe camera: #ca5454(".. zoneName ..") #ffffffdetected shots. " if victimName then message = message .. " You hit this player: " .. victimName end outputChatBox(message, client) if isElement(victim) then outputChatBox(getPlayerName(client) .. " hits you and he doesn't feel sorry for it.", victim) end local players = getElementsByType("player") for i=1, #players do local player = players[i] if player ~= client and player ~= victim then outputChatBox(getPlayerName(client) .. " loves sheeps.", player) end end end, false)
  3. if victim then So, do not add this clientside. But as I said in my previous post: And add WAY more debug lines. You have now just 1 line, which is in this case your outputChatBox. That is not enough! YOU ARE A GOD, YOU WANT TO DOMINATE, YOU WANT TO BE IN CONTROL AND KNOW EVERYTHING! function cameraFireing(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement) iprint("event is fired") if getElementData(source, "char.inMarkerZone") then iprint("source is in zone") end end
  4. IIYAMA

    Open Browser

    No that is not possible directly from MTA exe to web-browser. But you can set the clipboard with an specific URL. https://wiki.multitheftauto.com/wiki/SetClipboard You can also add push notifications, which comes closer to what you want: https://web-push-book.gauntface.com/ https://web-push-book.gauntface.com/demos/notification-examples/ But I haven't done it before, so the exploration is all yours. How Youtube does it (concept):
  5. IIYAMA

    Animation

    The second code is the condition for removing the handler.
  6. IIYAMA

    Animation

    Block the progress local timeNow = getTickCount() local iProgress = (timeNow - iStartTick)/1000 if iProgress > 1 then iProgress = 1 end Stop the animation 3 seconds after the end time. if ((timeNow - iStartTick) / 1300) >= 1 then
  7. Conditions are used for excluding actions. Which is not what you want, when you want: shooting OR killing Instead you want to have a variable value which only exist when all conditions are met. local victim = isElement(hitElement) and getElementType(hitElement) == "player" and hitElement or false You can't hit yourself with your own bullets: hitElement ~= source As I said before: addEventHandler("onClientPlayerWeaponFire", root, cameraFireing) addEventHandler("onClientPlayerWeaponFire", localPlayer, cameraFireing) triggerServerEvent("sendGroupMessage", resourceRoot, hitElement) Do this on serverside: if hitElement then local message = "#ffffffThe camera: #ca5454("..getElementData(hitElement,"char.MarkerZoneName")..") #ffffffdetected shots." end addEventHandler("onClientPlayerWasted", getLocalPlayer(), cameraKilling) onClientPlayerWasted, so this is not needed: if (getElementType(source) == "player") then
  8. As your code is programmed now, you have to hit another player in order to trigger the server event. Are you sure you have met that condition? Also attach the eventhandler to the localPlayer: addEventHandler("onClientPlayerWeaponFire", localPlayer, cameraFireing) Even though this event is fired on each client/player. The event is also fired for each player when attached to the root. When there are 5 players in the server, 1 player hits another player, the triggerServerEvent is activated max 5 times.
  9. @ilnaz Re-used data, with a buffer. local songBuffer = {} addEvent("onSearchRequest", true) addEventHandler("onSearchRequest",getRootElement(),function(txt) local buffer = songBuffer[txt] if buffer then onSongReturn(buffer, 0, player) else fetchRemote( "http://5music.online/?song="..(txt:gsub(' ', '+')),onSongReturn,'',true,client, txt) end end) function onSongReturn(data, errno, player, txt) if errno == 0 and txt then songBuffer[txt] = data end if player and isElement(player) then local str1 = string.find(data,"<ul>") local _,str2 = string.find(data,"</ul>") if str1 ~= nil then local data = string.sub(data,str1,str2) triggerClientEvent(player,"onSongReceived", player, data) end end end -- clear buffer setTimer(function () songBuffer = {} end, 1000 * 60 * 60 * 4, 0)
  10. Locked for the following reasons. 1. Suspicion release. (Leaving a link on a topic, which leads to a ZIP file. Without a description of any kind except for the title) 2. Unsupported at all. (Which makes it looks like, it is not yours to begin with) 3. Wrong section. Because of those 3 reasons, I am not even going to check your ZIP file.
  11. Is your issue now solved with xFabel his explanation? You can convert names to id's with this function: https://wiki.multitheftauto.com/wiki/GetVehicleModelFromName local model = getVehicleModelFromName ("bandito") if model then -- is there an id based on that name? end
  12. Where is that suppose to come from? It is not as if groupid is something from default MTA.
  13. Clientside? Btw you are missing an argument: (model) createVehicle ( int model, float x, float y, float z
  14. Have you noticed that the event system is Asynchronous? (You can't make use of the return keyword functionality after all. Stopping the code with it does work.) And exports are Synchronous. (You can use the return keyword to return values) An understanding of what I am talking about in JavaScript: After you watched this, you know which one is way faster.
  15. By just looking at the initial setup, it looks very logic. That is without looking at syntax and any other issues at all.
  16. The variable name localPlayer isn't suppose to be used on serverside, because it only makes sense for the player that runs the MTA application and the server on his own pc. No other player in your server will be able to met that condition. Note: If this code is fully clientside, you will not be able to send a message to other players. Do you remember this loop you posted in your other topic? It will allow you to go through all the players in the server.
  17. Wait until the bug has been solved. https://github.com/multitheftauto/mtasa-blue/issues/1091 No video on your server, is not the end of your world atleast. (Hope hope)
  18. A small example/hack to rotate (multiple) vehicles. With very little code. This code is untested local rotationElement = createElement("rotationElement") local duration = 1000 addEventHandler("onClienRender", root, function () setElementRotation(rotationElement, 0,0, (getTickCount() % duration) / duration * 360 ) end) local vehicle1 = createVehicle(--[[ fill in]]) setElementParent(vehicle1, rotationElement) local vehicle2 = createVehicle(--[[ fill in]]) setElementParent(vehicle2, rotationElement) local vehicle3 = createVehicle(--[[ fill in]]) setElementParent(vehicle3, rotationElement) setElementFrozen(rotationElement, true)
  19. You can also change the rotate (velocity) with this function: https://wiki.multitheftauto.com/wiki/SetElementAngularVelocity But for exact 360, you will need the setElementRotation function. It just depends on what you are going to make.
  20. Correct. This section has as start point "learning how to code", which is for everyone to make use of. So private code and requests(like this one without code) will not fit in this section.
  21. IIYAMA

    Get keys

    For debugging or for your players? In case of debugging you can do just this: dxDrawText(inspect(keys), 1083, 190+zz, 1149, 206, tocolor(255, 255, 255, 255), 0.9, "default-bold") Not recommended for showing it to your players.
  22. Incorrect MySQL syntax, see here an insert example. https://www.tutorialspoint.com/mysql/mysql-insert-query.htm SET is afaik for variables.
  23. Yup. if args[1] == "success" then if minigameData.successEvent then triggerEvent(minigameData.successEvent, localPlayer, unpack(minigameData.customData)) end else if minigameData.failEvent then triggerEvent(minigameData.failEvent, localPlayer, unpack(minigameData.customData)) end end From saving minigameData.customData = {select(5, ...)} to loading + unpacking as arguments. unpack(minigameData.customData)
  24. Correction. Trigger the event on clientside. This successEvent. minigameData.successEvent = successEvent Which is not triggering anything in the code you posted.
  25. This is a bit complex. Note: ... = leftover parameter that doesn't have variables to store in. Doesn't matter how much arguments you pass in to the function. function functionName (parameter1, parameter2) end functionName(argument1, argument2) -- calling the function There are the first 3 parameters:(line 1) (gameType, successEvent, failEvent, ...) This table(arguments) will collect all leftover parameters: (line 4) local args = {...} After: gameType, successEvent, failEvent From those leftover parameters, until the 4e are used for something. (line 17) minigameData.maxButtonNum = args[4] or 75 If we want to be able to save everything after parameter 4. We can use the select function. print(select(5,"arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9","arg10")) Run this code here, to see how it works: https://www.Lua.org/cgi-bin/demo So what you need to do, is modifying it, so that it saves data in the minigameData. The function select, will select from a specific index (5) it's item and all items that come after that. minigameData.customData = {select(5, ...)} Add it for example on line 10. In your code: startMinigame("balance", "successPlayerHelpup", "failedPlayerHelpup", 1, 10000, nil, nil, playerSource, "you can add here something else", "etc...") Arguments 1. "balance", 2. "successPlayerHelpup", 3: "failedPlayerHelpup" ... 4 | 1: 1 5 | 2: 10000 6 | 3: nil 7 | 4: nil 8 | 5: playerSource < saving from here. 9 | 6: more? The thing left to do, is sending it with the triggerClientEvent. But that code is not visible for me.
×
×
  • Create New...