• CellMod - a DarkRP module
    147 replies, posted
  • Avatar of Blt950
  • [release] [img]http://dl.dropbox.com/u/36492466/CellMod%20Pics/CellMod_Logo_MB.png[/img] [/release] [release] [highlight]What is CellMod?[/highlight] [video=youtube;d5AvParQxpQ]http://www.youtube.com/watch?v=d5AvParQxpQ[/video] [img]http://dl.dropbox.com/u/36492466/CellMod%20Pics/SmallSeperator.png[/img] [highlight]What functions does CellMod give me?[/highlight] Calling, Texting, Signal Core, and making your own cellphone company! [img]http://dl.dropbox.com/u/36492466/CellMod%20Pics/Signal.jpg[/img] This is the Signal Frame that you'll see all the time, at the bottom right at your screen. [b]Calling[/b] Calling function is the most central function in CellMod. You can /call <player> to start dial, the player then has to approve your call by picking up the phone (/pickup). Or he can /hangup and don't answer your call. The calls cost X amount (that is defined by the provider) each minute. [b]Textmessages[/b] This function will probably mostly used. You simply /text <player> <text> or /sms You pay each message sent, the amount is defined by the provider. [b]Signal Core[/b] This is a core that I made for the CellMod. The basic idea here is that every phone has reception. The signal core decides how much reception you have, and when you loose it. It's based on already scripted-in areas from before, and also amount of props around you, if you are in a area with extremely many props, your reception will drop (It never drops to No Signal state). I made the reception drop, when you are near very many props. Since then you get this feeling that more stuff, is blocking the signal. If you try to call someone or text someone, that is inside no-signal area. You'll not be able to send the message or run the call. If you are in a existing conversation and one of you two enter a no signal area, the conversation will be terminated. [i]There are currently only already scripted-in areas for signal for rp_downtown_v2 only. Expect more maps in next update![/i] [b]Make your own cell provider[/b] Make your own company with your own decided prices. Choose how much a textmessage costs, and per minute a call cost, also name your company what ever you want! And give your simcard to other players with /givesim <name> command! Let's see how many costumers you get! [/release] [release] [highlight]Download[/highlight] [url=http://www.garrysmod.org/downloads/?a=view&id=126058][b]v.1.2[/b][/url] [b]Doesn't work for G13. Feel free to download it and fix it yourself if you wish[/b] [b]Important Instruction of Install[/b] [i]1.[/i] Download the CellMod zip file. [i]2.[/i] Unzip it, and place it correctly in the DarkRP folder (It's zipped just to drag and drop). [i]3.[/i] Enjoy and have fun calling! [b]Note[/b] The CellMod has not been updated for almost a year, don't expect it to work at all / completly. [b]License[/b] [url=http://creativecommons.org/licenses/by-nc-nd/3.0/deed.en_US][img]http://i.creativecommons.org/l/by-nc-nd/3.0/88x31.png[/img][/url] CellMod by [url=http://blt950.com]Blt950[/url] is licensed under a [url=http://creativecommons.org/licenses/by-nc-nd/3.0/deed.en_US]Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License[/url]. [b]Changelog[/b] You can find the changelog by clicking [url=http://pastebin.com/mPWxHYB0]here[/url] [/release] [release] [highlight]To-Do List[/highlight] [b]Future Update Plans[/b] Ideas for next version. [code] - Remove the default coverage settings. Meaning: The provider needs to build cell towers, to give signal coverage to their clients. - Cellphone provider company owner gets earning by clients using their service. (Not sure if I already implanted this or not, but it's going to be there) - A visible counter down in the CellMod frame, showing the current call conversation duration. - Fix the CellMod not loading properly on each restart of server, and compatible with Gmod 13 DarkRP. - Make the entities that will be the Cell towers, that gives coverage to clients. A operator's cell tower will only send out his own signals. - Bad signal will start to break up messages and delay them. Where texts will be simply delayed. And conversations would suddenly remove characters/words and breaking it up, and also delay them. - Monthly payment from clients to owner: This will be X amount each payday probably. It will be optional to have this for companies. - You can change call/text prices even after you've created the company. Maybe also make different subscriptions for one company? Like two different ones, one where you pay no "monthly" fee, but calls are more expensive, and opposite. That will be up for you as provider to decide! - Some sort of animation that shows you're talking in a phone. - Maybe add a optional function for admins to disable/enable PMing, so people don't use it for free messages. - A GUI for company owners, and players. Players will have a nice view all sent/recieved text messages, and call history and so on. The provider owners will have all their company settings in there, such as plans, towers, income, outcome and so on. - Fix GM:OnPlayerDeath, I overrided the function, instead of hook it. [/code] [/release] [release] [highlight]Thanks to...[/highlight] [b]Development[/b] Blt950 (me) [b]Beta Testers[/b] - Torb - PetruZ - JamieH - LiX [b]Ideas[/b] - Torb - PetruZ - Master One Also thanks to FPtje for some helping, with some tips for the development! [i]Forgot to add somone? PM me, and I'll fix it[/i] [/release]
  • Avatar of Hugabuga
  • Actually, this is one of the nicest DarkRP module's I've seen. Surely it can be improved.
  • Avatar of Blt950
  • [QUOTE=Persious;32711775]Actually, this is one of the nicest DarkRP module's I've seen. Surely it can be improved.[/QUOTE] Thank you! As I've told, improvements comes now in future updates. So the updates going to make it more exiting and fun :)
  • Avatar of czmate10
  • Finally not one "admin abuse commands" darkrp module... Congratulations, sir!
  • Avatar of FPtje
  • I very well appreciate this module. I was hoping that some day people would make addons for DarkRP. This was a great idea, I'd like to see it in game, so I'll test it. Great work.
  • Avatar of Breny
  • Now there's only one thing left for us to do: find a decent RP server running this addon.. Any test servers?
  • Avatar of Blt950
  • [QUOTE=Breny;32714617]Now there's only one thing left for us to do: find a decent RP server running this addon.. Any test servers?[/QUOTE] Indeed; Any servers running CellMod, send me a PM :) I'll list you up here on the main thread, and maybe you will be lucky to get a visit by me sometime :]
  • When a user sends a text or calls somebody, where does the money go? Will it go into the Mobile Operator's pocket?
  • Now I feel like running a DarkRP server just for this. Good job mister.
  • Avatar of Blt950
  • [QUOTE=chuck14;32715823]Now I feel like running a DarkRP server just for this. Good job mister.[/QUOTE] Thank you :) [QUOTE=crispylego;32715468]When a user sends a text or calls somebody, where does the money go? Will it go into the Mobile Operator's pocket?[/QUOTE] The money currently don't go anywhere, which is a little fault of my own side to forget to add. This will probably come in the first update v.1.1 :)
  • Avatar of Kopimi
  • Really cool module, though you use networked variables in a lot of places that you.. well, don't need to be networking things :v: I would advise going through your script and checking to make sure that every single NWVar you use [b]has[/b] to be access by everyone on the map. If you don't need everyone on the server to be aware of an NWVar, don't use an NWVar. Also, don't use SendLua so much. Use usermessages, they're a lot more reliable. SendLua has a limit to how much data can be transferred per message and sometimes the data will be dropped or cut off at a certain character limit and the client will end up executing an unfinished script. Other than that, it's a really cool mod, good job :) EDIT: Flawless just pointed out that you use Think hooks a lot.. and, well, really poorly actually :v: You have 3 functions hooked to "Think", which is a bad start. Think is called each tick, and you're running it on the server, so you'll be lagging the server quite a bit, mostly because in each of the three Think hooks you're calling, you're looping through all the players in the map, which means each tick of the server, you're making the server loop through the players and perform various actions, including modifying networked data, 3 times every tick, which is bad. In CM.ChangedTeam() you loop through each player on the server (Once again in the Think hook), and then inside an if-statement you're looping through each player AGAIN, in the middle of an ongoing for-loop through each player in the server. Essentially, it's possible that you're looping through every player in the server 3-4 times each tick, PLUS doing an additional loop for every player on the server. That's a lot of loops :v: [lua]function CM.ChangedTeam() -- Somehow the default detect team functions didnt want to co-operate :( So I made this crappy workaround. for k,user in pairs(player.GetAll()) do if user:Team() == TEAM_MOPERATOR and not user:GetNWBool("cm_config") then user:SetNWBool("cm_config", true) user:ConCommand("cm_companyconfigwindow") elseif user:Team() != TEAM_MOPERATOR and user:GetNWString("cm_company") == user:GetNWString("cm_operator") and user:GetNWString("cm_company") != nil and user:GetNWString("cm_company") != "" and user:GetNWString("cm_operator") != nil and user:GetNWString("cm_operator") != "" then for k, v in pairs(player.GetAll()) do if v:GetNWString("cm_operator") == user:GetNWString("cm_company") then v:SendLua("chat.AddText(Color(255,50,0), 'Your cellphone operator "..user:GetNWString("cm_company").." has been dissolved')") v:SendLua("chat.AddText(Color(255,50,0), 'Your current simcard will still work untill you change.')") end end user:SetNWString("cm_operator", "") user:SetNWString("cm_company", "") elseif user:Team() != TEAM_MOPERATOR then user:SetNWBool("cm_config", false) end end end hook.Add("Think", "CM.ChangedTeam", CM.ChangedTeam)[/lua] Using the think hook is fine, you just need to know how to control your intervals. Create a single function hooked to Think, and put all of your current Think hook logic inside that function, then make a variable named "cm_NextTick" and use that to delay the execution of your code, er, here lemme show you: [lua] local cm_NextTick = CurTime() local cm_TickDelay = 3 function CM.Think() if CurTime() >= cm_NextTick then --If it's time to run our tick.. --Run the code cm_NextTick = CurTime() + cm_TickDelay --Delay the next tick end end hook.Add("Think", "CMThink", CM.Think) [/lua] _____ These are all honest mistakes and nobody should be railing on you for making them, but you should definitely fix these issues if you want people to use this addon on their servers.
  • Really nice module, will definitely run this on my server but I have a little trouble getting it to work properly. The sounds are not working because you haven't included the sound files in the download and the SIM picture is not showing up - it's just a black/purple square. Did I install it wrong or did you simply forgot to include some files? / LiX
  • Avatar of Juke-Box-Hero
  • My server currently is running this addon. I Like it alot. Check it out. It's a build RP server. Just say your from here and youll get a reward :) Server IP: 75.102.41.50:27015
  • Avatar of Blt950
  • [QUOTE=Kopimi;32718880]Really cool module, though you use networked variables in a lot of places that you.. well, don't need to be networking things :v: I would advise going through your script and checking to make sure that every single NWVar you use [b]has[/b] to be access by everyone on the map. If you don't need everyone on the server to be aware of an NWVar, don't use an NWVar. Also, don't use SendLua so much. Use usermessages, they're a lot more reliable. SendLua has a limit to how much data can be transferred per message and sometimes the data will be dropped or cut off at a certain character limit and the client will end up executing an unfinished script. Other than that, it's a really cool mod, good job :) EDIT: Flawless just pointed out that you use Think hooks a lot.. and, well, really poorly actually :v: You have 3 functions hooked to "Think", which is a bad start. Think is called each tick, and you're running it on the server, so you'll be lagging the server quite a bit, mostly because in each of the three Think hooks you're calling, you're looping through all the players in the map, which means each tick of the server, you're making the server loop through the players and perform various actions, including modifying networked data, 3 times every tick, which is bad. In CM.ChangedTeam() you loop through each player on the server (Once again in the Think hook), and then inside an if-statement you're looping through each player AGAIN, in the middle of an ongoing for-loop through each player in the server. Essentially, it's possible that you're looping through every player in the server 3-4 times each tick, PLUS doing an additional loop for every player on the server. That's a lot of loops :v: [lua]function CM.ChangedTeam() -- Somehow the default detect team functions didnt want to co-operate :( So I made this crappy workaround. for k,user in pairs(player.GetAll()) do if user:Team() == TEAM_MOPERATOR and not user:GetNWBool("cm_config") then user:SetNWBool("cm_config", true) user:ConCommand("cm_companyconfigwindow") elseif user:Team() != TEAM_MOPERATOR and user:GetNWString("cm_company") == user:GetNWString("cm_operator") and user:GetNWString("cm_company") != nil and user:GetNWString("cm_company") != "" and user:GetNWString("cm_operator") != nil and user:GetNWString("cm_operator") != "" then for k, v in pairs(player.GetAll()) do if v:GetNWString("cm_operator") == user:GetNWString("cm_company") then v:SendLua("chat.AddText(Color(255,50,0), 'Your cellphone operator "..user:GetNWString("cm_company").." has been dissolved')") v:SendLua("chat.AddText(Color(255,50,0), 'Your current simcard will still work untill you change.')") end end user:SetNWString("cm_operator", "") user:SetNWString("cm_company", "") elseif user:Team() != TEAM_MOPERATOR then user:SetNWBool("cm_config", false) end end end hook.Add("Think", "CM.ChangedTeam", CM.ChangedTeam)[/lua] Using the think hook is fine, you just need to know how to control your intervals. Create a single function hooked to Think, and put all of your current Think hook logic inside that function, then make a variable named "cm_NextTick" and use that to delay the execution of your code, er, here lemme show you: [lua] local cm_NextTick = CurTime() local cm_TickDelay = 3 function CM.Think() if CurTime() >= cm_NextTick then --If it's time to run our tick.. --Run the code cm_NextTick = CurTime() + cm_TickDelay --Delay the next tick end end hook.Add("Think", "CMThink", CM.Think) [/lua] _____ These are all honest mistakes and nobody should be railing on you for making them, but you should definitely fix these issues if you want people to use this addon on their servers.[/QUOTE] Yeah! I'm completly aware of my missuse of NWvars and stuff, I actually started making the module with DarkRPvars instead, then I found out; They didn't want to co-operate with me, heh. So I just made it NWvars. I've already listed optimizing as a point for v.1.1 update, where I will fix stuff like these double loops, and use Usermessages for SendLua and Vars, and stuff that can be used with it :) Thanks for the advice anyway! And also, as I commented in the script it self ".... so I made this crappy workaround" heh. [editline]11th October 2011[/editline] [QUOTE=LiX;32719251]Really nice module, will definitely run this on my server but I have a little trouble getting it to work properly. The sounds are not working because you haven't included the sound files in the download and the SIM picture is not showing up - it's just a black/purple square. Did I install it wrong or did you simply forgot to include some files? / LiX[/QUOTE] I'm pretty sure they should be included, I had that issue myself, but I fixed it. So I think it should be working. If you notice I forgot something, then write again. And I'll check it out, maybe it's a bug.
  • [QUOTE] I'm pretty sure they should be included, I had that issue myself, but I fixed it. So I think it should be working. If you notice I forgot something, then write again. And I'll check it out, maybe it's a bug. [/QUOTE] I have been trying to get it to work for a while now but it's not possible. No sounds and no SIM picture. Could you tell me what you did to fix it? Hope this will be fixed soon, can't wait! :) / LiX
  • Avatar of Blt950
  • [highlight]IMPORTANT[/highlight] The v.1.1 has been released. The only change is: I added the missing sounds and material files that I forgot in 1.0 [b]*facepalm*[/b]
  • Avatar of FPtje
  • When you sent me the PM about overriding the /call thing, I thought you had already tried the playerSay hook. You haven't O_o This code demonstrates how to override DarkRP's chat command "/call". [lua]hook.Add("PlayerSay", "CM.Callingstuff", function(ply, text, teamonly, dead) if string.find(text, "/call") then -- Do your stuff here return "" -- Return "" to make sure it doesn't show up in chat end end) [/lua] I strongly suggest you check out the [url=http://wiki.garrysmod.com/?title=Gamemode_Hooks]Gamemode hooks[/url] page to see what hooks are available.
  • Avatar of Juke-Box-Hero
  • [QUOTE=Blt950;32727031][highlight]IMPORTANT[/highlight] The v.1.1 has been released. The only change is: I added the missing sounds and material files that I forgot in 1.0 [b]*facepalm*[/b][/QUOTE] Thanks, ill release it to my server now. Everyone likes it on there :D
  • Avatar of Blt950
  • [QUOTE=FPtje;32730413]When you sent me the PM about overriding the /call thing, I thought you had already tried the playerSay hook. You haven't O_o This code demonstrates how to override DarkRP's chat command "/call". [lua]hook.Add("PlayerSay", "CM.Callingstuff", function(ply, text, teamonly, dead) if string.find(text, "/call") then -- Do your stuff here return "" -- Return "" to make sure it doesn't show up in chat end end) [/lua] I strongly suggest you check out the [url=http://wiki.garrysmod.com/?title=Gamemode_Hooks]Gamemode hooks[/url] page to see what hooks are available.[/QUOTE] Oh, heh. Embarrasing to forget something so obvious :/ Well thanks! Maybe for the v.1.2 update the editing main.lua will be fixed then ;) That's great news :) I'll test this tomorrow :) Thanks again.
  • Avatar of Kopimi
  • [QUOTE=Blt950;32732509]Oh, heh. Embarrasing to forget something so obvious :/ Well thanks! Maybe for the v.1.2 update the editing main.lua will be fixed then ;) That's great news :) I'll test this tomorrow :) Thanks again.[/QUOTE] I'd probably fix looping through the players 3-4 times per tick thing first to be honest :v:
  • Avatar of Blt950
  • [QUOTE=Kopimi;32733694]I'd probably fix looping through the players 3-4 times per tick thing first to be honest :v:[/QUOTE] This is getting fixed in the next update 1.2. This will be only a optimization update :) Going to fix alot of small stuff there, and also bugs if there will be some :)