myonlake
Members-
Posts
2,312 -
Joined
-
Days Won
40
Everything posted by myonlake
-
You reset the timer when pressing the kickme button. You have to execute the event manually by doing the following. kickme = guiCreateButton( 0.2, 0.52, 0.15, 0.05, "kick me", true ) cancel = guiCreateButton( 0.2, 0.60, 0.15, 0.05, "cancel", true ) kickTimer = setTimer( triggerServerEvent, 5000, 1, "kickPlayer", localPlayer ) addEventHandler( "onClientGUIClick", root, function( ) if ( source == kickme ) then triggerServerEvent( "kickPlayer", localPlayer ) elseif ( source == cancel ) then if ( isTimer( kickTimer ) then killTimer( kickTimer ) end end end, false )
-
Client-side triggerServerEvent( "kickPlayer", localPlayer ) Server-side addEvent( "kickPlayer", true ) addEventHandler( "kickPlayer", root, function( kicker ) if ( source ~= client ) then return end kickPlayer( client, ( ( isElement( kicker ) and getElementType( kicker ) == "player" ) and kicker or client ) ) end )
-
Like Wei said. https://github.com/Socialz/lua-mta-fairplay https://github.com/Socialz/mta-paradise viewtopic.php?f=108&t=40793
-
You didn't even post any code. You're welcome, lol.
-
Weird, try this then. dbExec( database, "INSERT INTO `ChatLogs` (Time, Username, IP, Serial, Message) VALUES ('?', '?', '?', '?', '?')", getRealTime( ).timestamp, getPlayerName( source ), getPlayerIP( source ), getPlayerSerial( source ), msg )
-
That's because you're not defining the values (the values are defined as column names in your script). Also, your ID doesn't work, because you haven't set it to AUTO_INCREMENT, it will always have ID 1, which makes no sense really. function logChat( msg ) outputChatBox( getPlayerName( source ) .. " has written this: " .. msg, root ) dbExec( database, "INSERT INTO `ChatLogs` (`Time`, `Username`, `IP`, `Serial`, `Message`) VALUES ('?', '?', '?', '?', '?')", getRealTime( ).timestamp, getPlayerName( source ), getPlayerIP( source ), getPlayerSerial( source ), msg ) end addEventHandler( "onPlayerChat", root, logChat ) Make sure you set the ID column to AUTO_INCREMENT and make it a PRIMARY KEY.
-
And make sure you have better than average designers to work with logos and design in general. If you don't know what each feature in Illustrator/Photoshop do, you should let some designer do it for you. And to get a bump on the server, I suggest you get all your friends and tell them to contact their friends and just spread the word around. Spreading a word is the best advertisement technique and to be honest all the ad topics in here just cause problems, rather than some good. And keep your server as unique as possible. Revamp everything you've seen before.
-
mysql_fetch_assoc returns a table, you have to use that table to return any string values, so, use the following. function checkForUsername( username ) handler = mysql_connect( "127.0.0.1", "root", "", "akrp_db" ) local result = mysql_query( handler, "SELECT USERNAME FROM `user_info` WHERE USERNAME = '" .. username .. "'" ) local res2 = mysql_fetch_assoc( result ) outputChatBox( res2.USERNAME ) end addEvent( "onCheckForUsername", true ) addEventHandler( "onCheckForUsername", root, checkForUsername )
-
Instead of printing an array, print the username string by typing "res2.USERNAME", which should work.
-
Great job!
-
Keep in mind that your MySQL query is vulnerable to SQL injections right now.
-
Yep. That will definitely work. NOT. But what do I know about multigamemodes anyway... Not like I haven't made three lobbies in my life.
-
You cannot have spaces like that. You have to do it this way to apply spaces. ["Limo Driver"] = { createVehicle( 416, 2036.0000000, -1426.9000200, 17.3000000, 0.0000000, 245, 245, 15 ), -- Ambulance createVehicle( 416, 2036.1999500, -1437.1999500, 17.6000000, 0.0000000, 245, 245, 15 ), -- Ambulance createVehicle( 416, 2018.5000000, -1409.9000200, 17.3000000, 272.2500000, 245, 245, 15 ), -- Ambulance createVehicle( 416, 1179.8000500, -1338.9000200, 14.1000000, 270.0000000, 245, 245, 15 ), -- Ambulance createVehicle( 416, 1179.1999500, -1309.4000200, 14.1000000, 270.0000000, 245, 245, 15 ) -- Ambulance },
-
@Hypex: I think it's obvious, that it's edited. But Bonsai says the following: Which is wrong, because all the race servers use the default race gamemode (some don't, because they wanted to revamp everything to correspond their own methods of making things), which obviously is edited. But the point is, you don't need to make your own, you just have to place enough stuff around to make it work with your own system. @Citizen: His example was just to show how easy it is to make one. The rest is simply just edits to the gamemodes so that they only fetch the players within that gamemode, which on the other hand is just dimension or element data or whatever you use to do that. It's nothing "complex", as mentioned above...
-
@Citizen: Indeed you could, but then again, I'd rather create a separate dxDraw resource and store all information in a table and fetch it from there whenever I need it. This way it's all almost native code and should work without issues with destroying and creating and setting. @Hypex: Umm, no. It's not hard at all to make it this way, and is way more practical than the CEGUI + shape method. @NOki: onClientClick has two mouse cursor parameters in it for absoluteX and absoluteY. Use that in combination with the size and position of the dxDraw shape like the following. if ( absoluteX >= startX ) and ( absoluteY >= startY ) and ( absoluteX <= boxWidth ) and ( absoluteY <= boxHeight ) then You should make a separate function for checking click and hover events. This way you don't always need to recalculate it.
-
That's not logical to me, because you create an element on top of a drawn shape, which is just a waste of memory when you can just condition the position of the mouse cursor and drawn shape. Making GUIs just to detect a couple events is not too practical at all. And not sure what you mean by "not completely true". I don't post to topics if I wouldn't know if it's true. I have a pretty long background in scripting so I think it's "true" to say you calculate whether or not was the click executed in between the positions. If you made your own game for example, you wouldn't necessarily have CEGUI to assist you in that, you'd have to just calculate and that's it.
-
I wouldn't call it complex at all. You can even make a system like that in five minutes or less depending on your needs. Simply put, you create a system that divides gamemodes into dimensions. If you want to use the default gamemodes in it, that's not a problem, you just have to check the player's gamemode and only trigger events and functions for those that are in that specific gamemode. There's nothing more to that really. @Bonsai: Well, since you're the expert - how did FFS got it to work with the default race script? Because they did, and there was no need to make their own.
-
Okay, well. First of all, DirectX shapes are not elements. This means you are not able to detect clicks on your defined "element", since dxDraw only returns a boolean. Use that onClientClick event to see if the click was executed inside the area of the button coordinates. So, if the cursor is between the startX and width, and between the startY and height, then do the click function and such.
-
Read this small Wiki article from the MTA Wiki: https://wiki.multitheftauto.com/wiki/Database, it also has the functions listed on it.
-
MySQL is a database infastructure. http://en.m.wikipedia.org/wiki/MySQL
-
It should work just fine.
-
There is an example for removing everything; https://wiki.multitheftauto.com/wiki/RemoveWorldModel.
-
There are no "functions" for scrolling. You just have to check when the client scrolls their mouse and then push the table keys forward or backward, so it shows it between a dynamic range that can be changed by scrolling, or by switching resolution.