Jump to content

Enkanet

Members
  • Posts

    77
  • Joined

  • Last visited

Everything posted by Enkanet

  1. Hello everyone. As you know, MTA shows only other players' names on themselves but I want to show also the players' name on himself. Like, if I am playing in local, I want to see my name on my ped. How can I do so? Thanks.
  2. Thanks to everyone .. Problem is fixed now.
  3. Hello everyone. I am trying to set vehicle handling by getting the properties from MySQL table. Well, it should set the vehicle's handling by its id. Like, There are two tables in my MySQL. Both of them has 'id' column. One of them is for vehicles and one of them for vehicle's handlings. Now, I want to set the vehicle's handling by that id. Let's say, I have 2 for id in handling table. Then it should set the handling for the vehicle that has 2 for id in vehicle table. Can anyone help me with that, please? Best Regards, Enkanet
  4. Oh sorry bout that it was not on my code I'll remove it. Got that from mihayy's post anyways there is an error. My debug script 3 says that I don't have an event "openWindow" client side but I have it? It doesn't let the server trigger it. triggerClientEvent (source,"openWindow",getRootElement(),hitPlayer)
  5. You should use SQL for this. Make a structure and the functions that you need, setVehicleHandling() getVehicleHandling() onPlayerJoin() onPlayerQuit() Also I suggest you to use mta_mysql.dll for sql... https://wiki.multitheftauto.com/wiki/Modules/MTA-MySQL
  6. Try this: local corona = getElementsByType("marker") for key, v in pairs (corona) do if getMarkerType(corona[i]) == "corona" then -- or this: if getMarkerType(v[i]) == "corona" then -- not sure with this
  7. Try this: local corona = getElementsByType("marker") for key, v in pairs (corona) do if getMarkerType(corona[i]) == "corona" then
  8. Why don't you use Spanish board? viewforum.php?f=122
  9. addEventHandler( "onClientMarkerHit", getRootElement(),MarkerHit) You should write the marker's name not "getRootElement()". So the change it with: local marker = createMarker ( -1723.74, 1359.68, 6.18, "cylinder" , 1.25 , 0, 255, 0, 180 ) addEventHandler( "onClientMarkerHit", marker ,MarkerHit) -- Set a name for your marker and add the event handker like this.[
  10. thanks mate! Worked now! Also I added you on skype.
  11. I forgot to say, local accountID = getElementData(source, "account:id") in this code debugscript says warning: bad argument @ getElementData Expected element at argument 1, got nil and local result = mysql:query_free("UPDATE `accounts` SET `job`='".. jobID .."' WHERE `id`=".. accountID .."") here it says error: attempt to concatenate local 'accountID' (a userdata value)
  12. Really nice. Sometimes I need this when I try to find a resource's problem and the debugscript f**ks the screen with another resource's warnings. Keep it up!
  13. So here's my code: local mysql = exports.mysql local accountID = getElementData(source, "account:id") function policeTeam() setElementData(source,"Job", "3") setPlayerTeam(source, getTeamFromName("Law")) giveWeapon(source, 24, 100) end addEvent("setPoliceTeam", true) addEventHandler("setPoliceTeam", getRootElement(), policeTeam) function getMysql(accountID) local result = mysql:query("SELECT job FROM accounts WHERE id='" .. accountID .. "'") setElementData(source,"Job",result[i]) end --addEventHandler("onPlayerJoin", getRootElement(), getMysql) addCommandHandler("getmysql", getMysql) function setMysql(accountID) local jobID = getElementData(source, "Job") local result = mysql:query_free("UPDATE `accounts` SET `job`='".. jobID .."' WHERE `id`='".. accountID .."'") end --addEventHandler("onPlayerQuit", getRootElement(), setMysql) addCommandHandler("mysqlm", setMysql) Note: I added a command instead of using eventhandler to test without reconnecting. Also, do you have skype? So we can talk better than here.
  14. Now I changed the script a lot and I started using mta_mysql.dll and libmysql.dll modules. Here's my new code which is not working: local mysql = exports.mysql function policeTeam(accountID) local accountID = tonumber(getElementData(source, "account:id")) setElementData(source,"Job", 3) setPlayerTeam(source, getTeamFromName("Law")) giveWeapon(source, 24, 100) end addEvent("setPoliceTeam", true) addEventHandler("setPoliceTeam", getRootElement(), policeTeam) function getMysql(accountID) local accountID = tonumber(getElementData(source, "account:id")) local result = mysql:query("SELECT job FROM accounts WHERE id='" .. accountID .. "'") setElementData (source,"Job",result[1].Job) end addEventHandler("onPlayerJoin", getRootElement(), getMysql) function setMysql(accountID) local jobID = getElementData(source, "Job") local accountID = tonumber(getElementData(source, "account:id")) local result = mysql:query_free("UPDATE `accounts` SET `job`='".. jobID .."' WHERE `id`='".. accountID .."'") end --addEventHandler("onPlayerQuit", getRootElement(), setMysql) addCommandHandler("mysqlm", setMysql)
  15. yes I did notice it and I changed my code. still now working. Here's the code: function policeTeam() setElementData(source,"Job","3") setPlayerTeam(source, getTeamFromName("Law")) giveWeapon(source, 24, 100) end addEvent("setPoliceTeam", true) addEventHandler("setPoliceTeam", getRootElement(), policeTeam) function getMysql() query = dbQuery(connection, "SELECT * FROM accounts WHERE id='"..accountID.."' ") result, affectedrows, lastid = dbPoll(query, -1) setElementData (source,"Job",result[1].Job) end addEventHandler("onPlayerJoin", getRootElement(), getMysql) function setMysql(accountID) query = dbQuery(connection, "UPDATE accounts SET job = '"..getElementData(source, "Job").."' WHERE id = '"..accountID.."' ") result, afectedrows, lastid = dbPoll(query, -1) end addEventHandler("onPlayerQuit", getRootElement(), setMysql) function connectToDB() connection = dbConnect("mysql", "dbname=cloudrpg;host=127.0.0.1;port=3306", "root") end addEventHandler("onPlayerJoin", getRootElement(), connectToDB) in my opinion the problem is with my loginpanel. I am rewriting it because debugscript shows no error and still the script is not working.
  16. Hello there! I have a DB and a table in it called accounts. And in the structure I have those: id(AUTO_INCREMENT), username, password, etc.... and also "job". I want to do like, when you click to a button it should set that Job value in db to 3. Here's my server side: mysql = exports.mysql function policeTeam() setElementData(source,"Job","3") setPlayerTeam(source, getTeamFromName("Law")) giveWeapon(source, 24, 100) end addEvent("setPoliceTeam", true) addEventHandler("setPoliceTeam", getRootElement(), policeTeam) function getMysql() result = "SELECT * FROM accounts WHERE id=?",accountID setElementData (source,"Job",result[1].Job) end addEventHandler("onPlayerJoin", getRootElement(), getMysql) function setMysql() result = mysql:query_free("UPDATE accounts SET job=? WHERE id=?",getElementData (source,"Job"),accountID) end addEventHandler("onPlayerQuit", getRootElement(), setMysql) in client side I only trigger the setPoliceTeam event with the code. So, where's the error and what shall I do? There're no errors in debugscript but it doesn't change the job value in db.
  17. Hello, I'd like to change my hud's graphics and location. Should I disable hudcomponents and draw dx images and texts than set their value with for example getPlayerMoney or is there anything to change hud graphics?
  18. Show us your code so we can help you. And also what Mizudori said.
  19. Yeah, so I guess I should use setElementData ? Maybe like, setElementData(theVehicle "owner") ? Or setAccountData or sth? I am going to use MySQL for this problems but I am new for MySQL
  20. You're rude. And he's a spammer who has a thread but he floods another threads because he's impatient. Sorry for this but, TheRock254 Can you please go to your thread?
×
×
  • Create New...