Jump to content

myonlake

Members
  • Posts

    2,312
  • Joined

  • Days Won

    41

Everything posted by myonlake

  1. You should really learn a few more. viewtopic.php?f=148&t=40809 Here is the code, which should work fine for your needs. I haven't really used setElementID before and I find tables a little bit better way of managing vehicles. local vehicles = {} addCommandHandler("spawnVehicle", function(thePlayer, command, vehicleModel) local vehicleModel = tonumber(vehicleModel) -- Get the number value of the model if (not vehicleModel) then -- If there wasn't any model passed in, display an error outputChatBox("SYNTAX: /" .. command .. " [vehicle model]", thePlayer, 220, 180, 20, false) return end if (not getVehicleNameFromModel(vehicleModel)) then -- If the vehicle model is invalid, display an error outputChatBox("Invalid vehicle model.", thePlayer, 220, 180, 20, false) return end local theVehicle = getPedOccupiedVehicle(thePlayer) -- Get the occupied vehicle if (theVehicle) then if (getVehicleController(theVehicle) ~= thePlayer) then -- If the player is not the driver, remove him from the vehicle removePedFromVehicle(thePlayer) else -- If the player is the driver, then delete their current vehicle destroyElement(theVehicle) end end local x, y, z = getElementPosition(thePlayer) local newVehicle = createVehicle(vehicleModel, x+3, y, z) -- Create a vehicle with the player's coordinates table.insert(vehicles, newVehicle) -- Insert the vehicle to the vehicles table setElementData(newVehicle, "vehicle.id", #vehicles, false) -- Give the vehicle a unique ID as element data outputChatBox("Vehicle spawned with ID " .. #vehicles .. ".", thePlayer, 20, 245, 20, false) end ) addEventHandler("onVehicleEnter", root, function(thePlayer, seat, jacked) if (not getElementData(source, "vehicle.id")) then -- If the vehicle has no vehicle ID, then continue table.insert(vehicles, source) -- Insert the vehicle to the vehicles table setElementData(source, "vehicle.id", #vehicles, false) -- Give the vehicle a unique ID as element data outputChatBox("This vehicle's ID has been set to " .. #vehicles .. ".", thePlayer, 20, 245, 20, false) end end )
  2. Then you have to make a timer, set its interval to your choice of time and make it run once. If the timer is already pending then cancel the function. Otherwise pass the function to client-side and trigger some renderer to draw DirectX.
  3. myonlake

    ScrollBar

    You can't make it just like that. You have to use the scrollbar scrolling event and make your own calculations on how much the change is on the variable when scrolling. I made a system myself where I could pan a song from left to right channel by having one scrollbar and it is set to the middle. When you move it to the left the sound pans left and the opposite for right. It just needs some math, that's all.
  4. As far as I know it is not possible. You can do a workaround on it by switching Silenced's model to Deagle and then changing the sounds of the gun to Deagle. But that will replace Silenced with Deagle.
  5. You can however do a workaround around it by setting the water level to -999 and making four water elements around the piece you don't want to have water in it. But that's just a matter of your needs and time.
  6. myonlake

    NPC Paths

    You can use the vehicle nodes from the GPS resource and make a route with that.
  7. w3schools is terrible. Only fools use it. Read http://w3fools.com. Websites like you linked cause nothing but trouble, more than W3Schools. W3Schools is a great website to find syntaxes and stuff from. It was my source for learning HTML when I was young. You're insulting me.
  8. If you necessarily want it, use this. local createBlip_ = createBlip function createBlip(x, y, z, icon, size, r, g, b, a, ordering, visibleDistance, visibleTo) return createBlip_(x, y, z, icon, size, r, g, b, a, ordering, (tonumber(visibleDistance) and tonumber(visibleDistance) or 300), visibleTo) end That's a wrapper function. Another way is to use https://wiki.multitheftauto.com/wiki/Se ... leDistance.
  9. It's not a bug. The player is just running multiple instances of MTA.
  10. I have used the API and I have made myself a system that automatically compiles all client-side code when the resource is started. It's useful, it's easy and it works. The only issue is that I still can't fully trust MTA:SA's encryption and compile system, if someone finds out how to crack it, good bye code.
  11. myonlake

    Skin

    We do not give you scripts, you have to make them yourself Here are the main tutorials that should get you started. If you don't seem to learn anything from them, then don't even bother trying to script. viewtopic.php?f=148&t=40809 https://wiki.multitheftauto.com/wiki/Sc ... troduction
  12. Do as you see is fit for your use. Beginners might find SQLite easier than MySQL as you don't have to install any kind of external servers to run together with MTA server. Go ahead and try SQLite out and if it seems to be too clumsy for you, then switch to MySQL.
  13. Sure, the main point being that you understand what the code does. You're welcome.
  14. In the fifth argument of dxDrawImage, change "images" to "experience/ranks/lvl_".
  15. Like thisisdoge replied, the account system is based in SQLite. The MTA internal database system just has the limitation that you can't create actual tables and columns in it. And like he said, it quite is just about personal opinions after all, but the thing is, it lacks some parameters for column configuration and like its name says, it's a light version of SQL, in other words.
  16. Tables that are not huge and don't contain that much data. For example storing some player positions in SQLite is fine, but making a big table with 30 columns and long JSON values, I'd very much prefer MySQL. I just find MySQL an easy solution for my own use, but SQLite is quite handy as well. SQLite can do most of the stuff that MySQL can, so if you're not looking for special abilities and features, I'd say use SQLite.
  17. Take a look at the code I posted. That's an example on how to make it work with your system, should work, but you have to do the rest yourself.
  18. It's a matter of relevancy but I want to point out that you can reduce the amount of lines by using the vehicle element inside the event handler instead of checking it inside the function. vehicle1 = createVehicle(602, 2279.1000976563, -1671.1999511719, 15.10000038147, 0, 0, 272) -- This car can be found at LS Grove Street near Pool Bar vehicle = createVehicle(modelID, x, y, z, rotX, rotY, rotZ) setVehicleDoorState(vehicle, 1, 1) setVehicleDamageProof(vehicle, true) -- Car won't take damage (change it to false if you want it to take damage) addEventHandler("onVehicleStartEnter", vehicle1, function(player, seat, jacked) if (seat ~= 0) then return end -- If the seat isn't '0' (driver's seat), then stop the function from executing local playerTeam = getPlayerTeam(player) local oldTeamName = (playerTeam and getTeamName(playerTeam) or "") if (oldTeamName ~= "admin") then cancelEvent() outputChatBox("This vehicle is locked for following team: admin", player, 255, 0, 0, false) else outputChatBox("Welcome to your vehicle, Sir!", player, 0, 255, 0, false) end end end ) -----Made by Alen141(ingame name:Jimboy)------ -----Special thanks to : Solidsnake14(ingame name:Castillo)----- -----Visit SAUR Utopia RPG, IP: 128.204.203.103:22003----- -----Feel free to edit script on your own----- -----Don't remove credits-----
  19. Another way to work around this is that the pedestrian never takes physical damage, but instead lowers the element data value everytime it is hit. Edit: I suppose Solidsnake's resource works that way.
  20. You have to use either GUI Static images or DirectX image drawings. Here is an example on how to draw an image with dxDrawImage. Make sure you have put the file in the images folder inside the resource and make sure the extension is right. Client-side local sx, sy = guiGetScreenSize() -- Get screen width and height local imageWidth, imageHeight = 100, 100 -- Define image width and height local imageExtension = "png" -- Define image extension (i.e. 'png', 'jpg', 'gif'...) local imageAlpha = 255 -- Define image transparency (alpha) local postGUI = true -- Define whether the image will be drawn on top of GUIs or beneath the GUIs -- Start rendering addEventHandler("onClientRender", root, function() local level = getElementData(localPlayer, "Level") -- Get the element data for the level if (not level) then return end -- If player has no level element data -> return end dxDrawImage((sx-imageWidth)/2, (sy-imageHeight)/2, imageWidth, imageHeight, "images/" .. string.gsub(level, "Lvl ", "") .. "." .. imageExtension, 0, 0, 0, tocolor(255, 255, 255, imageAlpha), postGUI) -- Draw the image end )
  21. Also, compiled scripts that were uploaded to community for free use are now useless and have no meaning whatsoever. I find this also somewhat insulting that I have been forced to use someone else's service in order to compile my scripts - especially because of the fact that whatever goes in, stays in. Anybody with the slightest idea on how to decrypt and decompile the code can do it whenever they like and the rule "don't accuse others of stealing" is not helping anyone. By the way, adding to that, how secure do you think a server owner can make their server if they have a 30 character long password with random generated letters, numbers and special characters in it and their database has another totally different password, yet still the same length, however, the hacker hacks in and steals all resources and data. How more secure can you make your VPS than that, explain me, please. Your rule is sometimes nothing else than an illogical obstacle on dealing with people that ruin MTA. If you, MTA team had your own server and someone hacked your server just to get the resources and databases, how would you feel? I doubt very well. Not sure if evidence is taken as a wildcard to bypass the rule, but so far what I've seen it never really matters anyways since it appears you expect everybody to have a password that the NSA super computers made just for your own use. Don't even start giving me an option such as "don't allow anyone else to enter the server than your IP". If you really don't give a single sunflower on how big the damage is after it has been done, then I don't know who is the person that can change your minds.
  22. I very much doubt it's possible. I believe it has something to do with the files of GTA, so you'll have to fix those in order to do it. I would've guessed this: https://wiki.multitheftauto.com/wiki/SetWeaponProperty but apparently it doesn't have an animation setting.
  23. I don't find anything wrong with using XML. Table is just another way of fetching and organizing data. It might be easier to fetch data from a table, but to be honest XML is easier for translators to understand as most of translators don't have any basic idea of scripting, not insulting anyone, but not everyone is made to be a scripter.
  24. I highly doubt the MTA:SA team is interested in moving to GTA V. GTA:SA was meant to have a multiplayer mode by default, but never got so far. GTA:IV has a built-in multiplayer and so has GTA V. IV:MP was created by mabako and his fellows, allowing customized multiplayer in GTA:IV. I cannot see why wouldn't it be possible to have a GTA:V multiplayer and I am sure some developers will want to try it out, unless R* has made it harder to have any outside modifications running the game (i.e. Social Club interfering).
  25. myonlake

    Site

    If this is your attempt to get help with the Valhalla Gaming UCP system, just forget it.
×
×
  • Create New...