Jump to content

50p

Retired Staff
  • Posts

    2,973
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by 50p

  1. No there isn't one, but maybe some day someone will make a plugin for Notepad++ with them. That would be really useful.
  2. Do you know what I was referring to? I don't think you do Because modifying a game is treated as "cheating"? And didn't I said: Sometimes it's difficult to understand posts without reading the whole topic, I know...
  3. 50p

    Moving a gate

    Have you created a map file with the tags (Nodes) as in my post a few post above? <map> <gates id="1" posX="0" posY="0" pozZ="0" /> </map> This file must be added to meta.xml too, like so: <map src="mapfile.map" />
  4. "Cheating" word has spread out over time in on-line gaming. Imagine: you've modified a game, you have a "road to heaven" (a road leading to the sky) that ONLY you can see and therefore ONLY you can use... is that fair? No, so that is treated as "cheating". Everything that gives only you an advantage and is meant to help you play is cheating, because only you can use that advantage not everyone on the server. Do you understand now? I don't think so... And that's why MTA Team give possibilities such as createObject on server-side, which gives everyone the same advantage of using the objects. Hopefully you'll change your way of thinking now.
  5. 50p

    Moving a gate

    The element system in MTA is confusing new comers. "gates" would be a dummy element type and therefore the game doesn't recognize it as an object element. Make a table where object elements (the gates) will be stored and then you can move specific gate using that table. eg: local gatesTable = { } -- it defines a table addEventHandler( "onResourceStart", getResourceRootElement( getThisResource( ) ), function( ) local gates = getElementsByType( "gates" ) for k in pairs( gates ) do local x, y, z = getElementData( v, "posX" ), getElementData( v, "posY" ), getElementData( v, "posZ" ) local gateObject = createObject( GATEID, x, y, z ) table.insert( gatesTable, gateObject ) end end ) -- now gatesTable will contain all object elements (returned from createObject) and now you can use this table to move a gate moveObject( gatesTable[ 1 ], 5000, 5, 0, 0 ) -- this will move the 1st gate created
  6. Because modifying a game is treated as "cheating"?
  7. You REALLY have to pay attention to the name of functions, variable, etc. Lua is also case-sensitive. You get that error because you try to use a function that doesn't exist, getLoclaPlayer ( theplayer ). This function doesn't require any arguments because that wouldn't be logical... Try to "get local player of player"? Use getLocalPlayer() only.
  8. I can see an error on line 9. NOTE: Test your code before you post it here!
  9. 50p

    Moving a gate

    No it won't work. When you createObject you should store its returned data to a variable and then use that variable to moveObject. So, getElementsByType won't be useful.
  10. 50p

    loadfile()

    You can do that in XML files. It would be even easier to use XML format then your own format (like dini in SA:MP).
  11. 50p

    Moving a gate

    getElementsByType will return a table of all your gates. You should then be able to set their positions straight away.
  12. Restart the resource or replace the model twice (not just once). Repeat the replacement again and it should work. Also the order you replace them is important.
  13. iterator explode2( string str, string separator ) It returns an iterator just like ipairs and pairs. See an example below to see how it works and how to use it. function explode2( str, separator ) local start = 1 local ret = nil return function( ) local s, e = string.find( str, separator, start, true ) if s then local retrn = string.sub( str, start, s-1 ) start = e + 1 return retrn, start-1, e else local retrn = string.sub( str, start, -1 ) if #retrn > 0 then start = start + #retrn return retrn end return nil end end end Example of usage: for word, s, e in explode2( "hello,from,lua", "," ) do print( word, s, e ) end the result will be: hello 6 6 from 11 11 lua nil nil the first variable is a string found between separators or whole string before the separator (in the first call), the 1st number is where the separator was found and the 2nd number is where it ends. You don't have to use those numbers, you can use a simple for loop w/o them like so: for word in explode2( "hello,from,lua", "," ) do print( word ) end
  14. It could be possible, but it may take some time to replace those objects. It's not (and will not) be possible to ADD new object, you can only replace the in-game objects.
  15. triggerClientEvent ( player, "thrillcam", getRootElement() ) You should get an error. Don't you get any errors? Login as an admin an type "debugscript 3" in console or "/debugscript 3". You should get a complaint about trying to trigger client-side event that was not added. You've got "onThrillcam" event, but you try to trigger "thrillcam". It's really important that you know the difference between function and event. You can't call client-side function from server-side script.
  16. You can make client-side camera with use of onClientRender.
  17. Don't you have windows built-in zip compressor?
  18. 50p

    Moving a gate

    You can specify them in map file, eg: <gates id="1" posX="1" posY="1" posZ="1" /> Server doesn't know such element typ, but you can make your server know it. Using getElementsByType( "gates" ) would return all the gates element you specified in map file. You can then use getElementData( gateelement, "posX" ) to get it's X coord, or getElementData( gateelement, "id" ) to get its ID. So in attach a function to onResourceStart event, loop through all the gates and create object using these x,y,z (if you need you can add more attributes for rotation). Useful functions: - getElementData - getElementsByType
  19. Try to use: createPickup( x, y, z, "custom", 370 )-- change x, y, z of couse
  20. He means why didn't you make these commands using the standard command prefix character "/" (forward flash)?
  21. Function setAccountData doesn't work as it should. Some people say it does work but I've never managed to make it work (even the way they said). setAccountData removes all the accounts from accounts.xml file when server stops.
  22. You need to use onPlayerDamage event and then you need to use setElementHealth & loss (the health that player lost) which will add player health that will make an effect of taking less damage. More info on that event here: http://development.mtasa.com/index.php? ... ayerDamage
  23. Cool! You've got control over every piece of GTA!
  24. I think he means there was no function in Race (scripting). I think he means the function was used in the Race itself.
×
×
  • Create New...