
Dealman
Members-
Posts
1,421 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Dealman
-
Not in this thread specifically, no. Hence why I told you to search. But I went ahead and spent the 10 seconds of searching, so you won't have to. This thread.
-
I just answered this not too long ago. Try to search for it and you'll find it - and the answer.
-
Since I haven't got as much time nowadays to work on the various projects I had, nor the interest, really. I thought I'd take another approach on the MTA Community, and that would be to provide descriptive and easy-to-follow tutorials. However, I'd like to ask you guys out there in need of tutorials - what kind of tutorials would you like to see the most? Whether you're in need of it or not, go ahead and suggest it. The bigger the list, the better. The tutorials will be in a written format, I'd love to make videos - but personally, I don't believe in video tutorials when it comes to coding as it can be very hard to read what is being written and follow it precisely. In written format, you can do it at your own pace and it will be much easier to trace backwards in case you did something wrong. I'll take a step back from SQL Tutorials however, while I do have experience with some SQL management, I haven't been doing it through MTA. Current Requested/Suggested Tutorials: • DX Drawn HUD Components
-
I do it like this, however, there is probably a more advanced way to do it. But I've always done it like this and for the most part it works well. I believe I saw 50p reply to a thread with a image of how to do it "properly". First I get the client's screen size using guiGetScreenSize. You then do math like this; local screenX, screenY = guiGetScreenSize() function broDoYouEvenDraw() dxDrawRectangle(screenX*(1184/1366), screenY*(54/768), screenX*(134/1366), screenY*(36/768), tocolor(0, 0, 0, 255), true) end Also, you might wanna re-consider using Ped/Player Events to check if a player was hit and how much armour/health was lost. Currently, depending on what your FPS Limit is set to - you're checking all of that 30-60 times per second.
-
Use the MTA Wiki. If you're gonna make it using GUI, look up GUI Functions. If you're gonna draw it with DirectX, look up Drawing Functions. Then you can store the items via various means, however some sort of SQL Database is probably the best way to do it. For this you can look up SQL Functions(Server side, obviously). As far as I know, there is no guide on how to create some inventory system. Play around with it, you'll learn best that way. People won't come around serving you with things on a silver platter for free around here :
-
Make sure button is properly defined, also make sure the tooltip resource is running.
-
Because "bagb" isn't defined anywhere. So it defaults to nil.
-
First of all, do you have the permission to use this? Secondly, you're supposed to tell us what is wrong - so we can help. Use debugscript.
-
if(getElementData (hitElement, "baga")) and (getElementData(hitElement, "baga") == true) then Doesn't make much sense, (getElementData(hitElement, "baga") == true) should be enough. From what I can see, "bagb" isn't defined.
-
You still don't understand how local variables work. When a local variable is created inside a function, it can not be used outside of that function. Hence why it was fixed when you moved it out. function onResourceStop (thePlayer) exports.bone_attach:detachElementFromBone(bagb) setElementData (thePlayer, "baga", false) end addEventHandler ("onResourceStop", getRootElement(), onResourceStop) As for your current error, thePlayer is not defined. thePlayer is currently the resource-data. onResourceStop will only be triggered if the resource is stopped on the server, not for an individual client. Therefore, you don't need this part of the code as you're doing it when a player quits. If you however do need to trigger code when the resource is stopped on a client, you'll have to use onClientResourceStop - which obviously is client-side. Edit: Another thing is, with your current code, it will be triggered every time ANY resource is stopped. Because you haven't isolated it. If you want to isolate it to the current resource only, you can use this instead of getRootElement(); getResourceRootElement(getThisResource())
-
If you had read my previous replies, you'd of known what is wrong. It is not the same error. It is an entirely different error. Yet again, I'll help you understand the error in hopes that you'll be able to solve such mistakes by yourself in the future. Since I already described the basics, I'll jump right to it. 1. It received a bad argument when trying to create a pickup. It most likely received nil or a boolean(true/false). In this particular case, it received nil. 2. In this case, it fails to set the co-ordinates "X, Y, Z" because of the same reason I stated in a previous reply. local baga = createPickup ( x, y, z, 3, 1210 ) --Here you try to create a pickup, but X, Y and Z are not yet defined. function createBags(thePlayer) local x, y, z = unpack(pbags[math.random(#pbags)]) --Here you define X, Y and Z. But you have already tried to create the pickup, therefore that code will not be run again. --Even more so, it would still not be able to use X, Y and Z since they are >>>>local to this function<<<< end
-
Appreciate your effort but I believe this will be harder than you might think. I don't know how far into it you've gotten, nor do I want to lower your encouragement to continue with it. But I've been doing plenty of 3D Modeling as a side-hobby of mine for a few years, and as such I've used various software to see how they perform and which one I find the best suitable for me and my needs. And it is to my understanding that while Google SketchUp is sleek and simple, it sports a format which is infuriatingly annoying to convert to other formats. Even to formats which are today considered standard. You'll at most times have to pass the original mesh through more than one software to get the format you desire, which is much less than optimal. And as Woovie mentioned, how will you manage to convert it from DAE or KMZ to DFF? If you can't do that, I don't see much use since we'd then have to import it into a software such as 3ds Max either way... Either way, I appreciate the effort you're putting into it since a lot of people would want such a converter. I wish you the best of luck!
-
If you tell me what's wrong, yes. Same error? Different error?
-
You tell me.
-
That's because of how you create the EventHandlers. Let me help you understand error messages, try to understand them instead of simply giving up right away. :24: Bad Argument @ 'addEventHandler', argument 2 got nil 1. Okay, so you know the error is on Line 24. If you're using a program such as Notepad++, this will be easy to find. 2. You know the kind of error is a Bad Argument. This means it expected something specific, but it received something else. For example, it was expecting a pickup element, but because you made baga locally inside a function - it doesn't exist outside of that function. Thus, it is returning nil. Example; local variable1 = "This is a local variable, but created outside a function." function exampleFunction() local variable2 = "This is a local variable" variable3 = "This is a global variable" end function exampleFunction2() outputChatBox(variable1, 255, 255, 255, true) --This will successfully output the variable, since it was created outside of a function. outputChatBox(variable2, 255, 255, 255, true) --This will fail to output, because variable1 is local to the function above. If you use tostring() it will output nil. outputChatBox(variable3, 255, 255, 255, true) --This will output the string successfully. end 3. Argument 2 is what's causing the error, it expected an element but got nil. Therefore, the error. Argument 1, 2 and 3 in order; ("onPlayerQuit", baga, onPlayerQuit) This is how I would do it, in my opinion, it's a whole lot easier to keep track of and understand what certain things do. I'd also advice you against naming functions the same as events. I of course haven't tested this;
-
Like the error says, it received resource-data where it expected a player element. In this case, thePlayer is returning the resoruce-data because of the way you're adding the event handlers. I'd highly suggest you to add those event handlers outside of a function. As it stands, it's a mess and therefore your issue.
-
The code I posted above is retrieving the data. Look at how I added "theGuard" to the function arguments. You can name this whatever you want. "guard" sent via triggerClientEvent will be stored in "theGuard" client-side. If you can't take the time to thoroughly read the MTA Wiki about the functions and how they work, then I won't take the time to help you. Even though I already did
-
Guard should be returning nil on your client, and as such, you should be getting an error message - and provide us with this information to make it easier for us to help you. What you've done wrong here is that you forgot to actually 'retrieve' the data that was sent via the triggerClientEvent. function me (theGuard) setPedControlState (theGuard, "forwards", true) end addEvent ("moveGuard", true) addEventHandler ("moveGuard", getRootElement(), me)
-
Why don't you read it yourself? getAccountPlayer will return a player element, the player that is currently using the account you provide the function with. It will return false if no-one is using the account. getAccountName will return the name of an account, instead of the account element. The account element is what you use to do account-related things - not the actual name, which this function will retrieve.
-
[HELP] dxRectangle and other Stuff [Login Panel]
Dealman replied to =KoG=Rouche's topic in Scripting
It would help if you posted all the relevant code instead of just one small piece. Hard to help you without it. -
[HELP] dxRectangle and other Stuff [Login Panel]
Dealman replied to =KoG=Rouche's topic in Scripting
Are you by chance creating the buttons inside the onClientRender event? If so, you'll be creating a button with every frame. -
Because you're using onResourceStart and not onClientResourceStart. onClientResourceStart will be triggered for each individual player when the resource is downloaded and started on their computer. onResourceStart will only be triggered once the resource is started/restarted.
-
I stopped using Avast when it detected a few of its own files as malicious. :I
-
To use multiple arguments, you'll have to structure your command function like this; function exampleCommand(source, cmd, ...) local cmdArguments = table.concat({...}, " ") local arrayString = split(cmdArguments, " ") local arg1 = arrayString[1] local arg2 = arrayString[2]
-
Alternatively, to make your life easier if you're using GUI - you can use those events; onClientMouseEnter onClientMouseLeave