Jump to content

SpecT

Members
  • Posts

    656
  • Joined

  • Days Won

    9

Everything posted by SpecT

  1. Hey, It would be good if you paste the link you get after running the MTADiag tool.
  2. Hey, You can start by showing us the script where the SQL operations are being executed.
  3. Hey, I had to test it in-game and found what was wrong - getVehicleType returns the type as string but capitalized (lol). Replace with: getVehicleType(v) == "Trailer" Also you will need to lower the distance cuz 2000 is way too much (tested it with 200 and it was attaching it from far). ?
  4. Show me how do you call the function "getNearestTrailer". In server-side there is no "localPlayer". Keep that it mind.
  5. It throws you this error cuz it couldn't find a trailer. Maybe the distance is too low (50) you can try by increasing it and test. Edited the function a bit to prevent eventual errors. function hookTrailer(commandName) local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle then local x,y,z = getElementPosition( vehicle ) local rx,ry,rz = getElementRotation ( vehicle ) local trailer = getNearestTrailer(localPlayer, 50) if trailer then attachTrailerToVehicle ( vehicle, trailer ) outputChatBox("Connected.", 255, 0, 0) else outputChatBox("No nearby trailer was found!", 255, 0, 0) end else outputChatBox("You need to be in a vehicle!", 255, 0, 0) end end addCommandHandler("hook", hookTrailer) *Edit: BTW I just thought about it that this probably is not gonna work as it is made in the client-side. Vehicles created in client-side cannot be entered but only be shown. So I guess your vehicles (truck and trailer) are spawned from server side ? You will need to make the script server-sided. It's not hard but if you struggle don't hesitate to ask for assistance.
  6. Hey, There is a "useful" function on the wiki to get the nearest vehicle to a player by specified max distance - getNearestVehicle. You can use it for your script but it will need a check whether the vehicle type is "trailer". Something like this: function getNearestTrailer(player,distance) local lastMinDis = distance-0.0001 local nearestTrailer = false local px,py,pz = getElementPosition(player) local pint = getElementInterior(player) local pdim = getElementDimension(player) for _,v in pairs(getElementsByType("vehicle")) do local vint,vdim = getElementInterior(v),getElementDimension(v) if vint == pint and vdim == pdim then local vx,vy,vz = getElementPosition(v) local dis = getDistanceBetweenPoints3D(px,py,pz,vx,vy,vz) if dis < distance then if dis < lastMinDis and getVehicleType(v) == "trailer" then lastMinDis = dis nearestTrailer = v end end end end return nearestTrailer end And then use it like: getNearestTrailer(localPlayer, 50)
  7. *Moved the topic to the arabic scripting section to get support in your language. The main scripting section is English-only.
  8. Well, now you edited the server-side function to be called by a command instead by an event. From what I see in the server side the triggerClientEvent will be triggered for all the players online. See documentation of triggerClientEvent. The first optional argument is the sendTo element, in this case "player". triggerClientEvent(player, "N3xT.onShopSkin", player) And what do you mean by "nothing" ? Nothing happens/opens or ?
  9. You don't have to make any changes to the triggerServerEvent. You already fixed the stuff in the server-side so it should work just fine. triggerServerEvent("textoComprado", localPlayer)
  10. Oh wait my bad. Yeah the problem is in the client-side where you trigger the server event. The arguments for the function triggerServerEvent are eventName, source element and arguments. You only put the event name and the source element. So you have 2 options: use source instead of player in the server function OR just put one more localPlayer argument in the triggerServerEvent.
  11. I wrote it like this so we will know if there is something wrong with the exported function called "getCharacterID" from the resource called "players". Obviously there is a problem with it. In this case we will need the code from this exported function I just mentioned.
  12. As @CrystalMV explained you have missing arguments in the client side triggerServerEvents where you call the "serverAddVehicleUpgrade" event. You miss the player and price arguments. You can easily add the player (localPlayer) element to the calls BUT you don't have the prices specified anywhere. So until you put all the prices of each upgrade in each of all those triggerServerEvent calls (or store them in a table) you can set a default price in the server side function and remove the price from the function arguments. Also no offense but you are again just throwing a large amount lines of script and expecting someone to address the problem and fix it all for you without an effort from your side. We are giving you directions which in my opinion should be enough to understand what you are supposed to do.
  13. Hey, The problem might be coming from the exported function (i.e. can't find the player or problem with the code there). Also it would be good if you store the result of the exported function in a variable before the query. local model = getElementModel(player) local charID = exports.players:getCharacterID(player) if model and charID then exports.sql:query_free("UPDATE personaje SET skin = '" .. model .."' WHERE characterID = '"..charID.."'") else outputDebugString("Problem with either model or charID") end
  14. Hey, Well the errors tell you exactly what the problem is. You will need to convert the script files to UTF-8 encoding. If you have Notepad++ you can do that easily - open a script file, on top of the program you will see "Encoding" section(tab), there you will see the "Convert to UTF-8" option which is what you need to do. Do that to the files that cause you these errors and reupload them on the host.
  15. Hey, You could simply just search on google for the formula to convert bytes to megabytes. Formula: megabytes = bytes / 1024 / 1024 So in your case: megabytes = math.floor(totalSize / 1024 / 1024)
  16. Well it's similar to the example I gave you. local sound addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() setTimer(function() sound = playSound("winsound.mp3") end, 2000, 1) end ) -- And in the function where the player logs in successfully put this: if isElement(sound) then stopSound(sound) end
  17. Hey, Here is an example: local sound function login() sound = playSound(...) end function afterLogin() if isElement(sound) then stopSound(sound) end end
  18. Well, you probably didn't copy everything. If I remember right the nextmap management is in racevoting_server.lua. And probably there are events to tell the client what the next map is.
  19. What do you mean by not worked ?
  20. Hey, Did you define the exported function in the meta.xml file ? Check the page with documentation about calling functions from other resources: https://wiki.multitheftauto.com/wiki/Call
  21. Welcome to the Forums, You need to grant the resource Administrator rights in order to use the "getPlayerIP" function. <group name="Admin"> <acl name="Moderator"/> <acl name="SuperModerator"/> <acl name="Admin"/> <acl name="RPC"/> <object name="resource.admin"/> <object name="resource.webadmin"/> <object name="resource.EXAMPLE"/> <object name="user.DIMITRIJ0814"/> </group> Replace EXAMPLE with the resource name.
  22. Hello, I guess you are talking about Race gamemode. There are a few gamemodes uploaded on the community site with the ability to show the next map (if one is set). You can see how it's made and do it to your gamemode or use them instead. https://community.multitheftauto.com/index.php?p=resources&s=details&id=6008 https://community.multitheftauto.com/index.php?p=resources&s=details&id=12297 https://community.multitheftauto.com/index.php?p=resources&s=details&id=6048
  23. It's not that we don't want to help but we can't help you since you don't show the full code. The examples we gave you should be enough to get the idea how to do it. You mentioned it's about 2 resources communicating - 1st resouce calls 2nd resource to remove the blip ? At least this is what I understood. Well if you show the code of both resources where this "communication" happens we could be able to help you.
  24. SpecT

    repet

    Hey, This is a way to prevent the spam: setTimer(function() local found = false for i,v in ipairs(Table) do if (T1 == v[1] and T2 == v[2] and T3 == v[3]) then found = true break end end if found then outputChatBox('true') else outputChatBox('false') end end,1000,1)
  25. Hey, Well we could ask you the same question. ? What's doesn't work? Any errors from /debugscript 3 ? Something I noticed is that in the function it is used the variable called "pElement" which in the function arguments for some reason its "Element". Maybe this is the problem ?
×
×
  • Create New...