Jump to content

Mathias Lui

Members
  • Posts

    41
  • Joined

  • Last visited

Everything posted by Mathias Lui

  1. Hi i just want to check with "/veh name" if a player is in a vehicle. If he is, you will be told. I don't know why my scripts don't work I tried various options. function getVehicle( thePlayer, command, name ) local vehicle = getPedOccupiedVehicle( name ) if ( vehicle ) then outputChatBox( name.." drives this vehicle: "..vehicle, thePlayer, 0, 0, 255 ) else outputChatBox( name.." isn't in a vehicle.", thePlayer, 255, 0, 0 ) end end addCommandHandler( "veh", getVehicle )
  2. Thanks! You helped me alot! I don't know if it is working. I am currently alone on my server, so I can't test it. But the error message works already! I also get the error message when I try to get the distance to myself Also in-game you can do /ap to set your alpha, is there something like setPlayerVisible or so? So that the script can control the alpha of a player..
  3. Thanks for your reply, First of all, I'm pretty new to this stuff. I don't know why you have to write them in the parameters brackets. Couldn't I leave it blank? Why or why not? I also don't know, when to use which word for the local player. Could you make a list? (containing what words (eg. source, client, localPlayer, playerSource, etc) you use for which purpose) Also, why did you write '_' in the parameters brackets? And where/how do I specify the arguments? And what if statements do you mean? What should they do? Sorry for that questions. I hope you can answer all/some of these.
  4. Hi, I want to script a resource which makes a player able to get his distance to another player. I could need help. It's in german, so entfernung = distance Meter = meters I have this so far: function getDistance(target) x, y, z = getElementPosition(client) x1, y1, z1 = getElementPosition(getPlayerFromPartialName(target)) distance = getDistanceBetweenPoints3D( x, y, z, x1, y1, z1) outputChatBox("Entfernung: "..distance.." Meter", client, 0, 255, 0) end addCommandHandler("entfernung target", getDistance)
  5. I already saw a video of him, but I didn't see the other videos he made. They're helpful indeed. Thanks
  6. Hi, I don't know, where else to put this question. I want to start the map editor on my server. It's not that hard, that works, but I want to start it only for specific players. Like I can be in the map editor and the other persons who join can only play freeroam, so that they don't have access to the editor. Hope sb can help. Oh god crappy english but I guess you got the point.
  7. Thanks, Okay, I don't see any '--?!'. That looks complicated AF. Are there any courses of lua scripting in MTA? I only found some basic courses.
  8. Hi, unfortuately, this is all my code. I don't know how to declare 'isElementInRange'. How do I do that? I thought it would be done by typing getLocalPlayer(). I guess I fixed the other issues. gate1 = createObject ( 975, -2695.5, 1274.8000488281 , 56.099998474121, 0, 0, 180) gate1_open = false function gate_func() function openGate1() if (isElementInRange(getLocalPlayer(), -2690.70654, 1268.74756, 55.94558, 2) == true) then moveObject(gate1, 4000, -2695.5, 1274.8000488281, 52.499998474121) if (gate1_open == false) then gate1_open = true else gate1_open = false end else outputChatBox("Stelle Dich in den Wirkungsbereich!", 255, 0, 0) end end end addCommandHandler("gate1", openGate1)
  9. Hey, I'm trying to script a gate, which moves, when a Player types /gate1. The player has to be in a specific range to a certain point, so that he can't open the gate, whereever he is. The gate spawns, but I can't open it. It doesn't happen anything at all. The script is client side. I tried it with different types of targets (such as localPlayer, getLocalPlayer(), source, root,...). Please help Also I wanted to make a switch, so there's 1 command for open AND closing the gate. I began with a boolean (gate1_open). I didn't know how to start. I'm a very beginner! I'm a bit confused about client and serverside (with source or localPlayer or whatever) gate1 = createObject ( 975, -2695.5, 1274.8000488281 , 56.099998474121, 0, 0, 180) gate1_open = false function gate_func() function openGate1() if (isElementInRange(getLocalPlayer(), -2690.70654, 1268.74756, 55.94558, 2) == true) then moveObject(gate1, 4000, -2695.5, 1274.8000488281, 52.499998474121) if (gate1_open == false) then gate1_open = true else gate1_open = false end else outputChatBox("Stelle Dich in den Wirkungsbereich!", getLocalPlayer(), 255, 0, 0, false) end end end addEventHandler("onResourceStart", getRootElement(), gate_func) addCommandHandler("gate1", openGate1)
  10. Hello, I've got another problem with my CCTV script. Everything works fine, but I want the player to be in a special vehicle (any police car) to get access to the cameras. Heres an extract of the script: local cam1 = createObject ( 1886,1592.1999511719,-1370.0999755859,34.299999237061, 10, 0, 0 ) function gotoCam1( ) if getPedOccupiedVehicle ( localPlayer ) then setCameraMatrix ( 1592.1999511719,-1370.0999755859,34.299999237061, 1593.0999755859, -1397.3000488281, 27.799999237061,0,100 ) outputChatBox("Camera 01", 0, 255, 0) else outputChatBox ( 'You are not in a police car.', 255, 0, 0 ) return end end addCommandHandler ( 'cctv1', gotoCam1 ) hope somebody can help Mathias Lui
  11. Oh ok thanks I'm a beginner, so there's still much to learn...
  12. So there's no way to change the fov for the camera?
  13. @Mr.pres[T]ege What did you do different? It works now (thanks for that) but what did you change? Was the command i used already in use? Or what was the error? I mean, the createObject didn't work as well but now it works.
  14. Hello Community, I've got a problem with my script. When I try to run it it won't work. Nothing of it. I'm a newbie in scripting. Here's the xml file: "Mathias Lui" type="script" /> and the lua file (script.lua) cam1 = createObject(1886,1592.1999511719,-1370.0999755859,34.299999237061, 10, 0, 0) function gotoCam1() setCameraMatrix(source, 1592.1999511719,-1370.0999755859,34.299999237061, 1593.0999755859, -1397.3000488281, 27.799999237061, roll = 0, fov = 100) end addCommandHandler("cctv", gotoCam1) function gotoPlayer() setCameraTarget(source) end addCommandHandler("lcctv", gotoPlayer) I also tried this: cam1 = createObject(1886,1592.1999511719,-1370.0999755859,34.299999237061, 10, 0, 0) function gotoCam1() setCameraMatrix(localPlayer, 1592.1999511719,-1370.0999755859,34.299999237061, 1593.0999755859, -1397.3000488281, 27.799999237061, roll = 0, fov = 100) end addCommandHandler("cctv 1 pw", gotoCam1) function gotoPlayer() setCameraTarget(localPlayer) end addCommandHandler("lcctv", gotoPlayer) Hope you can help me! Mathias Lui
×
×
  • Create New...