Jump to content

Army@1

Members
  • Posts

    138
  • Joined

  • Last visited

Everything posted by Army@1

  1. Nobody simply join MTA to leave. Believe me when I say many try and many failed. I have also tried and had gave up. MTA is addictive. Even more addictive, when you are introduced to its biggest trap scripting and mapping. There is something like charm or magic in MTA which doesn't let most players leave. Anyway, good luck from me.
  2. Oh, my bad. Thanks, I understand it now. Could you please answer the following questions too if you have time?
  3. If people are agree to give some share or percentage of the gain then I see no problem in it.
  4. Of-course, I know as your previous code was in C but I am talking about the idea. Does it similar to it in some way(without changing the value)? Yeah but I am talking about the user-data not the actual which should be 'k' If I understood correctly. Did you read my comment inside the lua code?
  5. I think I got the basic Idea of pointers. a = 23; b = a -- Here b act as a pointer(Not actually but in a similar way)? outputChatBox(b) Did I? Also the key, when we loop through the player table, is actually a user-data? I.e. for k,v in ipairs(getElementsByType("player")) do outputChatBox(k) -- here 'k' is a user-data value? and the thing which points 'k' to 'v' is a pointer? end
  6. Thanks a lot Noki for the explanations! Objects and Classes: Let Bank And Water be classes. Then we have a 'Bank Class' and 'Water Class' Bank.create,Bank.destroy,Bank.Interest,etc... are 'Bank Objects'. Similarly, Water.create, Water.destroy, Water.createOcean, etc... are 'Water Objects'. Am I right? Also all programming languages class's and object's work in similar manner? MTA Classes: whats the different between vehicle:method() and vehicle.method()? How to define one and how each one work? Thanks Revolt. but do you mean that there are not classes in MTA i.e MTA Classes? Also what is light user-data pointers and where I can learn about them?
  7. I don't get it. Why a user can't delete his own uploaded resources if he wants? Whats the need to make the procedure long?
  8. I am agree with you, covering such things in details could require lots of writing. but covering some basics like globalVariable = "Script a" -- this is a variable function blabla() local globalVariable = "Function a'" -- this is a local variable and it works only inside the function anotherGlobalVariable = "Script b" -- global variables can be define inside the functions too local localVariable = "Function c" -- this is also a local variable and it works only inside the functon outputChatBox(globalVariable) -- this will output "function a" and not "Script a" as it is inside the function outputChatBox(anotherGlobalVariable) -- this will output "Script b" outputChatBox(localVariable) -- this will output "Function C" end outputChatBox(globalVariable) -- this will output "Script a" and not "Function a" as "Function a" works only inside the function outputChatBox(anotherGlobalVariable) -- this will output "Script b" as it is also a global variable but just define inside outputChatBox(localVariable) -- this will output an error as localVariable works only inside the function may not. Maybe just distinguishing and comparing them or a example code could also be helpful. Sorry if it troubles you.
  9. Didn't know that. Thanks.
  10. Sorry but I am not asking particularly for lua but for programming as a whole. Also the links you give assume the user knew and understand some parts of the lua, which I do not (at least fully). And it would be really helpful if someone explain these things from personal views and understanding. This way, we could also clear our misunderstandings. Thanks.
  11. I see. It would probably output an error but there would be no client to receive it, right?
  12. Hello everyone, I am slow learner and today I wanna know what are the differences between: Object (not in-game objects like createObject) Classes MTA Classes Tables Arrays Metatables Elements Children Parent I know most of these things but I am quiet confused between them and also it will help me in understanding programming in deep. Also where can I learn matrix and vertex as used in programming languages (lua). There is page for them but it is not that helpful, I want a basic one for a beginner for complete understanding. I would really appreciate your guys help.
  13. Only if it is executed by the server. I am wondering, what would happen to a timer if it was executed by the client?
  14. killTimer can be use in the following ways. local x = 1 function aTimer() x = x+1 end -- this is an infinite timer which runs every 10 seconds. myTimer = setTimer(aTimer, 10*1000, 0) -- kill the timer when x is 10 if x = 10 then killTimer(myTimer) end -- or kill the timer after 1 minute (after myTimer has ran 6 times). setTimer(killTimer, 60*1000, 1, myTimer) --
  15. Good job MTA team and its community. It was indeed a great year, lots of things are done and lots are planned. And yes, I hope 2016 will be even better as something which many of us wanted, new ID's for player skins (not in a way most of us have thought), is coming. Thanks MTA team, lopezloo, and ArranTuna (aka Arran) for your effort and hardwork. Nice to see MTA player count increasing. Long live MTA! Happy holidays and happy new year everyone!! :greenjumpers: (Somebody has to use them) Edit: Fixed some grammatical errors.
  16. For your error, try this script: function SaveTeamOnLogOut() local playerAccount = getPlayerAccount(source) if playerAccount then local playerTeam = getPlayerTeam ( source ) local TeamName = getTeamName ( playerTeam ) local Nametag = getPlayerNametagColor ( source ) local occupation = getElementData( source, "Occupation") setAccountData(playerAccount, "Team", TeamName ) setAccountData(playerAccount, "Tag", Nametag ) setAccountData(playerAccount, "Occupation", occupation ) end end addEventHandler("onPlayerQuit",getRootElement(),SaveTeamOnLogOut) function LoadSaveOnLogin() local playerAccount = getPlayerAccount(source) if playerAccount then local r,g,b = getAccountData(playerAccount, "Tag") local TeamName = getAccountData(playerAccount, "Team") local occupation = getAccountData(playerAccount, "Occupation") setPlayerTeam( source, getTeamFromName(TeamName)) setPlayerNametagColor ( source, r, g, b ) setElementData( source, "Occupation", occupation, true ) end end addEventHandler("onPlayerLogin",getRootElement(),LoadSaveOnLogin) And about getting in the same team everytime, it may not be a bug of this script but a feature of your other script? Try stopping related scripts and running this one again.
  17. you can try setting a timer using setTimer
  18. If you don't mind, would you like to share the resource with the community? It may help other people who are looking for the same resource and the other thing is I am curious.
  19. Can you specify more clearly in detail?
  20. Army@1

    I need Help!

    Also the mimimum requirements of MTA 1.5 is Windows XP Server Pack 3. if your PC has anything below that, try upgrading. If you have Windows XP SP3 or greater version and the problem still persists then download, extract and run MTADiag and follow the instructions. Press 'n' when asked. Post any Pastebin URL MTADiag gives you.
  21. Please download, extract and run MTADiag and follow the instructions. Press 'n' when asked. Post any Pastebin URL MTADiag gives you.
  22. Hello everyone. I have made a script to synchronize player time with server time but the script is spamming the debugscript with an error whenever I reconnect the server. Error: Server triggered clientside event syncTime, but event is not added client side. It is probably because server script started before client or there are no players in the server. So far I have tried setting a timer and checking number of players in server but no luck. Anyone can please help me in this? Client:- addEvent("syncTime", true) addEventHandler("syncTime", getRootElement(), function(h, m) local hc, mc = getTime() if hc ~= h or mc ~= m then setTime(h, m) end end ) Server:- setTimer( function() local h, m = getTime() if #getElementsByType("player") >= 1 then triggerClientEvent("syncTime", getRootElement(), h, m) end end, 1000, 0)
  23. Well, that is really a self-explanatory thing. It says you forgot to put an 'end' to close the function which starts at line 19. In that case, the below code will work: local textures = {}; local function render_crosshair () local screenw, screenh = guiGetScreenSize (); local s = screenw * 0.5; local u,v = (screenw - s)*0.5, (screenh - s)*0.5; local black = tocolor (0, 0, 0, 255); dxDrawRectangle (0, 0, screenw, v, black); dxDrawRectangle (0, 0, u, screenh, black); dxDrawRectangle (0, screenh, screenw, -v, black); dxDrawRectangle (screenw, screenh, -u, -screenh, black); dxDrawImage (u, v, screenw-2*u, screenh-2*v, textures ["crosshair_background"]); dxDrawImage (u, v, screenw-2*u, screenh-2*v, textures ["crosshair"]); end; local function on_weapon_aimed (key, state) if isPedInVehicle(source) then if (getElementModel(source) == 432) then if state == "down" then showPlayerHudComponent ("crosshair", false); addEventHandler ("onClientHUDRender", getRootElement (), render_crosshair); else removeEventHandler ("onClientHUDRender", getRootElement (), render_crosshair); end; end; end; end; addEventHandler ("onClientResourceStart", getResourceRootElement (getThisResource ()), function () -- load textures. textures ["crosshair"] = dxCreateTexture ("images/PKS-07_crosshair.png", "argb", true, "wrap"); if not textures ["crosshair"] then outputDebugString ("failed to load \"images/PKS-07_crosshair.png\" texture", 1); return; end; textures ["crosshair_background"] = dxCreateTexture ("images/PKS-07_crosshair_background.png", "argb", true, "wrap"); if not textures ["crosshair_background"] then outputDebugString ("failed to load \"images/PKS-07_crosshair_background.png\" texture", 1); return; end; bindKey ("aim_weapon", "both", on_weapon_aimed); addEventHandler ("onClientPlayerWeaponSwitch", getRootElement (), function (previousWeaponSlot) local weaponslot_type_sniper = 6; if previousWeaponSlot == weaponslot_type_sniper then if not isPlayerHudComponentVisible ("crosshair") then showPlayerHudComponent ("crosshair", true); end; end; end); end); addEventHandler ("onClientResourceStop", getResourceRootElement (getThisResource ()), function () unbindKey ("aim_weapon", "both", on_weapon_aimed); if not isPlayerHudComponentVisible ("crosshair") then showPlayerHudComponent ("crosshair", true); end; end);
  24. Try change check for first player alive to: #all == 0 and for second player alive to: #all == 1 If I understand the function correctly, it should work.
  25. Omg too funny can't stop laughing!!! That eye iron! Huhahha!!! Aliens sleep in day and human do the reverse which is bad hahahhuhu can't stop laughing!!! Alien capture a human spaceship omg heehehe, stop it can't stop laughing!!! Too much funny hahahahha omg can't believe very very jokey.............. you are most funniest person I've ever encounter in my life time on this plane so called earth......omg hahahahah............hahaha.........
×
×
  • Create New...