Jump to content

RottenFlesh

Members
  • Posts

    189
  • Joined

  • Last visited

Everything posted by RottenFlesh

  1. the source variable is not always the player. It depends on what event is being triggered, in some events the source is the player and in others it may be a vehicle or something else. And it only works inside the scope of the function attached to the event. You have to do something like this: function my_function() -- here, the source variable is a player because the event of this function is triggered when a player logs in -- and the source variable will work only inside this function for this event end addEventHandler("onPlayerLogin", getRootElement(), my_function) this way the event will be triggered when every player logs in, as every player is below the root element in the element tree. read this: Element_tree and this: AddEventHandler
  2. the syntax highlighting is only for the theme included with this package.
  3. I'm creating a new gamemode for my server right now, and i'm planning on doing everything in oop. It is definitely useful to me. You should learn a couple of other programming languages to see the benefits of oop, i recommend you to try Python, it is very easy to learn and it is object oriented.
  4. This is a very basic look at what oop is, you sould research a little about this topic. It is a very powerful tool to have.
  5. A mi me pasaba lo mismo, es por que al subirse al auto te sale el nombre de alguna radio del gta y ahi es cuando da laag. Puedes intentar hace esto: 1- vete a las configuraciones a la pestaña de Audio 2- lleva la configuracion de Radio volume al minimo Creo que con eso ya no te sale el rotulo de las estaciones de radio, pero por si acaso aca te dejo una captura de como tengo yo mis configuraciones:
  6. Don't use Ctrl+B, that's for the build system.
  7. player_data = {} function on_join() player_data[source] = "something you want to save" end addEventHandler('onPlayerJoin', root, on_join) function on_quit() player_data[source] = nil end addEventHandler('onPlayerQuit', root, on_quit) This is how you would delete the data
  8. That would be really cool! I'll be waiting for the release!
  9. Bonsai is trying to suggest that you should check the scoreboard settings. Because there is actually a setting to recognize color codes. You can see the settings under the Resources tab in the admin panel. Just select the scoreboard resource and hit the settings button.
  10. Wow this is awesome! thank you very much! BTW: Sublime Rulez! ;D
  11. vips = { "someguy", "otherguy", "anotherone" } function on_login (_, new_acc) local acc_name = getAccountName(new_acc) for i,vip_acc_name in ipairs(vips) do if acc_name == vip_acc_name then outputChatBox("Wellcome to your vip account.", source, 255, 255, 255, true) return true end end outputChatBox("You are not vip", source, 255, 255, 255, true) end addEventHandler('onPlayerLogin', root, on_login) i have not tested this.
  12. Pues hace un par de días fui contactado por un par de tipos, hablando por skype con ellos me dijeron que querían hacer una "empresa de hosting" y necesitaban mi ayuda por que no sabían nada de MTA. Era un niño como de 13 años que me dijo que iba a conseguir las computadoras por que su padre trabaja vendiéndolas, y el otro tipo estaba ahí nomas por que medio sabe hacer un server de metin. incluso en un momento uno de ellos le preguntó al otro: - "Oye, y como vamos a pagar la electricidad?" Y el otro le respondió: - "Eso le toca a mis padres." jajajajaja! En este mundo hay de todo, no se confíen.
  13. Por que hiciste el comando del lado de server? lo pudiste hacer directo en el lado del cliente. anti_pasivo_abuse = false -- antiabuso desactivado function pasivo() if anti_pasivo_abuse then return end -- si el antiabuso esta activado, hasta aca llega la funcion por el [b]return[/b] anti_pasivo_abuse = true -- activamos el antiabuso setTimer(function() anti_pasivo_abuse = false end, 120000, 1) -- timer de 2 min, para desactivar el antiabuso -- el resto de codigo no lo he probado Al final te tiene que quedar algo así: Para el del boton ya te dijeron, solo tienes que deshabilitar el boton y poner un timer para ativarlo denuevo.
  14. Supongo yo que en alguna parte del script tu les pones ese element data, sino por eso te da error. Prueba esto: function asd(player) local ap = getElementData(player, "arrests") local point = tonumber(ap) or 0 setElementData(player,"arrests", point + 1) end addCommandHandler('holaxd', asd)
  15. RottenFlesh

    20 lines

    i would do it like this: function mute_command(commander, _, player_to_mute) if hasObjectPermissionTo(commander, "command.mute", false) then local player_to_mute = getPlayerFromNamePart(player_to_mute) if player_to_mute then local is_muted = isPlayerMuted(player_to_mute) setPlayerMuted(player_to_mute, not is_muted) local text = is_muted and "unmuted" or "muted" outputChatBox(getPlayerName(player_to_mute).." has been "..text.." by "..getPlayerName(commander), root, 255, 255, 255, true) end end end addCommandHandler('mmute', mute_command) I have not tested it.
  16. What do you get from getElementType(self) ? BTW, when i do something in oop i do it like this: MyClass = {} MyClass.__index = MyClass function MyClass.new(name) self = setmetatable({}, MyClass) self.name = name return self end Correct me if i'm wrong.
  17. Si estas haciendo ese script en client-side, los comandos no tienen el argumento de player. localPlayer -- Usa esta variable si quieres obtener al player del lado del cliente.
  18. There are eight basic data types in Lua: nil, boolean, number, string, userdata, function, thread, and table. Userdata are used to represent new types created by MTA such as player, vehicle, objects or even xml nodes. That's the way you can represent those elements in lua, as they are not native of the language.
  19. Okay! los pondre todos en mi primer post. Hay alguna forma de borrar los mensajes que ya puse para que no queden como spam?
  20. RottenFlesh

    1.4 Beta Release

    Bitch, just go! Just GTFO!!
×
×
  • Create New...