Jump to content

IIYAMA

Moderators
  • Posts

    6,063
  • Joined

  • Last visited

  • Days Won

    209

Everything posted by IIYAMA

  1. I am not going to make it exact as you want, it is your code. Use: https://wiki.multitheftauto.com/wiki/GetControlState To check if somebody is aiming.
  2. of course it isn't working. The variable player is nil is nothing and useless, when you don't define it. setTimer (function () local players = getElementsByType("player") for i=1,#players do local player = players[i] local target = getPedTarget (player) if target and getElementType (target) == "vehicle" then destroyElement (target) end end end, 500,0)
  3. https://forum.multitheftauto.com/viewtopic.php?f=91&t=73326
  4. If you bought it then you should go back to them. We don't give support to leaked scripts.
  5. The code shows your mistake directly. You were not wondering why most of it was red? exports [ "TopBarChat" ] : sendClientMessage ( [color=#FF0000][b] "[/b][/color]the mission Coming Soon", player, 255, 0, 0, true )
  6. Use more locals at the right places or people can get problems. Especially when you use the variable (which is used often) as a global. Also: for i,v in ipairs(PTable) do for k,s in pairs(PTableValues) do if v == s then TableReturn[k] = i break end end end Why do you do this? What is the use of it, when the tables contain the same information but at a differed array location?
  7. Try: function createVIPTeam () vipTeam = createTeam ( "VIP", 255, 0, 0 ) end addEventHandler("onResourceStart", resourceRoot, createVIPTeam) too: --[[function createVIPTeam ()]] vipTeam = createTeam ( "VIP", 255, 0, 0 ) --[[end addEventHandler("onResourceStart", resourceRoot, createVIPTeam)]] onResourceStart has a delay till all code has been loaded. I am not sure if that is the problem, but it is possible when players login automatic.
  8. IIYAMA

    loadstring

    ok, local env = {} setfenv(user_script, env) pcall(user_script) Using setfenv I can prevent this? But after I set this environment. Will the code inside the environment able to access global variables (read or/and write)? Or just calling other functions disabled? Note: All the code that I am going to load is written by myself and doesn't come from the maps but from the gamemode. The gamemode sends the code which fits with the map.
  9. IIYAMA

    loadstring

    aha, Well I am not going to save the scripts I load via loadstring on the players their harddrive. More like loading modus per map, which is send from the server. But if I do save them, how can a sandbox prevent this?
  10. IIYAMA

    loadstring

    I have never worked with Environments. I found this: http://lua-users.org/wiki/SandBoxes As far as I understand it is a kind of security for the code. What can happen if I don't use a sandbox?
  11. @WhoAmI No, it doesn't work since you skipped they key arguments of the bindKey at the function payTheTicket. I you don't know what I mean, click on the link to his other topic about the same script. @#Twerky Would you pls not post everything double? You won't get better results, but mad moderators if that is what you want... https://forum.multitheftauto.com/viewtopic.php?f=91&t=73202
  12. bindKey ( source, "H", "down", payTheTicket, source) function payTheTicket (theCop,key,keyState,source) https://wiki.multitheftauto.com/wiki/BindKey Server bindKey ( player thePlayer, string key, string keyState, function handlerFunction, [ var arguments, ... ] ) function functionName ( player keyPresser, string key, string keyState, [ var arguments, ... ] )
  13. IIYAMA

    Team Data?

    It must be, element data doesn't change automatic. Unless the teamscore get set at clientside with synchronisation to false, which would be a very strange habit.
  14. IIYAMA

    loadstring

    So I must use it like this? dataForTheFunctionInside = {"my name is IIYAMA","apple","what ever"}-- must be global local callThisFunction = "function myFunction(data) outputChatBox(next(data)) end myFunction(dataForTheFunctionInside)" local callLoadString = function () local loaded = loadstring(callThisFunction) local ex = pcall(loaded) if ex then outputChatBox("loaded the code") end end addCommandHandler("loadstring",callLoadString) (no tested)
  15. Where do you see Samer? O_o Root is more efficient, since it only can be send to players. A loop will call the outputChatBox function over and over, which uses much more memory. You can test that with getTickCount(), if you don't believe me.
  16. np. oh My bad, it was onClientPlayerChoke. I was confused because some ped functions are also for players. addEventHandler("onClientPlayerChoke",localPlayer, function (weapon) if weapon == 41 then cancelEvent( ); end end ) But I don't think you need it since you already use onClientPlayerDamage.
  17. IIYAMA

    loadstring

    Will loadstring execute the code ones and then it is gone? O_o
  18. IIYAMA

    loadstring

    But how can I destroy this string? Because if I load this function: loadstring("function thisFunction() outputChatBox(\"thisFunction\") end") It will stay active.
  19. IIYAMA

    loadstring

    Does anybody knows how I can unload a loaded string? Or at least disable it. Advance stuff, pls only reply if you know what the loadstring function does.
  20. By cancelling this effect. https://wiki.multitheftauto.com/wiki/OnClientPedChoke addEventHandler( "onClientPedChoke", root, function (weapon) if weapon == 41 then cancelEvent( ); end end ) You can also cancel the onClientPlayerDamage event with the same result.
  21. But he isn't using onClientWeaponFire but onClientPlayerWeaponFire. It can be both, source and localPlayer.
  22. client = always the playerElement who sends the data. source = the element that is sending with the event. >triggerServerEvent("onPlayerFilesDownloaded",localPlayer)< But afaik there aren't much people in mta who are able to send events without using a script. Maybe the development team can. I am using source as player too, unless I am sending another element as source.
  23. if CursorX [color=#0040FF]>[/color] [color=#FF0000]0.07426[/color] and CursorY > 0.8098 then if CursorX [color=#0040FF]<[/color] [color=#FF0000]0.01367[/color] and CursorY < 0.8971 then setElementData(getLocalPlayer(), "Class", "Engineer") outputConsole("Engineer") end end Take a closed look at that. It must be higher then 0.07426 and lower then 0.01367, which isn't possible.
  24. IIYAMA

    Vehicles

    @Atton local myVehicleTable = {} function createCar (thePlayer) local car = createVehicle(411,0,0,14) outputChatBox("TRUEm",thePlayer) myVehicleTable[#myVehicleTable + 1]=car-- save inside a table end addCommandHandler("make",createCar) function destroyAllVehicles (thePlayer) outputChatBox("remove",thePlayer) for i=1,#myVehicleTable do local vehicle = myVehicleTable[i] if isElement(vehicle) then destroyElement(vehicle) end end myVehicleTable = {}-- reset end addCommandHandler("remove",destroyAllVehicles) I and you made a mistake with not defining the player. But it should also work with it defining it wrong, not sure why it didn't work. Try this again, it works for 100% /remove @Anubhav Why don't you fix my code instead of rewrite it? What is the use of that anyway... You made a mistake with your table.insert so your code will no work. and you even took my/Atton mistakes with it.
  25. IIYAMA

    Vehicles

    local myVehicleTable = {} function createCar () local car = createVehicle(411,0,0,14) outputChatBox("TRUEm",thePlayer) myVehicleTable[#myVehicleTable+1]=car-- save inside a table end addCommandHandler("make",createCar) function destroyAllVehicles () for i=1,#myVehicleTable do local vehicle = myVehicleTable[i] if isElement(vehicle) then destroyElement(vehicle) end end myVehicleTable = {}-- reset end addCommandHandler("destroy",destroyAllVehicles)
×
×
  • Create New...