Jump to content

andreiwow2

Members
  • Posts

    27
  • Joined

  • Last visited

About andreiwow2

  • Birthday 16/09/1999

Details

  • Gang
    Police4Life

Recent Profile Visitors

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

andreiwow2's Achievements

Advanced Member

Advanced Member (8/54)

0

Reputation

  1. Hey guys, I'd like to make an accessory system where people could attach hats and glasses and other things to them but I heard that this may cause stuttering, the server that this is aimed for has around 120+ players, do you have any ideas how to do this without performance issues?
  2. And can you show me the working example of what I've been trying to do please? What should I modify at my code, sorry but I understand better from examples.
  3. Hey guys, I've done this: <meta> <info author="Andrei" description="Pay phone script" version="0.7" name="PayPhones"/> <script src="main.lua" type="server" /> <script src="client.lua" type="client" /> <min_mta_version server="1.1.1-9.03328" /> </meta> Server file: addCommandHandler("payphone", function(sourcePlayer) for i=1, payLength do if isElementInRange(sourcePlayer, payphones["PosX"..i], payphones["PosY"..i], payphones["PosZ"..i], 1) then triggerClientEvent(sourcePlayer, "onPayPhone", sourcePlayer) end end end ) Client file: addEvent("onPayPhone", true) function displayPayPhone(sourcePlayer) phoneWindow = guiCreateWindow ( 0, 0, 0.5, 0.4, "Pay Phone", true ) end addEventHandler("onPayPhone", sourcePlayer, onPayPhone) Nothing happens when I type /payphone
  4. Oh wait, so you say to have the client in a different lua file? Woah... and how do I use the variables from a file to another one? Like if I display the window in the client.lua, how do I pass information to the server file to use it later, for example, if the player calls someone
  5. Can you tell me where to find the debug, because with client nothing works and nothing is displayed in console This also works, but I still get the "attempt to call global 'guiCreateWindow'" error
  6. so now you tell me to use shared? with shared, my script works, but not the gui I get the "attempt to call global 'guiCreateWindow' error with client, nothing works.
  7. Can't I just have server and client in same resource? if I use type="client" nothing works...
  8. Why would it work in the cmd and not in the loop if it was otherwise? <script src="main.lua" type="shared" />
  9. I've done this function assignPayPhones (res) local checkNumberQuery = dbQuery(handler, "SELECT * FROM PayPhoneOW") local result, num_affected_rows, last_insert_id = dbPoll ( checkNumberQuery, -1 ) payphones = {} payLength = 0 for _, row in ipairs (result) do for column, value in pairs ( row ) do end payphones["ID".._] = row["ID"]; payphones["PosX".._] = row["PosX"]; payphones["PosY".._] = row["PosY"]; payphones["PosZ".._] = row["PosZ"]; payphones["Number".._] = row["Number"]; payLength = payLength + 1 end end addEventHandler("onResourceStart", getRootElement(), assignPayPhones) and it works I just want to have the values of each payphone saved so I can use them later without doing a query.
  10. This code is working: function testCmd(sourcePlayer) local phoneWindow = guiCreateWindow ( 0, 0, 0.5, 0.4, "Pay Phone", true ) local tabPanel = guiCreateTabPanel ( 0, 0.1, 1, 1, true, phoneWindow ) local mainTab = guiCreateTab( "Phone", tabPanel ) end addCommandHandler("testcmd", testCmd) But this code is not working: function displayPayPhone(sourcePlayer) for i=1, payLength do if isElementInRange(sourcePlayer, payphones["PosX"..i], payphones["PosY"..i], payphones["PosZ"..i], 1) then local phoneWindow = guiCreateWindow ( 0, 0, 0.5, 0.4, "Pay Phone", true ) local tabPanel = guiCreateTabPanel ( 0, 0.1, 1, 1, true, phoneWindow ) local mainTab = guiCreateTab( "Phone", tabPanel ) end end end addCommandHandler("payphone", displayPayPhone) Error:
  11. I want to save the data of every payphone so I can use it later, for example to get the pos of a payphone to see if the player is near any payphone..
  12. for i=1, 3 do if isElementInRange(sourcePlayer, payphones["PosX"..i], payphones["PosY"..i], payphones["PosZ"..i], 5) then outputChatBox("There is a payphone near you") else outputChatBox("There is no pay phone near you") end end Error:
×
×
  • Create New...