Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About iPollo

  • Rank
    Advanced Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Muito obrigado, ajudou muito EDIT: Surgiu outra dúvida, caso eu queira usar as funções de dentro da classe (métodos) em outro script, funcionaria normalmente exportando?
  2. Olá a todos, gostaria de saber como posso implementar os conceitos de OOP (caso seja possível) para o scripiting no MTA? Por exemplo: Caso eu queira criar uma classe ITEM, que tenha seus atributos e métodos, como eu poderia fazer isso em lua e aplicar no meu servidor? Um exemplo simples feito em java de como funcionaria a classe: public class Item { //Atributos que armazenarão a posição do item int item_POSX; int item_POSY; int item_POSZ; //Método que retornará a posição do meu item public int getItemPosX() return item_POSX; } Então por exemp
  3. Got it, but if i want to access a specific value, for example, the object id? how it should be? local objectid = items['medkit']....
  4. Okay, and about the table, I found an example of a table structure (below) local items = { ['apple'] = {desc = 'A green apple', name = 'apple', objectid = '2134'} } how should i do, using tabel.insert, to add a new item without doing it manually in the table itself, leaving it like this: local items = { ['apple'] = {desc = 'A green apple', name = 'apple', objectid = '2134'} ['medkit'] = {desc = 'A healing item', name = 'Medic Kit', objectid = '431'} } I know that initially it is like this: table.insert(items, 'medkit', ...) what should I put to fill in the fields wi
  5. Hello everyone, I recently discovered that it is possible to place tables within tables, this would have saved me a lot of work a week ago ; -; but anyway. Currently, to save the items contained in the player's inventory I have a copy of unique tables on each side (server / client) and every time there is an update, I need to move the value from one side to the other, but this seems to be very strange, i know that the fundamental principle of events is this, but I think I am not doing it in the best way. For example, I currently have the player_INV table, with 10 index for access, w
  6. Hello everyone, I think I will still need to come here thousands of times to clear all doubts, so ... I have this function declared on serverSide function removeItemDoMundo(itemid) table.remove(spawnedItem_ID, itemid) table.remove(spawnedItem_NOME, itemid) table.remove(spawnedItem_X, itemid) table.remove(spawnedItem_Y, itemid) table.remove(spawnedItem_Z, itemid) table.remove(spawnedItem_ELEMENTO, itemid) removeWorldModel(spawnedItem_ID[itemid], 1.0, spawnedItem_X[itemid], spawnedItem_Y[itemid], spawnedItem_Z[itemid]) end I'm trying to call it on the clie
  7. Hello, the first problem I am facing, is that in this function, there are no parameters that appear in the Wiki, it was supposed to have a height parameter, and two others (height and length of the image itself), but when I modify these values, only the width affects the image, because the height is related to the height of the drawing in relation to the element, so I cannot resize the image correctly. function dxDrawImageOnElement(TheElement,Image,distance,height,width,R,G,B,alpha) local x, y, z = getElementPosition(TheElement) local x2, y2, z2 = getElementPosition(localPlayer) loc
  8. I'm not sure if I understood, the point I want to get to, its find out which colShape is being hit by the player, see some examples: here is the function that will be called automatically, see that it creates the item, and a sphere around it: (serverSide) function createItemInMap(item, name, x, y, z) createObject(item, x, y, z) createColSphere(x, y, z, 1.5) end What I would like to know is how I do it, so when this event is called (onClientColShapeHit), on the clientSide, I automatically receive some "ID" from colShape, so I could know which item it is near, thus avoiding
  9. I understand, this way is much better, but let's assume that in my system, items are created automatically, so colShape will also be created automatically along with the items. In the example above, you specified which area the event will fire. As in my items will be created automatically on ServerSide, I can't go putting area by area, is there any way when the event is called on clientSide I receive some variable that contains the colShape id that was hitted?
  10. Yes, what I needed was as if it were an area, which then I would just check when the player's event entered a certain area was triggered, the problem with using onColShapeHit, is that it creates a physical collision area, and I I do not want it, cause the player would hit a "invisible shape" i do not know if colShape works like that way
  11. Hello everyone, I would like to ask the veterans a question. Let's suppose that I am making an item system, where when the player comes close to an item, the "F" key (in the form of an image) and the name of the item appear above it in a 3D way, this key is responsible for collecting items of the map. As dxDraw functions appear one time per frame, they must be included in the onClientRender/onClientPreRender to show all the time. Thinking about it, I thought of creating a loop through all the items that are on the map to be collected, and if the player is within the range of 1 m
  12. I do not know why, but its returning nil, is in a function whose other features work just fine, only that is not working local element element = createObject(item, x, y, z) outputDebugString("ELEMENT ID: "..getElementID(element)) DebugString: "INFO: ELEMENT ID: "
  13. Estudando, descobri que funções que desenham como dxDrawText aparece uma vez no frame e some, por isso deve ser colocada abaixo do onClientRender, que é acionado a cada frame novo, porém, como faço para habilitar e desabilitar em algum momento específico? Por exemplo: tenho um sistema de item, quando o jogador chega perto, desenha um texto na tela, quando se afasta, some, como devo fazer, para que funcione desta forma, pois diretamente abaixo do onClientRender ele iria aparecer o tempo todo.
  14. iPollo

    [Help] Events

    Okay, you literally opened my mind, now it's much clearer, and thanks for all the corrections. But for some reason it gives an error: attempt to call global 'client' <a user data value> on here: addEvent("onPlayerReady", true); addEventHandler("onPlayerReady", root, function() triggerClientEvent(client "onClientRecebeItemVar", root, item_ID, item_NOME, spawnedItem_ID, spawnedItem_NOME, spawnedItem_X, spawnedItem_Y, spawnedItem_Z) end)
  15. iPollo

    [Help] Events

    1) I didn't create it on ClientSide, because I thought that if it were "global" it would be accessible there. 2) Fixed And I made the other five points, but I still don't understand how to access array on the other side
  • Create New...