Leaderboard
Popular Content
Showing content with the highest reputation on 31/10/17 in all areas
-
Lets start with the basics example -- < this is a variable thisPlayer -- < this too hi -- < and this, etc. First of all, variables CAN CONTAIN any value. The name does not define what value it contains, unless it is predefined. So the variable thePlayer does not have to contain a player value. It can be anything, it is just a name where you can assign a value to. example = "nice" -- it can contain a string example = false -- or a boolean example = 12345 -- or a number example = {} -- a table -- and more! Here you have a list with predefined variables: This is the list of the predefined variables from MTA(written down by Kenix) Those variables contain the values that are declared before your script is loaded. Yet some of them do only contain values under special conditions. You can find those conditions in the comments behind the variables. SO PLEASE, there is NO thePlayer. It does not exist by itself. Now to get back to your issue. There is a predefined variable localPlayer, please check the list again. It is YOU and your adorable ped element. (clientside only) If we visit this page: https://wiki.multitheftauto.com/wiki/TriggerServerEvent You can see the required arguments: Required Arguments event: The name of the event to trigger server-side. You should register this event with addEvent and add at least one event handler using addEventHandler. theElement: The element that is the source of the event. The event: "takeCash" And the source element: resourceRoot The source element is a predefined variable, which will be come active after triggering an addEventHandler. function takeCashHandler ( thePlayer, amount ) iprint(source) -- resourceRoot end `source` is NOT a parameter. Parameters are the variables that be found here: takeCashHandler (<parameter>, <AND parameter>, <ETC.>) The special thing about parameters is that they contain the values that are given from the place where the function is called from. (see example below) For the ones that are using the `source` as parameter, they are not consistent and will confuse other people if they share their code. Using source as parameter will overwrite it's value if already set. If I call your function with a normal call, it would looks like this: function takeCashHandler ( thePlayer, amount ) takePlayerMoney ( thePlayer, tonumber(amount) ) end local randomPlayer = getRandomPlayer() takeCashHandler (randomPlayer , 2 ) -- calling the function takeCashHandler The first parameter receives the first value <just a random player in the server>. The second parameter receives the second number value 2. Order matters, name does NOT! In this code we give two parameters a value. The value of the predefined variable `localPlayer` and a number value 2. -- Client side triggerServerEvent ( "takeCash", resourceRoot, localPlayer, 2 ) -- takes $2 of the player -- Server side function takeCashHandler ( thePlayer, amount ) takePlayerMoney ( thePlayer, tonumber(amount) ) end addEvent( "takeCash", true ) addEventHandler( "takeCash", resourceRoot, takeCashHandler ) There is also the predefined variable `client` which you could use. Which represents the player (element) that has called the server. But only is defined when an addEventHandler exist and has been used.2 points
-
function sqlQuery(query, ...) iprint(connection, query, ...) -- < iprint here return dbQuery(connection, query, ...) end -- do the original query function, if something goes wrong then it is not a problem with your utility function. local qh = dbQuery(connection, "INSERT INTO test (asd1, asd2) VALUES (?, ?)", "asd1 original", "asd2 original") dbFree ( qh ) -- do yours. local Query = sqlQuery ("INSERT INTO test (asd1, asd2) VALUES (?, ?)", "asd1", "asd2") dbFree ( Query ) if Query then outputServerLog ("true") else outputServerLog ("false") end1 point
-
1 point
-
test it first with the default function. If that is OK. Then debug the arguments. iprint(connection, query, ...)1 point
-
_dbQuery = dbQuery function dbQuery(query, ...) return _dbQuery(connection, query, ...) end Basis from quindo. If you want to fill in multiple values.1 point
-
connection = dbConnect( "mysql", "dbname="..mySQLDetails["db"]..";host="..mySQLDetails["host"].."", ""..mySQLDetails["acc"].."", ""..mySQLDetails["pass"].."", "share=1" ) _dbQuery = dbQuery function dbQuery(query, values) return _dbQuery(connection,query,values) end1 point
-
Hello. Scince one year I want to publish this smartphone here. There is awesome smart with some base functions, what appeared in previous version. But customizing in settings now removed to make system style more interesting and minimalistic. Also removed lockscreen, because it was useless. What can you do basically with this phone? - Chatting with another players on the server, and send them stickers - Listen music by URL or your local, and switch timeline of the track (progressbar clickable) - Calculate something. Now calculator has history of calculations. - With application "Passport" you can see some information about you. Created for RP modes, but I dont know nothing about RP, and created it just for fun. - In settings you can change desktop image, change System Language [NEW], and read information about developers. - When phone updating, admins can check for updates phone on the air in system settings. Its available in "About" menu, on bottom of app - green text with current version as build. Of course, this resource has API for developers. With it you can: - Create your own applications for phone - Edit some phone settings - Add your own stickers for messenger - Add your own desktop images (276x445px) - Add your own system translations. In file "language.lua" you can find example and there you can add in table your prefered languages. - Manage notifications and etc. There are some pictures of system: Download: GitHub I would like to apologize about my code. Sometimes this is not readable, because it was written about year ago, when I was at school . I wont to optimize this working code, bcs I'm too lazy New Video: Demo (2016): Functions, what you can use to modify your system:1 point
-
Serverside is running on the 'server' computer and clientside is running on the pc you use to play mta. If you use a local server. They both run on the same computer but in a different environment. Summary Serverside = server computer (or on your game pc in a different environment) Clientside = game pc They play their own roll and have to communicate between each other, in order to move information from one computer to another. The rest speaks for itself.1 point
-
1 point
-
@IIYAMA, I already make so many xD, I will make it, and if there some bugs I'll notice but I want when the player downloading and when it finish I use triggerEvent onClientDownloadFinish when the player finish .downloading it backs to normal hospital system, the example you gave me is for all time.1 point
-
1 point
-
Okay thank you I vll start now if got any error vll report u again !!1 point
-
سويت لك يوسفل تستفيد منه local Groups = { "Admin" , "Console" } function isPlayerInGroup ( player ) if ( player and getElementType ( player ) == "player" ) then local playerAccount = getPlayerAccount ( player ) if isGuestAccount ( playerAccount ) then return false end for _ ,v in ipairs ( Groups ) do if aclGetGroup ( v ) then if isObjectInACLGroup ( "user."..getAccountName ( playerAccount ), aclGetGroup ( v ) ) then return true end end end end return false end طبعا حط القروبات في الجدول وهذا مثال ع الاستخدام local player = getRandomPlayer ( ) if ( isPlayerInGroup ( player ) ) then outputChatBox ( "You're Admin" , player ) else outputChatBox ( "You're not Admin" , player ) end الغلط بكودك انه لو الاعب كان بالقروب الاول راح يرسل ترايقر ولو ماكان بالقروب الثاني راح تجيه رسالة والغلط الاساسي ان القروب الي تبي تتحقق ان الاعب فيه ماهو موجود1 point
-
Just add two new ones, for serverside and clientside. Or more if you want per functionality a file.1 point
-
Nice concepts, now please start coding your first attempts.1 point
-
use https://wiki.multitheftauto.com/wiki/GuiGridListGetItemText instead of guiGridListGetItemData1 point
-
Yo solo te digo que después de casi 5 años en MTA como mucho eh usado el while 2 - 3 veces1 point
-
I kinda disagree. A good original game is about atmosphere, story and overall feel. Has little to do with the code base behind it. You can bend existing code to serve your purpose and create a whole new experience. You just use the tools at your disposal. If you do it properly, players will never know that you're using e.g. same underlying algorythm for counting xp as some older server did, and it won't matter to them. The purpose of _all_ of this is still keeping players entertained, right?1 point
-
1 point