-
Posts
1,193 -
Joined
-
Last visited
Everything posted by tosfera
-
Solidsnake is right, when a player dies, nothing happens. He keeps his/her weapons, skin, data, etc. You can still get all the weapons from a dead player. Once you spawn the player using spawnPlayer, s/he will lose her/his weapons. It depends on your script if the player also loses their skin or not. If you want to keep the weapons, save the weapons on the elementData, spawn the player, give all the weapons from the elementData, remove the elementData. You can do the same for the skin.
-
This is the support section, not the request section. If you're looking for any kind of support, you should at least give us something or tell us what you've been trying so far.
-
You can't just jump in here, request a lot of scripts and then run away again. This is the support section, you should write something yourself and come back here when ever you get stuck with writing it.
-
This is actually true, and with a bit of resource you would've been able to write it yourself too. Since we've never met before, take this as the first and only script you'll get from me without trying it first.
-
Just a small dxRectangle, or is the dxRectangle filling the entire screen?
-
addEventHandler ( "onClientProjectileCreation", root, function () local speedX, speedY, speedZ = getElementVelocity ( source ); setElementVelocity ( source, speedX * 2, speedY * 2, speedZ * 2 ); end ); This should increase the speed by 2.
-
The function spawnPlayer has an option to spawn with a skin. You can either use that or you can use setElementModel to the player's skin. If your script is not respawning the player right away, you might want to save the data into a table or as elementData. All you have to do is use setElementData to save the data and use getElementData to retrieve the old skin.
-
I've saved the default positions in a table, including their names to make it easier to get the right positions. Firing the function once, lowers down only the half of the vehicle. Firing it again, will make the vehicle's component reset. Even though the positions should be lowered with the amount depending on the default locations. This is seriously, one of the functions in MTA that blows my mind. -__-
-
I've been roaming with the script in the past night, couldn't get sleep anyway. The function is being called once, the position after the reset was twice my actual number, the position before the piece of code was unedited. So the vehicle was normal, not edited. The function is moving them down. ( all the answers regarding my code in the topic ) Currently, I've got what you told me to. Just made it myself a few hours ago. Strange thing now.. it's only moving my components up, even if I have a negative number. Also, some of the components were not saved in my table and didn't move down. But that's okay, just need to figure out why the hell it keeps going up. Thanks anyway!
-
use lua's string.rep function to repeat something. can be used like; dxDrawText ( string.rep ( "*", string.length ( self.edit.text ) ), ... This way, you don't have to save the password somewhere else for your authentication ( if it's a password ).
-
And why aren't you using ID's which would be auto increment? Those shouldn't change whenever you edit your data making these things really... impossible to occur. I've always had trouble with cascades and therefore wrote then scriptwise myself. Too bad that MTA takes a shitload of memory to do it scriptwise...
-
simple way to enable/disable the chat; local isDisabled = false; addEventHandler ( "onPlayerChat", root, function ( message, messageType ) if ( messageType == 0 ) then if ( isDisabled ) then if ( not hasObjectPermissionTo ( source, "function.banPlayer" ) ) then cancelEvent(); outputChatBox ( "The chat is currently disabled", source ); end elseif ( getPlayerTeam ( source ) and getTeamName ( getPlayerTeam ( source ) ) == "Spectators" ) then cancelEvent(); outputChatBox ( "You're not allowed to talk", source ); end end end ); addCommandHandler ( "cd", function ( thePlayer, cmd ) if ( hasObjectPermissionTo ( thePlayer, "function.banPlayer" ) ) then isDisabled = not isDisabled; outputChatBox ( "The chat has been ".. ( isDisabled and "disabled" or "enabled" ) .." by ".. getPlayerName ( thePlayer ) ); end end );
-
Always close your connection of SQLite when you're not using it anymore. If it's not doing it by default, then you should do it. Keeping your connection open to your SQLite database can prevent it from being changed/result into rollbacks. Since MTA is handling SQLite different than most platforms, you should avoid opening/closing your connection. The dbConnect does have an optional parameter which reads; autoreconnect which can be set to 0 or 1. (Default value "autoreconnect=1"). When set to 1, dropped connections will automatically be reconnected. Note that session variables, user variables, table locks and temporary tables will be reset because of the reconnection. So if you use these fancy features, you will need to turn autoreconnect off and cope with dropped connections some other way. source; https://wiki.multitheftauto.com/wiki/DbConnect
-
I'm currently working on a tuning store for my latest project, but the setVehicleComponentPosition is behaving... weird in my opinion. This is the case: I've got a match, a match takes 5 minutes. At the start of a match, every player will be spawned in their vehicle including upgrades and modifications regarding their components. The component data is being saved as vehicle:tune:height. This can be any value between -0.15 and 0.15(not important, it's a numeric value and that's what counts). As soon as the data of the vehicle changes, my onClientElementDataChange is being called. The trigger looks like this; addEventHandler ( "onClientElementDataChange", getRootElement(), function ( dataName ) if ( getElementType ( source ) == "vehicle" and dataName == "vehicle:tune:height" ) then for k in pairs ( getVehicleComponents ( source ) ) do resetVehicleComponentPosition ( source, k ); end if ( getElementData ( source, dataName ) ~= 0 ) then for k in pairs ( getVehicleComponents ( source ) ) do if ( k ~= "exhaust_ok" ) then local x, y, z = getVehicleComponentPosition ( source, k ); setVehicleComponentPosition ( source, k, x, y, z + getElementData ( source, dataName ) ); end end end end end ); As you can see, the first thing I'm doing is resetting the actual position of every component. Even the exhaust which I didn't change ( not important ). After that, if the new data isn't 0.. I'm increasing the Z-axis of all the components. The strange thing is, I'm in the server with 1 other guy ( also when I'm alone ) but it doubles my elementData in the client side. Don't get me wrong at this part, whenever I do; getElementData ( source, dataName ), it returns the right value. But the components of my vehicle are affected twice. Whenever I check the position of the components, they moved down twice. As an example; if I got the value ( on my elementData ) of -0.15, it lowers down all the components by -0.30. I've been trying to resolve the problem for at least 1 hours now but I can't seem to get it right. Any help will be greatly appreciated!
-
1062 is an sql error which states; Duplicate entry '#' for key '#' Make sure your 'id' is autoincrement, make sure your username isn't an unique value in your database. Better thing to do is query your database first to see if there is someone using that name already. If not, insert it.
-
A vehicle is shooting projectiles. These will also fill the 'weapon' parameter in onClientDamage by their own id's. You can use those to draw your image.
-
That's the thing I was saying, iiyama. Just create an exported function to retrieve all your images. (:
-
Creating a file like that is quite simple, you can use the location of the player to automatically set their language but if you prefer the step for players to select it themself then you should save the chosen language to their accountData. You'll be able to achieve this by using these functions: onPlayerLogin guiCreateWindow (styling start) guiCreateStaticImage guiCreateButton guiCreateLabel (styling end) onClientGUIClick setAccountData getAccountData For the chat, all you have to do is bind the L button to a new chatbox and when you're sending a message, loop over all the players and get their account data to match the language of the talking person. If they match, you can use outputChatBox to show the message to them. Good luck!
-
You can either use :resname/image.png or you can create an entire media system. That's what I'm always doing, the system will keep track of all your images and also draw them by using an exported function. Therefore you don't have to search for images in every resource if you want 2 different images. All you have to do, is call the exported function and... magic happens.
-
No body will help you to make your cloned server. I dont asked you Posting a question on a public forum means that you're asking anyone to reply. Even Bilal135. To get back on topic, you should edit your message and add a few checks to see what kind of vehicle the killer used depending on the 'weapon' parameter.
-
There is an easy way to solve that lag, well not really easy but it's a possible thing. Grab all the objects and import them into your 3D program. Attach them all to each other and export it as 1 big object. It might increase your download size a bit more but I'm not sure if it's more than replacing all of them as col and dff files. When it's 1 big object, your MTA won't have to load it all the time. this will give you another problem, if it turns out bigger than I'm expecting, the object might get out of reach for your streamer. You might want to increase your stream distance in that area to avoid it from happening. And if you're unable to do so, create 3 or 4 big objects out of Liberty. That should resolve your problem.
-
Even if you place them at another location? Also, try to enable the collision by code and as an object itself. Turn on the collisions with SetElementCollisionsEnabled.
-
Using the information Hornet gave you, you'll be able to draw the image yourself. To make sure that they are updated at the same time as you press the handbrake/reverse you can put them in your onClientRender just like your other drawn things for your vehicle's GUI ( if you have any ). To give you a small example, you can do something similar to this; addEventHandler ( "onClientRender", root, function () if ( isPedInVehicle ( localPlayer ) ) then if ( getControlState ( "handbrake" ) or getControlState ( "brake_reverse" ) ) then -- draw the red image else -- draw the white image end end end ); Since this will always run in the background, I would strongly advise you to only add the onClientRender when the player actually enters a vehicle and turn it off when he leaves it. function drawVehicleGUI () if ( getControlState ( "handbrake" ) or getControlState ( "brake_reverse" ) ) then -- draw the red image else -- draw the white image end end addEventHandler ( "onClientVehicleEnter", root, function ( thePlayer, seat ) if ( seat == 0 ) then addEventHandler ( "onClientRender", getRootElement(), drawVehicleGUI ); end end ); addEventHandler ( "onClientVehicleExit", root, function ( thePlayer, seat ) if ( seat == 0 ) then removeEventHandler ( "onClientRender", getRootElement(), drawVehicleGUI ); end end );