Jump to content

DiSaMe

Helpers
  • Posts

    1,461
  • Joined

  • Last visited

  • Days Won

    34

Everything posted by DiSaMe

  1. What function? MTA doesn't count the players who have visited. You have to do it. Using "onPlayerJoin" event.
  2. I'm not sure how you managed to get a warning related to 'getVehicleOccupant', since I don't see it inside your script. Not at line 52, at least. As for 'unpack', that's obvious: trainData[vehicle] = { ["money"]=trainTable["money"], ["spawn"]=trainTable["spawn"], ["marker"]=trainTable["marker"], ["train"] = vehicle, ["blip"] = finishBlip, ["finishmarker"] = finishMarker } destroyElement (unpack(trainTable["finishmarker"])) destroyElement (unpack(trainTable["blip"])) destroyElement (unpack(trainTable["train"])) trainTable["finishmarker"], trainTable["blip"] and trainTable["train"] are elements and you're passing them to 'unpack'. Also, I don't know what this thing means: addEventHandler("startTrainJob", root, startTrainJob, localPlayer) 'localPlayer' is nil on the server-side (unless you assign anything to this variable yourself, of course) and 'addEventHandler' takes a boolean as 4th argument, but this argument is about propagation, and I don't think it's related to whatever you're trying to do.
  3. DiSaMe

    Table

    Animations, weapon ammo, stats and other stuff are not visible to the client unless they were set since the last time the ped was streamed in. If animation is applied before the ped has time to be streamed in for the client, the animation won't show. In either case, it won't show when the player goes far away and returns back. The simplest workaround is setting a timer which keeps applying the animation every few seconds. By the way... setTimer(setPedAnimation(c_Dancers, "DANCING", "dnce_M_a"), 5000,1) This executes setPedAnimation, which most likely returns true, and then passes true as the first argument to setTimer. Which changes nothing except calling setTimer with invalid arguments, producing a warning message. Instead, you need to pass the called function and its arguments as arguments of setPedAnimation: setTimer(setPedAnimation, 5000,1, c_Dancers, "DANCING", "dnce_M_a")
  4. https://wiki.multitheftauto.com/wiki/OnPlayerJoin https://wiki.multitheftauto.com/wiki/OnPlayerQuit
  5. DiSaMe

    Money help

    takePlayerMoney needs player as the first argument. And = is assignment operator. Use == to check if values are equal to each other (though there's no need to check for equality in this case).
  6. But it's more efficient to use the team as table key like Necktrox did rather than loop through the table and check the player's team against every value.
  7. So that servers could DDoS other servers? Doesn't sound good. Unless a client-side setting or confirmation window was made, but that still would be less convenient for players.
  8. Yeah, I did make a generator, but a couple of videos is the only thing I've produced (in case someone assumes wrong, it's not the same script in the image under that link). I tried making my own streamer to avoid reaching the element limit, but object creation/destruction were very slow back then. Also, trees were streamed out at short distance, but this problem would become less relevant with some improvements. Well, then I guess I'll stick with PayPal for now before I see what's what.
  9. Then rotate it from within "onClientPreRender".
  10. Thanks, and yeah, it's just that the range cannot be strictly defined, but... Maybe I'll try something
  11. Obviously, you can only use the last markers because they're the ones the event handlers are attached to. They are the ones whose values are assigned to the variables last, therefore all previous values are overwritten. You could call 'addEventHandler' in the same loop they're created. Or you could create some abstract element with 'createElement', attach event handler to them and make this abstract element the parent of marker elements using 'setElementMarker'. Or you could create a set of markers (the table where markers are keys and boolean values 'true' are values), attach the event handler to root and check for presence of marker in the set from within the event handler. As you can see, there are many things you could do to achieve the result.
  12. DiSaMe

    Cursor speed

    I might be wrong, but if I remember correctly, https://wiki.multitheftauto.com/wiki/OnClientCursorMove is triggered regardless of whether the cursor is visible or not.
  13. So, detect when the player logs in using "onPlayerLogin", check the data and depending on what is set, either play the intro movie or don't. What's so hard to understand?
  14. No, seriously, how are you playing the intro movie on login if client doesn't detect when the player logs in in the first place?
  15. If such actions like intro movie on login are initiated from client side, I don't think that's a sign of good design. How are login operations processed in the first place? Of course they're processed in the server, aren't they? So that's where the data should be checked and intro movie initiated.
  16. You mean allowing MTA servers to execute arbitrary C++ code on clients? Not a good idea.
  17. There's a function for that: removeAccount Also, as far as I know, MTA stores accounts into SQLite database or something like that, so you can probably remove them from file with some browser of such databases.
  18. Novo, you did a little mistake here: math.sqrt((mx-x)^2 + (my-y)^2) <= radius^2 You're calculating the square root and comparing it to square of radius. Either square root shouldn't be calculated or radius itself (not the square) should be used.
  19. Oh, well, I just tried it and it doesn't seem to work. Either I did something wrong or it just doesn't work for sniper rifle. The latter case is more likely, so maybe you should detect when the player switches to/from sniper rifle using "onClientPlayerWeaponSwitch" event and toggle the control from there.
  20. DiSaMe

    Stealth kill

    function isZombieBehindPlayer(zombie, player) local px, py, pz = getElementPosition(player) local zx, zy, zz = getElementPosition(zombie) local zdx, zdy = zx-px, zy-py -- direction from player to zombie local _, _, pr = getElementRotation(player) pr = -math.rad(pr) local fdx, fdy = math.sin(pr), math.cos(pr) -- player's front direction return zdx*fdx+zdy*fdy < 0 -- dot product is less than 0 if vectors point to opposite directions end
×
×
  • Create New...