-
Posts
2,947 -
Joined
-
Last visited
Everything posted by JR10
-
Your timer is set to execute each minutes, yet to increase the seconds.
-
When looping through the vehicles, you should make sure that they're empty. if (not isElement(getVehicleController(vehicle)) then -- The vehicle is empty, make it damage proof
-
Check the code again, onPedWasted provides you with the killer and his weapon, 'weapon' there is the killer's weapon.
-
You shouldn't create the elements on each click. You should create it once and use guiSetVisible to show/hide it.
-
Lua is not an object-oriented language as it doesn't have a built-in implementation of classes, still, it is easily possible to create your own class system using tables and metatables, it has been done several times before and a lot of scripters have been using OOP before MTA implemented it. And OOP only in C++? Sure...
-
Now I get it, okay, here's the code for that: addEventHandler("onPedWasted", root, function(ammo, killer, weapon) if (weapon == 0) then return end local x,y,z = getElementPosition(source) local pickup = createPickup(x, y, z, 2, weapon, 0, getPedTotalAmmo(killer) or 300) addEventHandler("onPickupHit", pickup, destroyElement) -- destroy the pickup on hit end) Now, you probably will need to edit it to suit your needs. Do you want to detect players being killed or peds? If you want players, change onPedWasted to onPlayerWasted. You might want to edit the ammo argument as well.
-
Possibly the stupidest statement I've heard in years.
-
addEventHandler("onPlayerWasted", root, function() outputDebugString(tostring(getPedWeapon(source))) end)
-
Check this out: https://wiki.multitheftauto.com/wiki/Handling.cfg There is instructions on how to load a custom handling.cfg, you can also edit it so that it converts your line into several setVehicleHandling funcitons. My bad, I should have suggested it first.
-
This might help: http://www.gtamodding.com/wiki/Handling ... an_Andreas
-
Are you sure you enabled OOP in meta.xml? Such errors occur because the script can't find the meta table of the classes, which probably means you didn't enable OOP. Add in meta.xml: <oop>true</oop>
-
You can use setVehicleHandling on theVehicle[hitElement] just below createVehicle. setVehicleHandling
-
If 'player' is actually a player holding a weapon then it should return the weapon id, just tested it myself actually. EDIT: Just tested onPlayerWasted as well, using getPedWeapon on the player who just died works just fine.
-
This gets the current weapon in the player's hand: getPedWeapon(player) If it's onPlayerWasted event, then you can use source instead of player. Now note this, I'm not really sure if the player still carries his weapon after he dies (and before he respawns), so I guess you will have to test
-
You don't need to handle onPickupHit yourself, when you create a pickup of type 2, it automatically gives the ped a weapon when he hits it. You might only use onPickupHit to destroy the pickup when it's hit. So, you don't really need the element data. You need to specify the ammo argument, so that it gives the ped the correct amount of ammo. I told you to post your code because you're using client, which only refers to the local player who triggered the event, unless you defined client yourself or you used triggerServerEvent, it won't work.
-
You need to specify the amount of ammo to give to the player. Also, you should post your full code, we don't know if you're correctly using client or not. And why are you using element data?
-
You could have posted this in your other topic. This is a wrong way to ask for help in this forum. Read this: viewtopic.php?f=91&t=47897
-
You need to store the pickup in a variable, then use that variable in setElementData. You can then use setTimer along with destroyElement after 15 seconds. local pickup = createPickup(x1, y1, z, 3, 1212) setElementData(pickup, "amount1", math.random( 1, 25 ) ); setTimer(function() if (isElement(pickup)) then destroyElement(pickup) end end, 15000, 1)
-
This is not a forum for requests. Please read this: viewtopic.php?f=91&t=47897 A simple save system can be made with getAccount getAccountData setAccountData getPlayerWantedLevel setPlayerWantedLevel
-
I remember asking the same question, a simple search and I found an old topic with the answer: viewtopic.php?f=104&t=27343&p=308246&hilit=github#p308243 For me, Git is much much much better than SVN, in every possible way. With a good workflow, it makes version control and collaboration much easier.
-
You should publish the weather php file along with the resource. This way, they won't have to rely on your website. Also, it would be much more useful if you could somehow incorporate the real weather with GTA's.
-
fileGetSize bad argument, expected scriptfile, got string
JR10 replied to BlueTheFurry's topic in Scripting
fileGetSize takes in a file userdata variable, not a string. You need to use fileOpen first. local theFile = fileOpen("test.dff") fzb = fileGetSize(theFile) local fz = fzb/1024 -
The code doesn't make sense. You're drawing an image with the size of the screen, so that might be the reason why it's black. Another cause might be that you don't use fadeCamera when the player joins/spawns. Also, why are you removing the event handler for each player element in the server? This won't remove it for each player, this will just remove it several times for the same client. If you couldn't resolve it still, post your spawn code.