-
Posts
2,947 -
Joined
-
Last visited
Everything posted by JR10
-
The first argument of the function is the player who typed the command, why did you make another argument for it. There is a global argument called 'resource' it points to the current resource where the script is a part of. function (player,cmd,numbermax) if ( hasObjectPermissionTo ( player, "command.zsetmax", false ) ) then if ( hasObjectPermissionTo ( resource, "command.zsetmax", true ) ) then if not tonumber(numbermax) then return end setMaxPlayers(tonumber (numbermax)) local maxPlayers = getMaxPlayers() outputChatBox("#00FFFF* #FFB900Server max. slots changed to: #FFFFFF" .. maxPlayers .." #00FFFFof #FFFF001024 #00ffffmax.", getRootElement(),255,255,255,true) else outputChatBox ( "zsetmaxplayers: The script isn't added on Admin acl group. Please, add it.", playerSource ) end else outputChatBox ( "zsetmaxplayers: Not enought rights.", playerSource ) end end addCommandHandler ("zsetmaxplayers", )
-
Not just one gamemode that's all I can say. Different ones, like start with freeroam then stealth then race.
-
I will explain the new db functions. dbConnect So you must use dbConnect, to open a connection with the database (the .db file) which you can later use with dbQuery to execute a query. dbConnect connects to a .db file, or create it if it doesn't exist. The path can be the resource, another resource or the global databases folder. Ex: --In the same resource local connection = dbConnect ( "sqlite" , "newDB.db" ) --Another resource local connection = dbConnect ( "sqlite" , ":resourceName/newDB.db" ) --Global databases folder local connection = dbConnect ( "sqlite" , ":/newDB.db" ) And later you will use the variable connection with dbQuery. You can destroy the connection with destroyElement. dbQuery You use dbQuery to execute a query and it returns a query handler which can be used with dbPoll to get the result, or dbFree if you don't want it at all. You can also use dbExec If you want to execute a query and you don't want a result. Ex: The example is a continue to the above example. local queryHandle = dbQuery ( connection , "SELECT * FROM someTable" ) --Another example local queryHandle = dbQuery ( connection , "CREATE TABLE IF NOT EXISTS someTable (column1 TEXT,column2 TEXT)" ) --Another example local queryHandle = dbQuery ( connection , "INSERT INTO someTable (column1,column2) VALUES (?,?)", "text" , "text2" ) The question mark can be used to insert a value as an argument, without having to quote it or anything, I use them personally. If you don't know what to type in the query, look in the old sqlite functions wiki page for examples. dbPoll When you use dbQuery it returns a query handle, in order to get the result you have to use dbPoll. Ex: --Without timeout setting. local queryResult = dbPoll ( queryHandle , -1 ) --With timeout setting. local queryResult = dbPoll ( queryHandle , 10 ) The second argument: dbFree just frees the result no more explaining needed. You might need this: viewtopic.php?f=91&t=34941&hilit=+sqlite#p362581.
-
I uploaded a new version, fixing the /business problem. If you found more bugs, you can report them here. Sorry I'm not making more updates, I'm just busy these days.
-
This is wrong, the file path can be the global folder for databases or the resource or any other resource. If I'm right you can't connect to internal.db or registry.db. Make a new .db. Also where did 'results' variable come from, it's not defined in your code. And you must specify the connection in dbQuery. addEventHandler( "onResourceStop", resourceRoot, function( ) local server = dbConnect( "sqlite", ":/myDB.db" ) for key, value in pairs( results ) do dbFree ( dbQuery( server , value.r ) ) outputDebugString( "Query not free()'d: " .. value.q, 2 ) end end ) It's also recommended that you connect to the database on start. Not connect each time.
-
I will try to be there.
-
I've been told it works with resources. Well, never mind. Thanks.
-
MTADiag - diagnostic tool for MTA:SA & Support section information
JR10 replied to Towncivilian's question in Client
Great work, will for sure help a lot of people.- 58 replies
-
- mtadiag
- mta support
- (and 7 more)
-
Voted and posted in our forum. Good luck.
-
Use a program to lock the folder, lol.
-
It's not working, I have 1 in my mtaserver.conf. And still, the client scripts are downloaded and I found them in my downloaded resources, can be viewed and modified. I downloaded the last nightly, 'mtasa-1.2-unstable-3526-20111209-net41C9.exe'. Thanks.
-
Well I did not know. You didn't know it wasn't yours?
-
fileDelete at the very end, not onClientResourceStart. Didn't work for me, gets deleted when downloaded fully, but if you quit while downloading, not deleted.
-
I think I should say it. Can't believe it but, congratz. There you go.
-
onClientResourceStart is an event, it's not a function, even in a client sided script. function morte () local x, y, z = getElementPosition ( source) creaPezzi ( x, y, z ) end addEventHandler ( "onPlayerWasted", root,morte ) function creaPezzi(x, y, z) local obj = { } obj[1]=createObject ( 2905, x, y, z ) obj[2]=createObject ( 2906, x, y, z ) obj[3]=createObject ( 2907, x, y, z ) obj[4]=createObject ( 2908, x, y, z ) setTimer(function(objects) for index,object in ipairs(objects) do destroyElement ( object ) end end, 3000 , 1 , obj ) end
-
You're using getLocalPlayer in a server sided script. onClientResourceStart function doesn't exist. Also onPlayerWasted second argument should be 'root' variable or 'getRootElement' function. function morte () local x, y, z = getElementPosition ( source) creaPezzi ( x, y, z ) end addEventHandler ( "onPlayerWasted", root,morte ) function creaPezzi(x, y, z) createObject ( 2905, x, y, z ) createObject ( 2906, x, y, z ) createObject ( 2907, x, y, z ) createObject ( 2908, x, y, z ) end One more thing, why setTimer?
-
You can change it in binds settings. You can't change for all I think.