Jump to content

pbradjan1994

Members
  • Posts

    10
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

pbradjan1994's Achievements

Member

Member (5/54)

0

Reputation

  1. Thanks a lot for your help, I'll try what you suggested, and I hope I'm gonna create what I need. ?
  2. It's not inside of the scripts, so you might be right, it could be a custom event somewhere, I'll take a look. Thanks a lot! Can you help me with one more thing, and I won't bother you anymore, I promise ? Is there any script, actually a resource, that can enable collisions for all vehicles in all maps. Because I tried everything, and I just can't find where to change that in this resource, that is actually a multi gamemode, so if I can somehow override that with another resource? And can you recommend me, a good script for private message system, that uses the format /pm id, instead of /pm nick, and output in the chatbox whom I sent the message and what I wrote, and of course, when I receive a message, who is the sender, and the message itself. I need to find that, and a resource that will show players a chat balloon when someone is typing, not the actual message, just a chat balloon on top of the player, so that other players know when someone is typing. I found some, but they are not good at all. That is what I need to find, and I am pretty much done with the server! So I would appreciate if you could send me some good resources. And again, thanks for the help so far!
  3. Thanks a lot for your help, I tried to put a dash, but then I got some other error, but never mind, that line of code is just for setting the time, but since I am setting the time in every map, I don't really need this line ? so I removed it, and everything is working fine now. But I have another question, do you know what is a requestLODsClient event? I can't find any information about it. I get this error sometimes: ERROR: Client triggered serverside event requestLODsClient, but event is not added serverside It's not my script, I downloaded it and I am trying to make it work. It does work actually, but sometimes I get these errors in the console, which do not affect the game, but I would like to fix them if possible. ?
  4. Hello everyone, Can someone help me with this problem, this is the line in my server.Lua resource called tr-lobby: local realtime = tonumber(string.sub(get("#"..resName..".time"),1,2)) or 0; And when I start the server, I get this error: ERROR: tr-lobby\server.Lua:246: bad argument #1 to 'sub' (string expected, got boolean) If anyone can tell me how the code should look like, because I am not really a good scripter. Alse to mention that when I restart the resource two times, I don't get the error anymore. Thanks in advance!
  5. How can I disable collision for projectiles, created with createProjectile function, I tried everything, but no success, this is the line that creates a projectile. it's a shooter minigame, so the car is shooting projectiles/rockets: createProjectile(theVehicle, 19, x, y, z, 1.0, nil) And the line for ghostmode in meta.xml file: <setting name="#ghostmode" value='[ &quot;false&quot; ]' /> Here are a few options I've tried, with no success, so maybe someone knows what's the problem? Solution 1: function projectileGhost () local projType = getProjectileType(source) local objects = getElementsByType("object") for i, v in ipairs(objects) do setElementCollidableWith(source, v, false) end end addEventHandler( "onClientProjectileCreation", getRootElement(), projectileGhost) Solution 2: function projectileGhost () local projType = getProjectileType(source) setElementCollisionsEnabled(source, false) end addEventHandler( "onClientProjectileCreation", getRootElement(), projectileGhost) Solution 3: function projectileGhost () local projectiles = getElementsByType("projectile") for i, v in ipairs(projectiles) do setElementCollisionsEnabled(v, false) end end addEventHandler( "onClientProjectileCreation", getRootElement(), projectileGhost) I have also tried to disable collision for objects, and that works, the rockets then go through the wall, ground, buildings... Exactly what I need, but so does the car, and yes I've tried to enable collision just for the vehicles, after disabling it for objects, but that doesn't work either. Here is the script for disabling collision for objects, that works: function projectileGhost () local objects = getElementsByType("object") for i, v in ipairs(objects) do setElementCollisionsEnabled(v, false) end end addEventHandler( "onClientProjectileCreation", getRootElement(), projectileGhost) I really need to figure this small problem that's bothering me for days, so please if anyone knows the solution, let me know?
  6. Can you help me with this code: local objects = getElementsByType("object") for i, v in ipairs(objects) do setElementCollisionsEnabled(v, false) end This code works, it disables collisions with all objects, including rockets, so rockets go through walls, ground, buildings... But so does the player's car, so I tried to enable the collisions for vehicles only, after this code, but it doesn't work. I also tried to write a better code, to disable collisions just for projectiles, like this: local projectiles = getElementsByType("projectile") for i, v in ipairs(projectiles) do setElementCollisionsEnabled(v, false) end But nothing happens, I don't know why, so I was hoping that maybe you or anyone else can help me figure it out?
  7. Unfortunately, it's not working, I tried to put your code inside and also outsideof the "if" statement, , but nothing happens. I need the part with the if statement, because I am changing the projectile velocity and counter, and that is working perfectly. I just can't figure out how to disable collisions. Does it matter if the collisions for the map are set ENABLED, I mean in meta.xml (<setting name="#ghostmode" value='[ &quot;false&quot; ]' />)? But thanks anyway!
  8. I tried something like this, but it is not working. Can you tell me where I am wrong? function projectileGhost ( ) local projType = getProjectileType( source ) if projType == 19 then local objects = getElementsByType("object") setElementCollidableWith(projType, objects, false) end end addEventHandler( "onClientProjectileCreation", getRootElement(), projectileGhost )
  9. How can I set the projectile (id 19 - rocket) to not collide with the buildings, ground...? I have a shooter minigame, the car shoots rockets, and I want the rockets to only collide with another cars (hit the cars), which functions do I need to use?
  10. Hello everyone, I am new here, and also new to MTA scripting, so I was hoping that maybe some experienced scripters can help me with a small problem that I have. I have a shoot.Lua script, that is used for [SHOOTER] gamemode/minigame, the script allows the cars to shoot rockets, and it is working ok, but I want to modify it a little, so that the rockets go faster and travel less distance, and also if it is possible to make the rockets go through objects (walls, ground...), and only hit and make damage to the cars (other players)? I am including a video, so that you can see what I am trying to achieve, the first part of the video is from a SAMP server (faster rockets, less distance), and the second part is from MTA shoot.Lua script. The link to the video is: https://drive.google.com/file/d/1fhX6LXNca_ArJwfzhv9gwRL9N6jWDSma/view And the code from shoot.Lua: cLP = getLocalPlayer() screenWidth, screenHeight = guiGetScreenSize() function cRStest() setTimer(resourcesCheck, 10000, 1) end addEventHandler("onClientResourceStart", getRootElement(), cRStest) function resourcesCheck() if check=="done" then return else setTimer(cbinds, 1000, 1) textToggle=0 check="done" end end function cRS() if check=="done" then return else setTimer(cbinds, 3333, 1) textToggle=0 check="done" end end addEventHandler("onClientPlayerSpawn", getLocalPlayer(), cRS) function markers(player) if isPedInVehicle(player) then local vehicle = getPedOccupiedVehicle(player) fixVehicle(vehicle) end end addEventHandler("onClientMarkerHit", getResourceRootElement(getThisResource()), markers) function cbinds() local keys1 = getBoundKeys("vehicle_fire") local keys2 = getBoundKeys("vehicle_secondary_fire") if keys1 then for keyName, state in pairs(keys1) do bindKey(keyName, "down", cdoshoot) end bindKey("F", "down", cdoshoot) cbindsText = "- Press F or the button you use to fire to shoot rockets!\n- You can shoot once every 3 seconds.\n- good luck and have fun!." end if keys2 then for keyName, state in pairs(keys2) do bindKey(keyName, "down", cdoshoot) end end if (not keys1) and (not keys2) then bindKey("F", "down", cdoshoot) bindKey("lctrl", "down", cdoshoot) bindKey("rctrl", "down", cdoshoot) cbindsText = "- Press F or CTRL to shoot rockets!\n- You can shoot once every 3 seconds." end theVehicle = getPedOccupiedVehicle(cLP) allowShoots() bindKey("K", "down", toggleText) outputChatBox("#FF3366Press K to show/hide instructions", 255, 255, 255, true) end function toggleText() if textToggle==0 then addEventHandler("onClientRender", getRootElement(), bindsText) textToggle=1 elseif textToggle==1 then removeEventHandler("onClientRender", getRootElement(), bindsText) textToggle=0 end end function allowShoots() bindTrigger = 1 end function cdoshoot() if bindTrigger == 1 then if not isPedDead(cLP) then bindTrigger = 0 local x,y,z = getElementPosition(theVehicle) local rX,rY,rZ = getElementRotation(theVehicle) local x = x+4*math.cos(math.rad(rZ+90)) local y = y+4*math.sin(math.rad(rZ+90)) createProjectile(theVehicle, 19, x, y, z, 1.0, nil) setTimer(allowShoots, 3000, 1) end end end function bindsText() dxDrawText(cbindsText, screenWidth/15, screenHeight/2.5, screenWidth, screenHeight, tocolor(0, 149, 254, 255), 0.75, "bankgothic") end Thanks in advance to everyone!
×
×
  • Create New...