Jump to content

Deddalt

Members
  • Posts

    31
  • Joined

  • Last visited

Everything posted by Deddalt

  1. Alright, well, I have been working on making an RP server with a few friends of mine, and currently, I think it has gone quite well. I have started creating the script and have had a lot of help from those of you here on the MTA forums. I have a problem where I can't test-run my MTA script, so I don't know if anything is wrong with my script. I figure I'll tackle that problem first. My script is located at: c:/program files/MTA San Andreas/server/mods/deathmatch/resources/rrp/ My folder contains: Revolution.lua, client/client.lua, meta.xml, and other small scripts to help out. My meta.xml contains: "Maverick" type="server" name="rrp" description="rrp" /> When I run the MTA server, I type "gamemode rrp", which is the name of the folder that all of this is contained in. Immediately when I start the MTA server it tells me "Could not parse 'settings.xml' file . Starting with an empty settings registry." I attempt "gamemode rrp", and it returns " 'rrp' is not a valid gamemode." Now that I have that problem out of the way, I'd like to ask if anyone can tell me if there are errors in this script, to the best of my knowledge (which is minimal), I can't find anything wrong with this script, other than some unfinished commands, which I already know about and plan on fixing. My current script is located at : http://www.pastebin.com/f8ad3762 I'd be grateful if you could alert me to any errors in this script, also if you could help me with my gamemode issue. Also, I heard that setAccountData only sets the data for that session, if that is correct, I have to start over with this script. Is this true?
  2. So how would I use this to make it when someone's login password is wrong, it adds one to the variable for them. Such as my PAWN example, when someone fails to log in, it adds one, and when it gets to five, they get banned. I'm sort of thinking... tbl = {}; -- initialize table ("array") tbl[1] = 1; tbl[5] = 5; tbl["abc"] = "wohoo"; tbl[player] = {}; tbl[player]["logtries"]= 0; function SubmitLogin(thePlayer) local account = getClientAccount(thePlayer) local pass = getAccountData(account, "Player.pass") if(edtPass == pass) triggerServerFunction(onJoin) end else triggerClientFunction(onClientResourceStart) outputChatBox("That log-in information is incorrect. Please try again.",thePlayer,255,0,0) tbl[player]["logtries"] = tbl[player]["logtries"] + 1 -- ************** ? if(tbl[player]["logtries"] >= 5) -- ************** ? local name = getClientName(thePlayer) local ip = getClientIP(thePlayer) banIP(ip) outputChatBox(name.." has been auto-banned. Reason: 5 Failed log-in attempts.") end end end
  3. function onJoin(thePlayer) local account = getClientAccount(thePlayer) local money = getAccountData(account, "players/Player.money") setPlayerMoney(thePlayer, money) end function giveCash(thePlayer, commandName, amount) local account = getClientAccount(source) local admin = getAccountData(account, "players/Player.admin") if(admin >= 1) local name1 = getClientName(source) local name2 = getClientName(thePlayer) givePlayerMoney(thePlayer, amount) outputChatBox("Admin "..name1.." has given you $"..amount, thePlayer,0,255,255) outputChatBox("You have given "..name2.." $"..amount, thePlayer,0,255,255) end addCommandHandler("givecash", giveCash) Of course you still need to use setAccountData when the player joins. So, that script doesn't entirely work yet.
  4. Alright, I have a sneaking suspicion that when someone does something and I set a variable to a different number/value because of it, it is setting that variable for EVERYONE. So that bothers me. I hate to make another C++ example, but I have to. new variable[MAX_PLAYERS]; So then you do: variable[playerid] = 1; Now the variable is set to 1 for that player, but when I'm using LUA, I didn't notice until just now that I hadn't specified such a thing. Could someone please tell me how to set a variable to a value only for the player it is concerning? Currently I'm trying to make a "failed log-in attempt" variable: logtries = 0 -- at the top of the script, not quite sure this works anyway, but still... function SubmitLogin(thePlayer) local account = getClientAccount(thePlayer) local pass = getAccountData(account, "Player.pass") if(edtPass == pass) triggerServerFunction(onJoin) end else triggerClientFunction(onClientResourceStart) outputChatBox("That log-in information is incorrect. Please try again.",thePlayer,255,0,0) tries = tries + 1 if(tries == 5) local name = getClientName(thePlayer) local ip = getClientIP(thePlayer) banIP(ip) outputChatBox(name.." has been auto-banned. Reason: 5 Failed log-in attempts.") end end
  5. Perfect, thank you.
  6. I recently started learning LUA after becoming proficient in C++ with SA-MP. If anyone knows how to script in C++, you know that: new random = random(number)(number)(number); will select one of the random numbers and assign the variable to that value. I want to know how to do this with LUA so that I can have a random vehicle model spawn when the server starts. Thanks for the help.
×
×
  • Create New...