Jump to content

tosfera

Members
  • Posts

    1,193
  • Joined

  • Last visited

Everything posted by tosfera

  1. I've been scripting for a server that has an external database, it did cause some lag. For example, I wrote a turf system which loaded all of the turfs ( positions to capture ) out of an mysql, it had over 40 spots and did cause the well known 'network trouble'. I would strongly advise you to move your database to the same vps. If you want to keep it this way, you can just create your mysql connection with onResourceStart. When a play joins, use mysql_ping to see if the database is still connected, if not. Connect it again. This will cause lag. Because the database is not hosted at the same location, it first has to connect, retrieve data, send data back and receive the data. Which, in some cases, might take a while.
  2. It will always set you to 1. Why? Because when H is higher or equals to 100 ( even 400 is higher than 100 ),it'll make you level one. You have to make it like so; if ( tonumber ( h ) >= 100 and tonumber ( h ) <= 399 ) then
  3. tosfera

    [HELP]

    Good to know, use it wisely!
  4. tosfera

    [HELP]

    This is just a matter of calculations and simple dxDraws. This will be concerning the website! Lets first read what the wiki says about dxDrawText: Draws a string of text on the screen for one frame. In order for the text to stay visible continuously, you need to call this function with the same parameters on each frame update (see onClientRender). So, the text will be drawn every frame, to keep the display you have to use the eventhandler; onClientRender. So we'll basically start writing that; addEventHandler ( "onClientRender", root, function () end ); Now we have the render, we should display something. Let's see what parameters are required for the function; bool dxDrawText ( string text, float left, float top [, float right=left, float bottom=top, int color=white, float scale=1, mixed font="default", string alignX="left", string alignY="top", bool clip=false, bool wordBreak=false, bool postGUI=false, bool colorCoded=false, bool subPixelPositioning=false, float fRotation=0, float fRotationCenterX=0, float fRotationCenterY=0 ] ) The required ones are; Text, left, top. To get them nice on every screen, we'll also use; guiGetScreenSize() local x, y = guiGetScreenSize(); dxDrawText ( "My website!", x * 0.95, y * 0.99 ); This'll create a piece of text ( "My website!" ) at the positions of ( x * 0.95, means that it'll remove 0.05 of the users screen on the X axis ) and ( y * 0.99, same as the X but then at the Y axis. ). To make it visible, you should combine these two and make it like this; addEventHandler ( "onClientRender", root, function () local x, y = guiGetScreenSize(); dxDrawText ( "My website!", x * 0.95, y * 0.99 ); end ); That's basically how you do it.
  5. The files that are uploaded to the GIT are files concerning a Lua-decompiler. It'll decompile basically everything up to Lua 5. So ya, he is trying to decompile scripts. ~ Not sure, but isn't this against the rules? ~
  6. Why do you want to sort it? An easy way to do this is to use table.remove, it allows you to give an index and it'll shove up all the remaining elements. "table.remove removes an item from an array, shifting down any remaining integer keys" source: http://lua-users.org/wiki/TablesTutorial
  7. To transfer data from your database you can create the 'get' and 'set' functions which are a must in big projects. I'm also using this method, you can just create a resource that actually does this; -- onResourceStart -- execute your query -- load the queryData into an array. -- getPlayerData -- return the value from the array -- setPlayer data -- edit the value inside the array if you need some playerData in your vehicle system, you can just request it using the getPlayerData() in your other resource. on that way you don't have to use a million queries!
  8. Great work, someone from the team just has to do something against the user; 69482C240DAFC1F9059BEE9C0255B52
  9. easy, whenever you do addAccount, make sure you make all the characters lowercase. In that way they won't be able to register a name twice.
  10. guiSetEnabled ( guiElement, bool ); If you want to know how to see if someone is an administrator, use the following function; IsObjectInACLGroup
  11. Has it come to your attention that the entire code is out-commented because of this "--[["?
  12. Check if the player is an admin, if not then disable the button.
  13. It should only do that whenever your vehicle has been destroyed by a command, restarting a resource or with the default admin panel. If that's the case, the 'onClientVehicleExit' wont be triggered. You can solve it on another way if you like that; function speed ( player ) if ( player == localPlayer ) then removeEventHandler ( "onClientRender", root, draw ) addEventHandler ( "onClientRender", root, draw ) end end addEventHandler ( "onClientVehicleEnter", root, speed ) or do that.
  14. There are several ways to do this, you can also use MAX(). Another way you can do to make sure you get the last one ( if you don't trust MAX() or LAST_INSERT_ID() ) you can make a query that selects everything, or just the id and order it by ID, DESC ( descend ) and limit it with; limit 0,1. Another thing, mysql is a database, where your database is being stored. Quite an inception, and Database is being built by another database ( you can read all about it on the internet ). An auto_increment will never reset, the only actual way to do it is to set it yourself. You can either make it an int and make your own increment or select the last id and overwrite the empty id.
  15. local x, y = guiGetScreenSize(); dxDrawText ( "Harro people.", x * 0.95, 0, x , y * 0.05, tocolor ( 255, 255, 255, 255 ), 1, "default", "left", "center" );
  16. tosfera

    Car first?

    Read correctly, that will make it static, i dont think it will be able to move at all then.. Whoops, copied the wrong one. My bad, it should've been SetElementCollidableWith ^^".
  17. You should check if the forklift entered the marker where the box is in, if it's in there attach the box ( attachElements ) to your forklift, then set some elementData or add it in a table ( boxes [ vehicle ] = boxObj; ). Once it hits the delivery marker, check its data or the table and finish the job.
  18. calculate the distance ( which is pdistance ) and use that to do some magic math. ( with the width and the height of your image ).
  19. tosfera

    Car first?

    setElementCollisionsEnabled
  20. You can do it without the dxDrawText. If you want to go that way you should use guiLabelSetColor
  21. I can't find any typos in your script nor meta, maybe you should restart your server? I had problems like this too, restarting my server was the only thing that actually did the magic.
  22. tosfera

    Car first?

    Maybe a random guess, but what if you attach a colshape to vehicle B, and see if there are vehicles in it, and if so check its position?
  23. Hey guys, Currently I'm looking for a VPS which is located in The Netherlands, so people have a nice ping. For now it doesn't have to be a powerfull VPS, it has to hold around 15-25 players for now ( I do want to upgrade it later on, if I like the service ). Another thing that I'd like to have is access to the server, I've written a powerful script which is using alot of queries to save data, this can count up to only 5-10 queries even before a player spawned. Therefor I need a VPS which has the ability to access it through a remote desktop. I do prefer a windows server! Another thing I really look for is that I want it to be a bigger company. The script is quite some work and even though my scripts are compiled, I can't trust a starter yet ( sorry if I'd insult anyone right there ). If you know anyone that could offer me a vps or a dedi that meets my requirements ( also another requirement, I'm not allowed to pay over a hundred euros monthly. for now... ) please let him contact me with a PM on this forum, or let him send me an email to [email protected]. I'm thanking you in advance. - Tosfera edit1; I found out about OVH, currently getting my dedi there. Thanks everyone.
  24. Someone must be quite stupid to help you with leaked files... ( if I'm wrong, sorry for that but it looks like a vG edit ).
×
×
  • Create New...