jkub Posted August 27, 2008 Share Posted August 27, 2008 (edited) I got the bank script from the resources page and I want to make it to where you can login to your own player account on my server and you can keep track of your bank account. like you can save your money to your account and when you come back the next day youl still be able to have the money you had the day b4... sort of like an rpg>> how would i do that? Edited August 27, 2008 by Guest Link to comment
Gamesnert Posted August 27, 2008 Share Posted August 27, 2008 I got the bank script from the resources page and I want to make it to where you can login to your own player account on my server and you can keep track of your bank account. like you can save your money to your account and when you come back the next day youl still be able to have the money you had the day b4... sort of like an rpg>> how would i do that? Ehm... Do you know anything about XML, tables or in combination? XML is really good for saving things, but slow. Tables store things, but only for one session. This means: Make a few GUI's, store their deposited and withdrawn money in tables and write it in at the last moment. Just an example. But IF you need to learn new things anyway, I would (*ahem*, the rest of the forum members would) recommend you to save it in SQL. Or MySQL. But I'm not an expert on (My)SQL, so don't ask me about that... I don't know if you know how any of those things work? If not, do you know how it works to save all the data temporarily? Be sure you know how to do that, since you'll need to know that to be able to make it work dang fast. (combination of my method and (My)SQL FTW! ) Link to comment
jkub Posted August 27, 2008 Author Share Posted August 27, 2008 Im sorry i didnt do this earlier, i dont wanna post multiple topics for single questions but can you also help me step by step on how to output a chat message alerting everyone when a player has pulled out a disallowed wepon such as a minigun? i would use both events and functions right and which function or event would I use to monitor players weapons and I know already that putting the outputchatbox command right after the getweaponline will not work because they have to be linked somehow. Link to comment
Gamesnert Posted August 28, 2008 Share Posted August 28, 2008 How you alert of a minigun? Fairly simple, only finding out is a bit harder: function weaponSwitchDisableMinigun ( previousWeaponID, currentWeaponID ) --when a player switches his weapon if currentWeaponID == 38 then --if the weapon ID is minigun toggleControl ( source, "fire", false ) --disable the fire button else --otherwise toggleControl ( source, "fire", true ) --enable it end --add an event handler for onPlayerWeaponSwitch addEventHandler ( "onPlayerWeaponSwitch", getRootElement(), weaponSwitchDisableMinigun ) This is an example from the wiki, from the page onPlayerWeaponSwitch Let's modify it for your use shall we? function weaponSwitchDisableMinigun ( previousWeaponID, currentWeaponID ) if currentWeaponID == 38 then outputChatBox ( "Warning! You now have an illegal weapon in your hands! Shoot and you'll be banned!", source, 255, 0, 0 ) end end addEventHandler ( "onPlayerWeaponSwitch", getRootElement(), weaponSwitchDisableMinigun ) That should work. Link to comment
jkub Posted August 28, 2008 Author Share Posted August 28, 2008 thanks man that worked like a charm! Link to comment
Gamesnert Posted August 28, 2008 Share Posted August 28, 2008 thanks man that worked like a charm! If you don't mind, I would recommend you to look around the forums for all kinds of commands and examples, and expanding your knowledge, and then making a start. So you can prove you can script. If we just give you the piece of script, you won't learn from it. Link to comment
jkub Posted August 28, 2008 Author Share Posted August 28, 2008 actually man this may sound ironic but i have actually been looking around. Ive looked at alot of things on the wiki lol. Link to comment
Gamesnert Posted August 28, 2008 Share Posted August 28, 2008 actually man this may sound ironic but i have actually been looking around. Ive looked at alot of things on the wiki lol. Yes, looking and remembering are simple. But, did you actually understand them? That's the major factor! Anyway, I'll put on a little example script soon. It'll be extremely simple, so you might want to look at it and make your own, with mine as an example. (or someone else must post something in the meantime... =/) But I'm going to play Red Alert 3 Beta first! ^^ Link to comment
jkub Posted August 28, 2008 Author Share Posted August 28, 2008 what if i wanted to functions on the minigun pull out like have the warning message and a loss of health for the culprit, how would the 2 functions work in unison? wat command or function would join both functions together would it be and or also? Link to comment
jkub Posted August 29, 2008 Author Share Posted August 29, 2008 hey the minigun script is ok but it is not serverside witch i figured out recently... how do i make it serverside? Link to comment
haybail Posted August 29, 2008 Share Posted August 29, 2008 It looks serverside, are you sure? You said you have the bank script, that does all the bank stuff you mentioned almost down to a tee. Did you manage to get it working? Link to comment
jkub Posted August 29, 2008 Author Share Posted August 29, 2008 at first i got a mini myself to test it with others in the server and they said they didnt see the message. but later ithink i ended up fixed it. I took an outputchatbox function with a getelementroot thingy. the one b4 didnt have it. I dont know why that would make it server side but i tested the changed script and this time they said they did see it. so i guess it worked Link to comment
haybail Posted August 29, 2008 Share Posted August 29, 2008 Its because of the source used in outputChatBox function. It makes it only visible to the player who switched their weapon. Like this: outputChatBox ( string text, [ element visibleTo=getRootElement(), int r=255, int g=255, int b=255, bool colorCoded=false ] ) visibleTo: This specifies who the chat is visible to. Any players in this element will see the chat message. See visibility. http://development.mtasa.com/index.php? ... putChatBox Link to comment
jkub Posted August 29, 2008 Author Share Posted August 29, 2008 ohh so thats why. thanks im gonna study this shit more and try to make more since of it>>> Link to comment
haybail Posted August 29, 2008 Share Posted August 29, 2008 Good idea. its a little difficult at first but as you get it you'll get quicker. it becomes so easy u forget why u didn't get it in the first place Link to comment
Gamesnert Posted August 29, 2008 Share Posted August 29, 2008 ohh so thats why. thanks im gonna study this :~ more and try to make more since of it>>> The small details count. I have made a small start, but had to leave the house for quite some time unexpected... So the start is... Creating a file... And... Eh... Naming the file... Link to comment
jkub Posted August 29, 2008 Author Share Posted August 29, 2008 ill do some more studying on this soon as i get home lol I used to do everything on notepad anyway, even switching to an actual lua editor helped a bit lol. how ironic Link to comment
Gamesnert Posted August 29, 2008 Share Posted August 29, 2008 ill do some more studying on this soon as i get home lol I used to do everything on notepad anyway, even switching to an actual lua editor helped a bit lol. how ironic You didn't use a good editor? Lol that'd explain things... Anyway, I think that if you learn everything step-by-step from the tutorials, (WITH the editor ) then you'll be able to answer your first question yourself. Link to comment
jkub Posted August 30, 2008 Author Share Posted August 30, 2008 wats the difference between "setplayermoney" and "giveplayermoney" Link to comment
haybail Posted August 30, 2008 Share Posted August 30, 2008 if you have $500 and you use givePlayerMoney, it will plus it on so say you do givePlayerMoney $250 it will be $500 + $250 = $750. Same but opposite for takePlayerMoney. setPlayerMoney doesn't and it will set the money as whatever you say so if you do $5000 and have on you $750 it will put it at $5000. If it was givePlayerMoney it would be $5750. Link to comment
jkub Posted August 30, 2008 Author Share Posted August 30, 2008 k thanks man, couldent of said it better Link to comment
jkub Posted August 30, 2008 Author Share Posted August 30, 2008 hey when i am doing this I always get debug erros that say somthing about "".... what does mean? Link to comment
jkub Posted August 30, 2008 Author Share Posted August 30, 2008 Im currently trying to do a simple createmarker script that spawns a read marker at 0 5 1 and I keep getting different debug errors here is the current script marker = createMarker (0, 5, 1, cylinder, 3, 255, 0, 0, 175,) Link to comment
haybail Posted August 30, 2008 Share Posted August 30, 2008 I'm not sure exactly but I usually look at the information after eof. like the line number etc, and the error. Um, I think you forgot the "" around cylinder. And the comma at the end may be a problem. 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