pa3ck
Members-
Posts
1,141 -
Joined
-
Last visited
-
Days Won
7
Everything posted by pa3ck
-
Change it to if tonumber(percentage) and percentage < 100 then And please use the <> button next time to insert your Lua code.
-
function hasPlayerLotteryTicket(player) local hasTicket = false for k, v in ipairs(LOT_TICKETS) do local tPlr = v[1] local tNum = v[2] if isElement(tPlr) and player == tPlr then outputChatBox("You already bought a ticket, your number is: " .. tNum, player ) hasTicket = true break end end return hasTicket end Add the above code to your script and change line 162 to this: if LOT_ON and not hasPlayerLotteryTicket(me) then That should do it, although I haven't tested it myself, if it's not working correctly, use /debugscript 3 and come back with the error. Explanation: There's a table called LOT_TICKETS which stores all the tickets that are currently owned by players. Every single 'row' of this table is another, nested table, which looks like this: LOT_TICKETS = { {"player1", 10}, {"player2", 87}, {"player3", 55}, } "player1", "player2", "player3" are actually not strings, but userdata values which point to a player element, so if you loop through the table and check them one by one, you will be able to check it against the source element of the /ticket command
-
You shouldn't ask questions like this in the tutorial section... Please take your code and post it to this section: https://forum.multitheftauto.com/forum/71-scripting/ Before posting, make sure you also look at this post:
-
I'm not sure I understand that, what do you mean you would be lucky finding that position again?
-
[REQUEST] Code which shows server status on website
pa3ck replied to koragg's topic in Looking for staff
Maybe a banner from a website like game-state.com? Or you want to have your own? -
If it's not working that way you'll need to create a function which will call the export, you can call functions from JS
-
Use colshapes to create safe zones. local shapes = {} local positions = { {123, 456, 50, 50}, {123, 456, 50, 50} } for k, v in ipairs(positions) do local shape = createColRectangle( ... ) table.insert(shapes, shape) end function startBuilding() if not isPlayerInSafezone(player) then -- building code else outputChatBox("in safe zone") end end function isPlayerInSafezone(player) for k, v in ipairs(shapes) do if isElementWithinColShape(player, v ) then return true end end return false end Not a working code, modify it yourself to suit your needs (eg. player element)
-
I don't think you understand what he wants, he wants to manually insert text into the chatbox. Not like "GlobalChat: " or "LocalChat: " but something along the lines of: "GlobalChat: My name is " then you would type your name.
-
Not just that line actually, but on these lines 4, 8, 16, 20. You probably copy-pasted them.
-
That's just stupid, you actually can.. what the hell, never tried that, I just assumed you couldn't. Then the only problem with his code was the missing [ ]. local values = { [ thirdnodes [ twonodes [ 1 ] ] ] ={"false"} } --> no errors local values = { thirdnodes [ twonodes [ 1 ] ] = { "false" } } --> error
- 10 replies
-
- lua
- lua tables
-
(and 2 more)
Tagged with:
-
Nah, actually I just looked at your code again, you are not far off from the solution, I see what you are trying to do... the problem is with this line: local values = {thirdnodes[twonodes[1]]={"false"}} Instead of that, it should be something like this: local values = { [ thirdnodes [ twonodes [ 1 ] ][ 1 ] ]={"false"}} So there are two things you missed. You forgot to put the key between [ ] and also that thirdnotes[twonodes[1]] will return the table with {"username", "password", rememberMe"}, which means you wanted the key to be a table. But if you put a [1] after it, the key will be "username". Tested on this: local twonodes = {"login", "rpteszt"} local thirdnodes = {[twonodes[1]] = {"username","password", "rememberMe"}, [twonodes[2]]={"rpteszt"}} local values = { [ thirdnodes[twonodes[1]][1]]={"false"}} print(thirdnodes[twonodes[1]][1]) --[[ Output: username ]]
- 10 replies
-
- lua
- lua tables
-
(and 2 more)
Tagged with:
-
I seen that as well, but I think it's ridiculous. Why are they suing OpenIV? Is it illegal to mod my game? I mean I bought the game, why can't I do whatever the hell I want with it?
-
No, that doesn't seem right at all. local twonodes = { "login", "rpteszt" } local thirdnodes = { [1] = {"username","password", "rememberMe"}, [2]={"rpteszt"} } local values = { [1]={"false"} } Such a helpful fellow you are.
- 10 replies
-
- 1
-
- lua
- lua tables
-
(and 2 more)
Tagged with:
-
And how exactly is that going to manually put words in the text input of the chatbox?
-
If you look at setTimer on the wiki, you will understand, but to give you an idea local myTimer = setTimer( function(text) outputChatBox("Timer after 5 seconds: " .. text) end, 5000, 1, "myParam1") function myFunctionName(text) outputChatBox("Timer after 5 seconds: " .. text) end local myTimer = setTimer( myFunctionName, 5000, 1, "myParam1") -- function() ... end -> anonymous function -- myFunctionName -> if you already have a function you will call -- 5000 -> when should the timer start in ms, so 5000 = 5 seconds -- 1 -> how many times the timer should run, every 5 seconds | 0 = infinite -- myParam1 -> parameters you will pass to the function
-
You will find the solution in this topic:
-
As I said in my 'instructions' (I kinda regret writing it now, because you are clearly not using it), you will get a row of nested tables. If I did a SELECT * FROM players query, I would get number of rows back, right? So who's X position would result["x"] be? A random player? Maybe Chuck Norris? local x = tostring(result[1]["x"]) -- first row Here's an explanation again, this time no text, just a simple image..
-
I do understand that... but you're missing dbPoll which is basically present in every single example on the wiki and here as well.
-
I agree, GTA V is definitely the 'future'. But you can't just ask the MTA Devs to come up with a completely new GTA V project, they have been working on MTA:SA for years and honestly, they did such a good job that you would think it was released by Rockstar itself. I don't think the name of the other GTA V projects are a big secret, I only know of 2, GTA:Network and FiveM, but they're both still in very early stages and have their own limitations. For example FiveM can only hold up to 32 players (as far as I remember), but they use GTA online syncer, not their own. GTA:Network on the other hand has their own syncer with higher slot numbers, but as expected, way worse than the other one.
-
Are you able to add an account with different name?
-
Please take your time, scroll up a bit and look at my code / wiki. What do you think you missed? You tell me. Compare my (or code from wiki) against yours and don't take callback into account, that is not the problem here.