myonlake
Members-
Posts
2,312 -
Joined
-
Days Won
40
Everything posted by myonlake
-
A timer within a timer? There's just one timer there, so just kill that. Make sure you pass theTimer as an argument to the timer function or your script won't be able to kill it.
-
There could also be special statements that allow them to access the full functionality of that code. I've seen quite many resources on other servers, which I have been working for and I can always find some if-statement that allow specific accounts to execute specific commands. But then when they "leave" the server or quit some dev/admin team they spam those backdoors and abuse everything. So that's what a backdoor is as well - leaving it out there for you to abuse later on. A backdoor can also be a simple bug. You notice a bug but leave it out there and then you abuse that bug yourself. I've seen those happen quite often as well.
-
And instead of editing your post with nothing else than you finding out the answer, you could have explained how you found it and what it is. So in order to do something like this you would use either fetchRemote or the PHP SDK tool, which you can find at the Wiki site. That first function is explained very well on the Wiki site as well as that SDK tool. EDIT: Or as madex suggested you may also use callRemote, which is pretty close to fetchRemote but has more extended functionality.
-
Let's start from finding out where is 'thePlayer' originating from and what does it return. Any errors?
-
I recall the allowRemoteTrigger parameter for addEvent was designed to avoid these type of situations. Set it to false and see if it works. If it doesn't work, the best way to avoid double-events is to name them after the resource such as Resource1:theEventName.
-
You must define the object a variable in order to move it later on. I doubt it is going to work this way, because you are creating these this way. You should place the objects in a table and create one function and command, then for-loop through all the objects and move them. for _,object in ipairs( Objects ) do local newObject = createObject( unpack( object ) ) addCommandHandler( "1", function( player, cmd ) moveObject( newObject, 100000, x, y, z + 10 ) end ) end So perhaps something like this could help you out: local objects = { } addEventHandler( "onResourceStart", resourceRoot, function( ) for i,data in ipairs( objects ) do local modelID, x, y, z = unpack( data ) objects[ i ].object = createObject( modelID, x, y, z ) end end ) addCommandHandler( "1", function( player, cmd ) for _,data in ipairs( objects ) do if ( data.object ) and ( isElement( data.object ) ) then local x, y, z = getElementPosition( data.object ) moveObject( data.object, 100000, x, y, z + 10 ) end end end )
-
Or then just download the MTA default resources. It's located in the gps resource.
-
And why is that? Any errors? I don't see why it wouldn't work. Make sure you use the code server-side.
-
You are welcome.
-
You are welcome.
-
Unfortunately I doubt that is possible at the moment. You could of course always do the worst possible thing and go through all possible pixel targets on the screen and perform processLineOfSight for those, but that's the worst possible thing to do, so no. The way you could do something like that in MTA is to process all the possible light elements with shaders - if the intensity of this pixel is higher than something, then perform something cool for that. However, lights are not rendered that far so it would become a problem for shaders to know all that. So, I doubt you can (unless you get a team of people to create markers for each lamp post in San Andreas, that's also a way...) I doubt it would be a major hyper extreme hard thing for the MTA team to develop a function to get all world objects of a specific model, so instead of going through all that trouble making markers for each lamp post I'd just wait until they add support for that.
-
That's a good start, gladly I had some spare time to make you something useful. To perform this with tables local playerWeapons = { } function getAllWeapons( element ) if ( not isElement( element ) ) or ( getElementType( element ) ~= "ped" and getElementType( element ) ~= "player" ) then return end local weapons = { } for i=0,12 do local slotWeapon, slotAmmo = getPedWeapon( element, i ), getPedTotalAmmo( element, i ) if ( slotWeapon > 0 ) and ( slotAmmo > 0 ) then weapons[ i ] = { weaponID = slotWeapon, ammo = slotAmmo, currentSlot = getPedWeaponSlot( element ) == i or false } end end return weapons end addEventHandler( "onPlayerWasted", root, function( ) local weapons = getAllWeapons( source ) if ( weapons ) then playerWeapons[ source ] = weapons end end ) addEventHandler( "onPlayerSpawn", root, function( ) local weapons = playerWeapons[ source ] if ( not weapons ) then return end for slot,data in pairs( weapons ) do giveWeapon( source, data.weaponID, data.ammo, data.currentSlot ) end outputChatBox( "Your weapons were restored from your death.", source, 20, 245, 20, false ) end ) To perform this with element data function getAllWeapons( element ) if ( not isElement( element ) ) or ( getElementType( element ) ~= "ped" and getElementType( element ) ~= "player" ) then return end local weapons = { } for i=0,12 do local slotWeapon, slotAmmo = getPedWeapon( element, i ), getPedTotalAmmo( element, i ) if ( slotWeapon > 0 ) and ( slotAmmo > 0 ) then weapons[ i ] = { weaponID = slotWeapon, ammo = slotAmmo, currentSlot = getPedWeaponSlot( element ) == i or false } end end return weapons end addEventHandler( "onPlayerWasted", root, function( ) local weapons = getAllWeapons( source ) if ( weapons ) then setElementData( source, "player:restore.weapons", weapons, false ) end end ) addEventHandler( "onPlayerSpawn", root, function( ) local weapons = getElementData( source, "player:restore.weapons" ) or nil if ( not weapons ) then return end for slot,data in pairs( weapons ) do giveWeapon( source, data.weaponID, data.ammo, data.currentSlot ) end removeElementData( source, "player:restore.weapons" ) outputChatBox( "Your weapons were restored from your death.", source, 20, 245, 20, false ) end )
-
Nice job. I suggest making your own 3D camera system for this one, especially for the sake of first-person. Very nice job.
-
You cannot target a vehicle like that. You must create your own 3D camera in order to be able to do that. However, if you want a fixed position, then use the vehicle position as the third, fourth and fifth arguments. addEventHandler( "onClientPreRender", root, function( ) local x, y, z = getElementPosition( vehicle ) setCameraMatrix( x + 8, y + 8, z + 5, x, y, z ) end ) If you really want to move a vehicle like that then create an invisible object and attach the vehicle to the object. Then move the object. If you want to make it look realistic, then use control states in combination with a ped inside the vehicle as a controller. P.S. My GitHub page has a custom 3D camera system, feel free to use that as well.
-
You are not able to create your own, absolutely new vehicle in MTA yet. If someone suggests objects, don't go for that, because you will face quite a bunch of problems with synchronization and other stuff. You have to wait until they add that.
-
Look at the Wiki. Search for dxDrawText. Problem solved.
-
There is a reason for MTA having a Wiki site: https://wiki.multitheftauto.com/wiki/Server_Manual.
-
Suggestion For Friends Menu Custom ped.ifp
myonlake replied to xXSimonGhostxX's topic in Suggestions
There is a reason why there are tools for chatting with friends, like Skype, Steam, this forum, server forums, or whatever. Yet another integrated chat/account in MTA? Waste of time and really stupid in my opinion. If you wanted to have friends then share your email addresses between each other. Don't be so lazy. -
Maybe look at WASSIM's link above then..? That has all the functions listed in it.
-
Can you show me your code, please (the one where you create the vehicles).
-
That is also an option. Pretty much depends on the usage and needs - but he will need onClientKey eventually since if he wants to be able to delete characters.
-
Try the following. If it does not work, then switch resourceRoot to root. addEventHandler( "onPlayerCommand", resourceRoot, function( cmd ) local playerAccount = getPlayerAccount( source ) local shouldCancel = ( playerAccount and not isGuestAccount( playerAccount ) and getAccountData( playerAccount, "jail-time" ) ) and tonumber( getAccountData( playerAccount, "jail-time" ) ) > 0 or isElementFrozen( source ) if ( shouldCancel ) then cancelEvent( ) end end )
-
Replace that old aSetPlayerFrozen with this one. function aSetPlayerFrozen( player, state ) if ( toggleAllControls( player, not state, true, false ) ) then aPlayers[ player ][ "freeze" ] = state setElementFrozen( player, state ) local vehicle = getPedOccupiedVehicle( player ) if ( vehicle ) then setElementFrozen( vehicle, state ) end triggerEvent( "onPlayerFreeze", player, state ) return true end return false end
-
Put the addEventHandler after the rest of the code inside the for-loop (like shown in my code, pretty much).
-
You forgot apostrophes around the kick reason. Also, your event handler is incorrectly written. It takes in three arguments (event name, event source and handler function). You also have to loop through all players in order to check pings like that. You also forgot the second argument from the outputChatBox function (the target element(s), which is root for now). function checkPing( ) for _,player in ipairs( getElementsByType( "player" ) ) do local ping = getPlayerPing( player ) if ( ping > 200 ) then kickPlayer( player, "High ping (" .. ping .. ">200)" ) outputChatBox( getPlayerName( player ) .. " was kicked for high ping (" .. ping .. ">200)", root, 255, 255, 0 ) end end end addEventHandler( "onResourceStart", resourceRoot, checkPing )