Guest Posted November 11, 2013 Share Posted November 11, 2013 (edited) Hello friends, When I was active and was enjoying making mods for MCCodes, I created a quick simple API to assist me, basic checks like hospital, jail, donator, id2name, name2id, addevent and a couple of others. I intended to release premium modules build on top of it however as you know MCM is dead, can't be bothered and don't have time. V3 was meant to be released ages ago, MCCodes is dying. I will probably build a game on a heavily modified version however not sure. If you don't know how to use this don't ask. It's dead simple... Github - https://github.com/1e4/MCCode-Modifications The code above will not be updated, I intend to release mods in the future but that is still to be seen. I recommend instantiating this in globals.php Edited November 11, 2013 by Guest Quote Link to comment Share on other sites More sharing options...
Guest Posted November 11, 2013 Share Posted November 11, 2013 Added putInJail Updated canView() Updated accessDenied() Working on a helpdesk module, roulette, main menu and a few others. Quote Link to comment Share on other sites More sharing options...
Seker Posted November 11, 2013 Share Posted November 11, 2013 I'm kind of confused as to why this would be even remotely worth creating or having. [iNSERT GENERIC "WELL DON'T GET IT THEN" COMMENT] Point being, it's basically just some functions that, at best save you maybe 2-3 lines of code in a file. Quote Link to comment Share on other sites More sharing options...
Djkanna Posted November 11, 2013 Share Posted November 11, 2013 I'm kind of confused as to why this would be even remotely worth creating or having. [iNSERT GENERIC "WELL DON'T GET IT THEN" COMMENT] Point being, it's basically just some functions that, at best save you maybe 2-3 lines of code in a file. A single source ( presumably open-source licensed ) file, that anyone can update and use in whole or in part. The potential for a more generic layer between people's games and other people's modifications ( providing the 'API' is adopted by people ). If people use it, and people contribute more generic helper methods, could potentially cut down on the multiple versions of ( as an example ) inJail functions that many mods utilise. Quote Link to comment Share on other sites More sharing options...
Seker Posted November 11, 2013 Share Posted November 11, 2013 A single source ( presumably open-source licensed ) file, that anyone can update and use in whole or in part. The potential for a more generic layer between people's games and other people's modifications ( providing the 'API' is adopted by people ). If people use it, and people contribute more generic helper methods, could potentially cut down on the multiple versions of ( as an example ) inJail functions that many mods utilise. Erm. Sure. We could go with that. Quote Link to comment Share on other sites More sharing options...
Guest Posted November 11, 2013 Share Posted November 11, 2013 I'm kind of confused as to why this would be even remotely worth creating or having. [iNSERT GENERIC "WELL DON'T GET IT THEN" COMMENT] Point being, it's basically just some functions that, at best save you maybe 2-3 lines of code in a file. 2-3 lines per file? You probably just don't understand then. Take a module for a new lost password, you want to check if the user isn't logged in so you can just do You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Adding events You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. The above saves a couple of lines however it also allows for a username or an id... saving you many more lines Take the canView() function, this allows you to add a small array into the page and it works everything out for you, I will make a tutorial some time in the near future on how to create a basic module. I created this for personal use. I don't care in the slightest if no one else uses it however I prefer it. It also brings a slight OO approach to modules which is also useful. Even functions like putInJail, it saves time and effort, not having to worry about checks. I intend to add various other functions as I need them Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted November 12, 2013 Share Posted November 12, 2013 I could be wrong but wouldn't that addevent example fail unless you have a player who's username is infact 1? I see it uses the name2id () if its a string which looks for the id of the player who's username is in there so if some knucklehead decides to use it as a string for the id then it will always fail. Quote Link to comment Share on other sites More sharing options...
Dave Posted November 12, 2013 Share Posted November 12, 2013 Glad to see you finally got around to building this, I may build on top of this and extend it for a module I've been meaning to build for a while. I'd of personally called putInJail() placeInJail() but that's just a personal preference. Could be a nice idea to extend out a User class and allow calls to read and modify user data. Have the ability to load in the model and set the user ID in the model. You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. etc... Quote Link to comment Share on other sites More sharing options...
Guest Posted November 12, 2013 Share Posted November 12, 2013 I could be wrong but wouldn't that addevent example fail unless you have a player who's username is infact 1? I see it uses the name2id () if its a string which looks for the id of the player who's username is in there so if some knucklehead decides to use it as a string for the id then it will always fail. Not sure how you mean? If the userid is a string, it will convert the username into an id. If it is an ID it will skip the if. A username be numbers or letters, an ID can only be numbers, so I had to check if it was a string, because if I checked if it was a int, it could be either. Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted November 12, 2013 Share Posted November 12, 2013 I mean this: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. So if they decide to do : You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. The $id var would be a string so name2id () whould then search for the id (should be userid btw, I just noticed it) of the username 1 Quote Link to comment Share on other sites More sharing options...
Guest Posted November 12, 2013 Share Posted November 12, 2013 I mean this: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. So if they decide to do : You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. The $id var would be a string so name2id () whould then search for the id (should be userid btw, I just noticed it) of the username 1 Hmm I see what you mean, I would put that down to the end coder being bad, good practise shows that you should do ints without " or '. I am not going to cater for lazy people however rude that may sound, if you do it right then there should be no issue, if you have a function suggestions i'll gladly add them. Quote Link to comment Share on other sites More sharing options...
Seker Posted November 12, 2013 Share Posted November 12, 2013 Hmm I see what you mean, I would put that down to the end coder being bad, good practise shows that you should do ints without " or '. I am not going to cater for lazy people however rude that may sound, if you do it right then there should be no issue, if you have a function suggestions i'll gladly add them. The whole point of an "API" as you're calling this IS for the "lazy people." Again, all you've got here are a few functions that save a few lines. The whole argument about cross-modification holds no bearing unless the mass of people out there suddenly decide to start using this all together. Which I doubt will happen. Quote Link to comment Share on other sites More sharing options...
Guest Posted November 12, 2013 Share Posted November 12, 2013 (edited) The whole point of an "API" as you're calling this IS for the "lazy people." Again, all you've got here are a few functions that save a few lines. The whole argument about cross-modification holds no bearing unless the mass of people out there suddenly decide to start using this all together. Which I doubt will happen. You know why people don't post here anymore? Because of c**** like you. I made it, I released it, I can do what I want with it whether you like it or not. So yeh, here are the ****s I give. And before you criticize anyone, look at the **** code in your game -.- Edited November 12, 2013 by Guest Language! Quote Link to comment Share on other sites More sharing options...
Script47 Posted November 12, 2013 Share Posted November 12, 2013 Seker he has a good point. You are being quite a douche about it. If you don't like it, sure point out the flaws and give him some constructive criticism and not fill the thread with hate. Back on topic now, I think it's cool pal, good job! :) Quote Link to comment Share on other sites More sharing options...
Guest Posted November 12, 2013 Share Posted November 12, 2013 Seker he has a good point. You are being quite a douche about it. If you don't like it, sure point out the flaws and give him some constructive criticism and not fill the thread with hate. Back on topic now, I think it's cool pal, good job! :) Cheers :) msg2short :) Quote Link to comment Share on other sites More sharing options...
Dave Posted November 12, 2013 Share Posted November 12, 2013 (edited) The whole point of an "API" as you're calling this IS for the "lazy people." Again, all you've got here are a few functions that save a few lines. The whole argument about cross-modification holds no bearing unless the mass of people out there suddenly decide to start using this all together. Which I doubt will happen. I think the whole idea of an API has massive potential for something like McCode. It gets people using classes properly instead of hacking around within McCodes. Angel's current implementation is very basic and lacks a decent amount of features but it certainly has more promise of bringing something new to the engine. Programming languages were created to 'save us writing a few lines'. So we don't have to start all writing machine code/binary (Computing was a while ago, correct me if I'm wrong here). It's unfair to be so negative about this open source contribution to an ever dying platform. Edited November 12, 2013 by Dave Macaulay Quote Link to comment Share on other sites More sharing options...
Seker Posted November 12, 2013 Share Posted November 12, 2013 Person does "work" and claims it's unimportant and no care is given about its use. This gets pointed out. Pointing this out is called being "negative." As far as the comment about my coding. Really bad comment, simply because you've never seen the code in my game. So yeah. There's that. Quote Link to comment Share on other sites More sharing options...
Guest Posted November 12, 2013 Share Posted November 12, 2013 Person does "work" and claims it's unimportant and no care is given about its use. This gets pointed out. Pointing this out is called being "negative." As far as the comment about my coding. Really bad comment, simply because you've never seen the code in my game. So yeah. There's that. You really want me to go into how bad your coding is? Try redoing your CSS, I suck at it and even I know it's bad, do you want examples if so how many? Why are you even still on this thread? Quote Link to comment Share on other sites More sharing options...
The Spirit Posted November 12, 2013 Share Posted November 12, 2013 This is probably the best post in this forum in two years... Lots of potential here. Quote Link to comment Share on other sites More sharing options...
Guest Posted November 12, 2013 Share Posted November 12, 2013 This is probably the best post in this forum in two years... Lots of potential here. Thankyou Spirit, I am going on holiday for a week or 2, when i'm back i'm going to work a bit with the database, maybe extend the current one, have a PDO class possibly. I have a few mods in the process of being bought out however there are various errors that have magically appeared, not sure why however i'll be keeping the mods secret till release :P Quote Link to comment Share on other sites More sharing options...
sniko Posted November 14, 2013 Share Posted November 14, 2013 (edited) ]I'd of personally called putInJail() placeInJail() but that's just a personal preference. Although, `post` would be the standardized API verb @OP It's pretty cool, but I wouldn't consider it a full API - although it does offer abstraction. If you get around to altering it - in my view - I would consider making it much bigger, making use of collections and verbs. I would also change it from returning raw strings to HTTP header codes, or boolean, allowing the end-user to set the 'error' text in their code, rather than them altering the 'API' source - as ideally, they shouldn't have to edit the API to fit their liking as the API should 'adapt' around them. Edited November 14, 2013 by sniko Quote Link to comment Share on other sites More sharing options...
URBANZ Posted November 14, 2013 Share Posted November 14, 2013 TBH this is a really good idea as it would make McCodes alot easier to connect to through JAVA (Android) and mobile applications as you would only have to call one file to handle all of the calls for you instead of calling multiple files to get what you need Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted November 15, 2013 Share Posted November 15, 2013 TBH this is a really good idea as it would make McCodes alot easier to connect to through JAVA (Android) and mobile applications as you would only have to call one file to handle all of the calls for you instead of calling multiple files to get what you need Unless I'm not picking up what your putting down here it seems like it would do the exact opposite. For the most part its another "global_func.php" file it just I guess in a way extends it. Quote Link to comment Share on other sites More sharing options...
Guest Posted February 21, 2014 Share Posted February 21, 2014 Updated to include brave_cost within deny messages Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.