Jump to content

Elmatus

Members
  • Posts

    47
  • Joined

  • Last visited

Everything posted by Elmatus

  1. Yeah, you said you already had it so I didn't post it! I'm glad its working now.
  2. Spawning a weapon doesn't make it fire. You can use the function setWeaponState (theWeapon, "firing") to make it fire (i.e when you press the left mouse button)
  3. function shootProjectile() local vehicle = getPedOccupiedVehicle(localPlayer) -- Check if the player is in a vehicle if(vehicle)then --Check if its a rustler if getElementModel(vehicle) == 476 then --Get the current position of the vehicle and fire a rocket (No rotation is passed to createProjectile function because it automaticaly gets the vehicle rotation) local x, y, z = getElementPosition(vehicle) createProjectile(vehicle, 19, x, y, z) end end end bindKey("mouse1", "down", shootProjectile) I think I understand you. Give a try to this.
  4. Thanks in advantage for any help The problem is kind of simple, yet I haven't figured it out yet. I want that the barrels created actually move and fall. It only happens when a player touches it. The wiki says that to implement physics in an object just set velocity to 0, but it doesn't work A snippet of the code: function .... if.... for i,spot in ipairs (spots) do local pos = split(spot,",") if objectType == "object" then local theObject = createObject (object,pos[1],pos[2],pos[3]) setElementVelocity(theObject,0,0,0) elseif objectType == "vehicle" then local theVehicle = createVehicle(object,pos[1],pos[2],pos[3],math.random(0,120),math.random(0,120),math.random(0,120)) addSpeed(theVehicle) end end end end
  5. Didn't know aswell That worked just perfect, thanks!
  6. Thanks in advantage for everyone who is willing to help Ok, so I have a problem regarding to fileWrite It works just fine in a normal resource. But when I try it in a zipped script it doesn't have effect. Is this a common thing? How can I fix this problem?
  7. Tried that to pcall (loadstring(luaCode)) But nothing
  8. Ok, thanks in advantage for whoever takes time to answer. I'm trying to make a a script that loads a txt when it starts up. The script is serverside. I have a very weird problem. If I just put the lua code like normal it works just fine. But if Put it in a .txt or event a .lua outside meta, it doesnt work! The purpose of what I want is that admin of the sv can change the file without having to have the FTP of the server. Here is a snippet of my code: (server-side) function loadTheCode() file = fileOpen ("editable.lua") size = fileGetSize(file) luaCode = fileRead(file,size) loadstring (luaCode) fileClose(file) end addEventHandler("onResourceStart",root,loadTheCode) The code im trying to load includes some callRemote, getAccountSerialand other stuff. The thing I dont get is why it works inside the in-meta lua but not with loadstring. The console doesn't outputs errores nor the debugscript. The event does get triggered. I verified luaCode's length and it matches the lua code in it. Any solutions?
  9. I didn't realize that, thanks! I have another question, too small for making it a post. Can you get a return in server-side, by a client-side? Or vice versa
  10. Hi, thanks everyone beforehand I'm making a script o attach a m4 in a migun base and that a player can enter it and shoot. When I tested it with a friend in the server, he doesn't see the bullets coming out. I made it shootable everywhere (me far from the minigun bae) and I stepped in front of it, and I do get killed. I think the problem has to be with being client-side. But createWeapon is only a client-side function. Here is the function that fires the weapon: Client-side customWeapon = createWeapon ("m4",0,0,0) setElementAlpha(customWeapon,0) setElementCollisionsEnabled(customWeapon,false) -- For field of view bug attachElements (customWeapon,minigun,0.5,0,1.1,0,0,0) setWeaponClipAmmo(customWeapon, 99999) setWeaponFlags (customWeapon, "disable_model",true) -- Hides it setWeaponFiringRate(customWeapon,50) function startFiring (_, state) if state == "down" then setWeaponState(customWeapon, "firing") else setWeaponState(customWeapon, "ready") end end bindKey ("mouse1","both",startFiring)
  11. Yes it outputs. And no I already tried debugscript and no error is displayed. Like I said is only when I add other argument
  12. Oh sorry! I didn't paste it here, I already have it!
  13. The event is triggered if I only send one argument, "theShooter". I added the argument "object", ensuring is not nil. But the server event is not triggered after that Any help is aprecciated Client (Relevant: line 34-40) function ObjectShot ( theShooter, weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement ) shooterX, shooterY, shooterZ = getElementPosition (theShooter) targetDistance = getDistanceBetweenPoints3D ( shooterX, shooterY, shooterZ, hitX, hitY, hitZ ) local startX, startY, startZ = getPointInFrontOfPlayer(theShooter, 1.5 ) local rx,ry,rz = math.random(360), math.random(360), math.random(360) startZ = startZ - 0.5 if isPedInVehicle(theShooter) == true or isBadWeapon(weapon) == true then else -- does object exist destroy if it did if shells.object.obj[shells.object.shotCount] ~= nil then if isElement(shells.object.obj[shells.object.shotCount]) then destroyElement(shells.object.obj[shells.object.shotCount]) end shells.object.obj[shells.object.shotCount] = nil end shells.object.obj[shells.object.shotCount] = createObject(321, startX, startY, startZ) setObjectScale ( shells.object.obj[shells.object.shotCount], 5) moveObject ( shells.object.obj[shells.object.shotCount], targetDistance*10, hitX, hitY, hitZ, rx, ry, rz ) outputChatBox ("Count: shells.object.obj" .. tostring(shells.object.shotCount) .. " objects") if (shells.object.obj[shells.object.shotCount]) then triggerServerEvent( "onSpecialEvent", resourceRoot, theShooter, shells.object.obj[shells.object.shotCount] ) outputChatBox ("Sending to server-side") else outputChatBox ("Object does not exist") end end end Server: addEvent ( "onSpecialEvent",true) function objectExplosion (theShooter, object) outputChatBox ( "Player " .. getPlayerName(theShooter) .. " triggered object shoot " ) if ( (targetDistance*10) < 50) then createExplosion ( hitX, hitY, hitZ, 2, theShooter) destroyElement (object) else setTimer ( function() createExplosion ( hitX, hitY, hitZ, 2, theShooter ) destroyElement(object) end, targetDistance*10, 1 ) end end addEventHandler ( "onSpecialEvent", getRootElement(), objectExplosion )
  14. Ok that would work, I'll use it. Just for doubt, how I make it to have a natural movement (gravity, etc) Do I have to mess with the velocity and not the moveObject?
  15. Hi, I have a simple question I was looking in the wiki, but I didn't find how to move a vehicle like you move an object. For example like how gravity gun does. I tried the normal moveObject, but it didn't work
  16. Hi, I'll appreciate any help, and thanks I have a funny scrit that throws objects and when they impact, they make an explosion. The problem is that with the explosion, I writed destroyElement(shells.dildos.obj[shells.dildos.shotCount]) But this gives me an error in console: Bad argumenet @'destroyElement' [Expexted element at argument 1, got nil] I noticed that if I change the object before moving it, I can change the alpha and all, but after it, i can't And in both cases I can't destroy the object. Here is my code: function DildoShot ( theShooter, weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement ) -- Calculate distance for object speed shooterX, shooterY, shooterZ = getElementPosition (theShooter) targetDistance = getDistanceBetweenPoints3D ( shooterX, shooterY, shooterZ, hitX, hitY, hitZ ) local startX, startY, startZ = getPointInFrontOfPlayer(theShooter, 1.5 ) local rx,ry,rz = math.random(360), math.random(360), math.random(360) startZ = startZ - 0.5 if isPedInVehicle(theShooter) == true or isBadWeapon(weapon) == true then else -- does paint marker exist destroy if it did if shells.dildos.obj[shells.dildos.shotCount] ~= nil then if isElement(shells.dildos.obj[shells.dildos.shotCount]) then destroyElement(shells.dildos.obj[shells.dildos.shotCount]) end shells.dildos.obj[shells.dildos.shotCount] = nil end shells.dildos.obj[shells.dildos.shotCount] = createObject(321, startX, startY, startZ) setObjectScale ( shells.dildos.obj[shells.dildos.shotCount], 5) moveObject ( shells.dildos.obj[shells.dildos.shotCount], targetDistance*10, hitX, hitY, hitZ, rx, ry, rz ) if ( (targetDistance*10) < 50) then createExplosion ( hitX, hitY, hitZ, 2) else setTimer ( function() createExplosion ( hitX, hitY, hitZ, 2 ) end, targetDistance*10, 1 ) end -- check for limit if shells.dildos.shotCount > 20 then shells.dildos.shotCount = 1 else shells.dildos.shotCount = shells.dildos.shotCount + 1 end end -- local outString = string.format(“DildoShot Count: %d Element: %s", shells.dildos.shotCount, tostring(shells.dildos.obj[shells.dildos.shotCount])) -- outputDebugString( outString ) end
  17. It is the only thing displayed in the console.
  18. Same error with autoreconf -fiv
  19. Hi, I want to create my server on OS X. I followed all the steps in the Wiki post, Building_MTASA_Server_on_Mac_OS_X, and everything seems good, until Compiling the server autoreconf -fi CPPFLAGS="-I/opt/local/include" LDFLAGS="-L/opt/local/lib" ./configure make install Is that a Terminal command? I tried to execute them by copy/paste them. Also one by one but nothing seems to work. When I tried one by one, autoreconf -fi gives me the following error: autoreconf: 'configure.ac' or 'configure.in' is required I will appreciate any help
  20. Now its working Thanks a lot SolidSnake for the correction of the syntax Thanks all of the other people that commented. Blesses and have a good afternoon.
  21. Oh I think i get it I was writting: if xxxx then xxxxx end else xxxxx But it was: if xxxxx then xxxx else xxxx end The "The gate is moving" Is when the door is not in initPos or in finaPos, so the door is opening, you have to wait to stop moving. So its local initPos = 1236.6999511719, 2108.8999023438, 8.6000003814697 local finaPos = 1236.6999511719, 2108.8999023438, 3.0999999046326 function createTheGate() gate = createObject ( 980, 1236.6999511719, 2108.8999023438, 8.6000003814697, 0, 0, 270 ) end addEventHandler ("onResourceStart", getRootElement, createTheGate) function moveTheGate () if ( getElementPosition (gate) == initPos ) then moveObject ( gate, 5000, finaPos ) elseif ( getElementPosition (gate) == finaPos ) then moveObject ( gate, 5000, initPos) else outputChatBox ( "#ff0000 The gate is moving!", client ) end end addCommandHandler ("gate", moveTheGate)
  22. I had this script and the console outputs: SCRIPT ERROR: puertas\script.lua:32: 'end' expected near 'else' But I can't find the sintax error. Please help me: thisi s the code: local initPos = 1236.6999511719, 2108.8999023438, 8.6000003814697 local finaPos = 1236.6999511719, 2108.8999023438, 3.0999999046326 function createTheGate() gate = createObject ( 980, 1236.6999511719, 2108.8999023438, 8.6000003814697, 0, 0, 270 ) end addEventHandler ("onResourceStart", getRootElement, createTheGate) function moveTheGate () if ( getElementPosition (gate) == initPos ) then moveObject ( gate, 5000, finaPos ) end if ( getElementPosition (gate) == finaPos ) then moveObject ( gate, 5000, initPos) end else outputChatBox ( "#ff0000 The gate is moving!", client ) end end addCommandHandler ("gate", moveTheGate)
  23. Hi, i hardly try to do a script for this, but i'm not too good. This is mi question. Make that when somebody login onPlayerLogin(xxxxx) And if he is in the Gang if getElementData(player,"clan") ~= "FEAT" Then show his nick and account name in a Panel that only i can see with my account (user in server:elmatus) Then when he disconnects, get erased from the list. I be so happy if someone can help me with this.
  24. Ok im gonna use both, and try to modify the place of reproduce of mefisto's post. Thanks two of you
  25. I want to do the Beehive of Resident Evil,and inside of it do a hologram of the Red Queen. Like repodruce a video in a wall. Or if its no posible. Create a Ped who follows the player and talk
×
×
  • Create New...