Jump to content

Gamesnert

MTA Contributors
  • Posts

    2,035
  • Joined

  • Last visited

Everything posted by Gamesnert

  1. I think all of the data you want to keep (client-side, at least) is in: %MTA install folder%/MTA/coreconfig.xml Backup that file, and you've got most stuff covered. I don't think you'd really need any other files. But eh, 1.0.3 won't override your settings for as far as I know... You can always backup just in case, but I doubt it's really necessary.
  2. function Binds() bindKey( "F2", "down", CreateLoginWindow ) end addEventHandler("onClientResourceStart", getRootElement(), Binds) -- onResourceStart doesn't exist client-side, it's on>>Client<<ResourceStart And could you please wrap your code in [ lua] [ /lua] or [ code=lua] [ /code] tags next time? It's a bit annoying to read it this way.
  3. function Binds() bindKey( "F2", "down", CreateLoginWindow )endaddEventHandler("onClientResourceStart", getRootElement(), Binds) -- onResourceStart doesn't exist client-side, it's on>>Client< And could you please wrap your code in [ lua] [ /lua] or [ code=lua] [ /code] tags next time? It's a bit annoying to read it this way.
  4. To fix this, use a recent version of the admin resource, instead of the ancient admin resource from DP2. Package with all up-to-date resources Spawnmanager page at the wiki respawnVehicle page at the wiki
  5. To fix this, use a recent version of the admin resource, instead of the ancient admin resource from DP2. Package with all up-to-date resources Spawnmanager page at the wiki respawnVehicle page at the wiki
  6. You don't "attach" text to peds. You just draw it on top of them every frame. - onClientRender - getElementPosition - getScreenFromWorldPosition - dxDrawText That should give you a general idea of how to do it.
  7. You don't "attach" text to peds. You just draw it on top of them every frame. - onClientRender - getElementPosition - getScreenFromWorldPosition - dxDrawText That should give you a general idea of how to do it.
  8. As long as you don't try or fail to ask how to solve specific problems then sure, you will fail.
  9. As long as you don't try or fail to ask how to solve specific problems then sure, you will fail.
  10. * NOTE: Big post alert * There are a few small problems in your code straight off. local pistolstat = getPedStat (source, 69 ) --The Pistol Skill is ID 69 if (pistolstat < 500 ) then outputChatBox ( getPlayerName (source) .. "Your Pistol weapon skill is bad.") if (pistolstat > 500 ) then outputChatBox ( getPlayerName (source) .. "Your Pistol weapon skill is good.") if (pistolstat = 1000 ) then outputChatBox ( getPlayerName (source) .. "Your Pistol weapon skill is Hitman(dual pistols)!") else outputChatBox ("It made an error, try again or remake it") end It might seem problemless right now. I'll change the indentation to show you the problem: local pistolstat = getPedStat (source, 69 ) --The Pistol Skill is ID 69 if (pistolstat < 500 ) then outputChatBox ( getPlayerName (source) .. "Your Pistol weapon skill is bad.") if (pistolstat > 500 ) then outputChatBox ( getPlayerName (source) .. "Your Pistol weapon skill is good.") if (pistolstat = 1000 ) then outputChatBox ( getPlayerName (source) .. "Your Pistol weapon skill is Hitman(dual pistols)!") else outputChatBox ("It made an error, try again or remake it") end As I typed above is how the MTA server will most likely read your script file. The problem is that you won't get any output at all (if even work without outputting an error, which it won't because you're missing 2 ends) unless you have a skill level of under 500, in which case it will only display "Your Pistol weapon skill is bad". It might be a little tricky for you to understand, but in this state your MTA server won't be able to understand the code at all. The solution is "elseif", which will make it more clear to Lua what to do. Like this: local pistolstat = getPedStat (source, 69 ) --The Pistol Skill is ID 69 if (pistolstat < 500 ) then outputChatBox ( getPlayerName (source) .. "Your Pistol weapon skill is bad.") elseif (pistolstat >= 500 ) then -- elseif included, which makes sure it will actually work. (also did >= instead of >, so it will also execute the function below if the stat equals to 500) outputChatBox ( getPlayerName (source) .. "Your Pistol weapon skill is good.") elseif (pistolstat = 1000 ) then outputChatBox ( getPlayerName (source) .. "Your Pistol weapon skill is Hitman(dual pistols)!") else -- If neither of the above (impossible) outputChatBox ("It made an error, try again or remake it") end In this way, the server will understand how you want it to respond. Now we'll head over to a slightly smaller problem: else -- If neither of the above (impossible) outputChatBox ("It made an error, try again or remake it") end As you can see, I put "impossible" there. Why you might think? Let's see into all the things getPedStat can return: - 0 ... 1000 (depending on skill level) - false (in case of an error) It might seem you might get "it made an error..." output when it fails, but actually you won't. The culprit? if (pistolstat < 500 ) then If pistolstat is false, you're trying to compare a boolean with an int; which is illegal, and therefore returns an error and stops the script for a moment. This causes the last error to never appear. To solve this, we can move this check upwards. Meaning that you'll see if there's an illegal return value before Lua itself has to notice it. How you might ask? if (pistolstat == false) then -- If pistolstat is equal to false, then... OR if (not pistolstat) then -- If pistolstat is an illegal return value (false or nil) OR if (type(pistolstat)~="number") then -- If pistolstat isn't a number (therefore something you don't want) Which way you will choose shouldn't matter in your case. All that matters is the right implementation. I'll let you try the next step yourself. Try to use your knowledge on "elseif" to place your error check BEFORE pistolstat < 500. ------------------------------------------------------------------------ This is certainly possible. Note that you can concatenate strings and numbers into a string. So like: string1 = "Hello" string2 = "World!" int1 = 1 int2 = 2 outputChatBox(string1 .. " " .. string2) -- Outputs: "Hello World!" outputChatBox(int1 .. " + " .. int2 .. " = " .. int1 + int2) -- Outputs: "1 + 2 = 3" Try to make something with this knowledge, and reply if you've got a problem you can't solve.
  11. * NOTE: Big post alert * There are a few small problems in your code straight off. local pistolstat = getPedStat (source, 69 ) --The Pistol Skill is ID 69if (pistolstat < 500 ) then outputChatBox ( getPlayerName (source) .. "Your Pistol weapon skill is bad.")if (pistolstat > 500 ) then outputChatBox ( getPlayerName (source) .. "Your Pistol weapon skill is good.")if (pistolstat = 1000 ) then outputChatBox ( getPlayerName (source) .. "Your Pistol weapon skill is Hitman(dual pistols)!")else outputChatBox ("It made an error, try again or remake it")end It might seem problemless right now. I'll change the indentation to show you the problem: local pistolstat = getPedStat (source, 69 ) --The Pistol Skill is ID 69if (pistolstat < 500 ) then outputChatBox ( getPlayerName (source) .. "Your Pistol weapon skill is bad.") if (pistolstat > 500 ) then outputChatBox ( getPlayerName (source) .. "Your Pistol weapon skill is good.") if (pistolstat = 1000 ) then outputChatBox ( getPlayerName (source) .. "Your Pistol weapon skill is Hitman(dual pistols)!") else outputChatBox ("It made an error, try again or remake it") end As I typed above is how the MTA server will most likely read your script file. The problem is that you won't get any output at all (if even work without outputting an error, which it won't because you're missing 2 ends) unless you have a skill level of under 500, in which case it will only display "Your Pistol weapon skill is bad". It might be a little tricky for you to understand, but in this state your MTA server won't be able to understand the code at all. The solution is "elseif", which will make it more clear to Lua what to do. Like this: local pistolstat = getPedStat (source, 69 ) --The Pistol Skill is ID 69if (pistolstat < 500 ) then outputChatBox ( getPlayerName (source) .. "Your Pistol weapon skill is bad.")elseif (pistolstat >= 500 ) then -- elseif included, which makes sure it will actually work. (also did >= instead of >, so it will also execute the function below if the stat equals to 500) outputChatBox ( getPlayerName (source) .. "Your Pistol weapon skill is good.")elseif (pistolstat = 1000 ) then outputChatBox ( getPlayerName (source) .. "Your Pistol weapon skill is Hitman(dual pistols)!")else -- If neither of the above (impossible) outputChatBox ("It made an error, try again or remake it")end In this way, the server will understand how you want it to respond. Now we'll head over to a slightly smaller problem: else -- If neither of the above (impossible) outputChatBox ("It made an error, try again or remake it")end As you can see, I put "impossible" there. Why you might think? Let's see into all the things getPedStat can return: - 0 ... 1000 (depending on skill level) - false (in case of an error) It might seem you might get "it made an error..." output when it fails, but actually you won't. The culprit? if (pistolstat < 500 ) then If pistolstat is false, you're trying to compare a boolean with an int; which is illegal, and therefore returns an error and stops the script for a moment. This causes the last error to never appear. To solve this, we can move this check upwards. Meaning that you'll see if there's an illegal return value before Lua itself has to notice it. How you might ask? if (pistolstat == false) then -- If pistolstat is equal to false, then... OR if (not pistolstat) then -- If pistolstat is an illegal return value (false or nil) OR if (type(pistolstat)~="number") then -- If pistolstat isn't a number (therefore something you don't want) Which way you will choose shouldn't matter in your case. All that matters is the right implementation. I'll let you try the next step yourself. Try to use your knowledge on "elseif" to place your error check BEFORE pistolstat < 500. ------------------------------------------------------------------------ This is certainly possible. Note that you can concatenate strings and numbers into a string. So like: string1 = "Hello"string2 = "World!"int1 = 1int2 = 2 outputChatBox(string1 .. " " .. string2) -- Outputs: "Hello World!"outputChatBox(int1 .. " + " .. int2 .. " = " .. int1 + int2) -- Outputs: "1 + 2 = 3" Try to make something with this knowledge, and reply if you've got a problem you can't solve.
  12. Ehm... What exactly do you want? If you mean you want to check when element data has changed: on(Client)ElementDataChange Otherwise, could you please tell us (in detail) what you want to know?
  13. Ehm... What exactly do you want? If you mean you want to check when element data has changed: on(Client)ElementDataChange Otherwise, could you please tell us (in detail) what you want to know?
  14. Gamesnert

    Help :D

    Are you sure you're using your external IP? You can check your external IP here. The server browser tends to be a bit lazy in the way of it being very slow to add new servers to the list. Wait a couple of hours with the server on, it should appear eventually. (unless it's portforwarded improperly or your router is lazy) The "Unofficial MTA Script Editor" is a beta and therefore not stable enough for everyday use. Notepad++ is what I would recommend, it's a multi-language scripting tool which supports most common languages. Fast starting, good syntax highlighting, tabs, and plenty of other options. You will need to convert these into resources. The batch race map converter should do the job.
  15. Gamesnert

    Help :D

    Are you sure you're using your external IP? You can check your external IP here. The server browser tends to be a bit lazy in the way of it being very slow to add new servers to the list. Wait a couple of hours with the server on, it should appear eventually. (unless it's portforwarded improperly or your router is lazy) The "Unofficial MTA Script Editor" is a beta and therefore not stable enough for everyday use. Notepad++ is what I would recommend, it's a multi-language scripting tool which supports most common languages. Fast starting, good syntax highlighting, tabs, and plenty of other options. You will need to convert these into resources. The batch race map converter should do the job.
  16. There's a "defaultstats" resource in the server. Turn it on. If you want to change the values, open the script files and edit them. https://wiki.multitheftauto.com/wiki/SetPedStat for checking the IDs.
  17. There's a "defaultstats" resource in the server. Turn it on. If you want to change the values, open the script files and edit them. https://wiki.multitheftauto.com/wiki/SetPedStat for checking the IDs.
  18. Yes it is. The only (and I mean, only) difference is changing function names to a newer counterpart. Please MOH, for your sake, stop embarrasing yourself. Stealing scripts is for no-lifers, especially if it isn't such a great script either. Even more so if you don't even edit its behaviour whatsoever. If you still think that you're a "good scripter", think again. As most people would most likely think you're either a bad thief, or a terrible scripter. (or both, if you ask me)
  19. Yes it is. The only (and I mean, only) difference is changing function names to a newer counterpart. Please MOH, for your sake, stop embarrasing yourself. Stealing scripts is for no-lifers, especially if it isn't such a great script either. Even more so if you don't even edit its behaviour whatsoever. If you still think that you're a "good scripter", think again. As most people would most likely think you're either a bad thief, or a terrible scripter. (or both, if you ask me)
  20. This means your PC has waited over 10 seconds to get the server list send to it, but hasn't yet been received. This could mean something is blocking the connection, either outgoing or incoming, or it just took a while for the master server to notice you sent a request. (which I doubt) You should try disabling all firewalls and other protective measures for a moment. See if that helps. If you've managed to fix it somehow, please tell everyone how you did it as it's a far too common problem at the moment.
  21. This means your PC has waited over 10 seconds to get the server list send to it, but hasn't yet been received. This could mean something is blocking the connection, either outgoing or incoming, or it just took a while for the master server to notice you sent a request. (which I doubt) You should try disabling all firewalls and other protective measures for a moment. See if that helps. If you've managed to fix it somehow, please tell everyone how you did it as it's a far too common problem at the moment.
  22. Do note that dump files (should) only be generated when MTA crashes. It won't create one on a freeze for instance. Also, I heard Vista stores files created by a program in a different location. (Virtual store or something)
  23. Do note that dump files (should) only be generated when MTA crashes. It won't create one on a freeze for instance. Also, I heard Vista stores files created by a program in a different location. (Virtual store or something)
  24. A few questions: setPlayerScore( source, "the kills", kills ) Does this function actually exist? function onPlayerLogin ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then Why are you using getPlayerAccount if onPlayerLogin actually has a parameter containing the currently used account? It could just be done as: function onPlayerLogin ( blah, playeraccount ) Perhaps that might also be the solution to your problem. local kills = getElementData ( source, "the kills" ) I'm not sure how get/setElementData responds to spaces in the name, but as a last resort you could try removing it.
  25. A few questions: setPlayerScore( source, "the kills", kills ) Does this function actually exist? function onPlayerLogin ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then Why are you using getPlayerAccount if onPlayerLogin actually has a parameter containing the currently used account? It could just be done as: function onPlayerLogin ( blah, playeraccount ) Perhaps that might also be the solution to your problem. local kills = getElementData ( source, "the kills" ) I'm not sure how get/setElementData responds to spaces in the name, but as a last resort you could try removing it.
×
×
  • Create New...