Jump to content

SpecT

Members
  • Posts

    656
  • Joined

  • Days Won

    9

SpecT last won the day on July 17 2021

SpecT had the most liked content!

3 Followers

About SpecT

  • Birthday 28/01/1998

Details

  • Location
    Earth

Recent Profile Visitors

2,751 profile views

SpecT's Achievements

Crime Partner

Crime Partner (30/54)

90

Reputation

  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)
×
×
  • Create New...