Fantanic Posted October 20, 2013 Share Posted October 20, 2013 Hello , Is there anyway to get a job working when a guy spawns criminal? For Example : When i spawn criminal then i would be able to rob houses. Greetings Link to comment
Dealman Posted October 20, 2013 Share Posted October 20, 2013 Of course there is a way. The problem is that I doubt anyone will do it for you. Either look through the MTA Communty for resources that might suit your need - and maybe edit them to fit your needs better. Others might guide you in the right path, what functions and/or events to use. For example - that you might wanna use setElementData, setAccountData or even SQL to store information like what kind of job the player has. I for one, would prefer the second option as you'll learn yourself how to create what you need, and if the need arises - you'll know(most likely) how to alter the code, since you created it. The choice is yours, we'll be here to help you out once you've got yourself going. Things won't come served on a silver platter Link to comment
Fantanic Posted October 21, 2013 Author Share Posted October 21, 2013 Thanks , was planing this to make it by myself since i like to learn how to script but im still a beginner so i got a question , I dont rlly know how to work with function setElementData , could u give me some more info about it? i see 'playername' but doesnt it supposed to be 'playerteam' ? also dont rlly know how to work with 'setaccountdata' fucntion the pay money thingy is confusing me Link to comment
Castillo Posted October 21, 2013 Share Posted October 21, 2013 Element data is a temporary way of storing data, once the element is destroyed ( e.g: the player quits ), the data is gone. Link to comment
Dealman Posted October 21, 2013 Share Posted October 21, 2013 Look at it this way, it's kind of like a safe. You have a key to access the safe, and once you have access to it - you can retrieve whatever is in there. A very, very simple example; setElementData(localPlayer, "canDrive", "false") This would assign data to the local player. The key is "canDrive". This key is needed to fetch the data's value. In order to fetch the current content(s), you'd have to use getElementData, like this; outputChatBox("Data Contents: "..tostring(dataContents), 255, 0, 0, true) -- This will return nil, since dataContents has not yet actually been defined. Thus it is empty and returns nil. local dataContents = getElementData(localPlayer, "canDrive") -- Fetch the contents and store it to a variable. outputChatBox("Data Contents: "..tostring(dataContents), 255, 0, 0, true) -- This will now return a string, "false". It might seem a bit confusing at first, but once you've used it a few times - it's rather easy to work with. But however, do note that this is only a temporary way to store data. There are many different ways to achieve permanently stored data. Link to comment
Fantanic Posted October 22, 2013 Author Share Posted October 22, 2013 Hm seems i understund a bit more , i will try to script a bit the next week , got to do alot of other stuff Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now