Orange Posted December 28, 2011 Share Posted December 28, 2011 (edited) Hey! Today, I decided to put my WIP version of OpenFrame 2.0 to github and create a gamemode based on it. So, here it comes! OpenFrame 2.0 http://github.com/pzduniak/openframe Sorry for not including credits for var_dump function AND gui classes by 50p, but I forgot to do it. I will put them in next commit. As of 12 December 2011, you can: Create OOP classes, which may be extended (inheritance) Shorten ur code - Source:Vehicle():Position() looks awesome Be proud that players download loads of useless files! (it will change, I'm working on a compressor :3) btw. it smells like an orange! You can pull it and help me finishing it of-gungame http://github.com/pzduniak/of-gungame Some freaking gungame gamemode which will show how to use OpenFrame. New weapon is every 3 kills (theoretically configurable, 0.1.1 coming soon). Headshots are enabled. It uses builtin mta maps system (compatible with Deathmatch maps). Using basic ideas of OpenFrame. Simple, but powerful and clearly-written (except logo.lua, which looks like spaghetti code - can someone help me with making it readable?). Currently it's not documented, but I'll do it soon. You can see it on Andromeda GunGame server. Few functionalities planned as of the 3rd January. I will update the topic while I will progress. Edited January 3, 2012 by Guest Link to comment
12p Posted December 28, 2011 Share Posted December 28, 2011 Can I ask you something? WHAT IS THIS?!?! I just can't get it. Link to comment
AGENT_STEELMEAT Posted December 28, 2011 Share Posted December 28, 2011 Great job once again Orange. Link to comment
CapY Posted December 28, 2011 Share Posted December 28, 2011 Can I ask you something?WHAT IS THIS?!?! I just can't get it. Same here.. Link to comment
AGENT_STEELMEAT Posted December 28, 2011 Share Posted December 28, 2011 It's for level 9000 wizards and up. Link to comment
Orange Posted December 29, 2011 Author Share Posted December 29, 2011 Can I ask you something?WHAT IS THIS?!?! I just can't get it. http://en.wikipedia.org/wiki/Object-ori ... rogramming You'll know what is it when you see gungame gamemode. All I can provide from now are few lines of code from race scripts on Andromeda Race/DD/DM, which is completely written using OpenFrame. So, these are two main reasons why have I created it: function onShop(Source) onReturnShop:ClientTrigger(Source, Items:Get(false, Source:Level(), (Source:Team() == vip_team))) end onRequestShop:Handle(onShop) in fact, the same code without openframe will be function onShop() triggerClientEvent(source, getItems(false, getPlayerLevel(source), (getPlayerTeam(source) == vip_team))) end addEvent("onRequestShop", true) addEventHandler("onRequestShop", getRootElement(), onShop) Code is shortened and cleaner. Isn't it? (unfortunately, you have to create Event objects somewhere before, like in an additional file - I'm working on a fix for it) The second reason why I wrote it is this code: function Player:SkillPoints(value) if tonumber(value) then if not Stats:RowExists({["name"] = self:Account():Name()}) then self:Insert() --shortcut, here comes another function end return Stats:Update({"skillpoints = " .. tostring(value)}, {["name"] = self:Account():Name()}) end local t = Stats:Select({["name"] = self:Account():Name()}):itTable() if #t == 0 then return 0; end return t[1].skillpoints or 0; end Skillpoints are points on my race server which (as the name suggests) show how high is player's skill. Look at the "Stats" object. It's a query generator for a table in MySQL database. Isn't it easier to create queries like that? Script generates everything. Unfortunately, it's not so useful as it could be, because it should look like this: local result = Stats:Select():Where("orange", "=", "purple"):andWhere("yellow", "!=", "green"):Order("time", "DESC"):Query():asTable() Also, you can see that nothing except core classes really access LUA functions. That means, if I would like to move to SQLite, then I just have to modify MySQL class, so it will use other functions, while providing same output. Guess what? Query generator will still work! Great job once again Orange. Thanks. It's not finished though. Code that I provided here won't work with current github version, mainly because of :Account() and :ClientTrigger() methods. I'm working on fixing that Link to comment
12p Posted December 29, 2011 Share Posted December 29, 2011 I still cannot get it at all (I haven't been coding enough on C++), but all what is a see is a good work. So keep it up Link to comment
Orange Posted December 29, 2011 Author Share Posted December 29, 2011 As of 29 December 2011, you don't even need to create classes (only clientside right now, I will port it to serverside in few minutes). Example usage: Event:Create("onClientResourceStart"):Handle(onStart) -- is now onClientResourceStart:Handle(onStart) Link to comment
Maccer. Posted December 30, 2011 Share Posted December 30, 2011 I still cannot get it at all (I haven't been coding enough on C++), but all what is a see is a good work.So keep it up This... has nothing to do with C++, brah. Anyways I support the OOPification of MTA. This is actually what MTA:Orange was supposed to have, too bad you won't see that any time soon though... I'd love to see this integrated into the MTA Lua VM, that would be awesome. Link to comment
12p Posted December 30, 2011 Share Posted December 30, 2011 This... has nothing to do with C++ But the object-oriented programming, which is C++ style. Link to comment
AGENT_STEELMEAT Posted December 30, 2011 Share Posted December 30, 2011 It's not a C++ style, it's a basic programming paradigm. As Maccer said: this has nothing to do with C++. Link to comment
12p Posted December 30, 2011 Share Posted December 30, 2011 I give up. The only object-oriented programming language I know is C++ Excuse me, MR. Link to comment
Orange Posted December 31, 2011 Author Share Posted December 31, 2011 I give up.The only object-oriented programming language I know is C++ Excuse me, MR. Have you heard of PHP, Object Pascal, Java and Python? They're just basic examples of what languages are capable of being OOP. OpenFrame is basically based on the idea of Kohana PHP framework (which I'm always using for my PHP projects). In future, I will take few more things from it, but first, I want a small interface to all MTA functions. Link to comment
12p Posted December 31, 2011 Share Posted December 31, 2011 Have you heard of PHP, Object Pascal, Java and Python? They're just basic examples of what languages are capable of being OOP. What!?!? WHY DIDN'T ANYONE TELL ME ABOUT THIS? Damn you guys (not talking to anyone in this forum)!!! Yes, in fact I knew about all of those programming languages (I knew Pascal, not Object Pascal), but didn't know they were OOP just like C++ is. Well, seems like this is very useful. Happy developing! Link to comment
FabienWang Posted January 3, 2012 Share Posted January 3, 2012 Good Job here Orange ! But why not use getters and setters in method names? like GetPosition() and SetPosition() instead of Position() ? Link to comment
karlis Posted January 3, 2012 Share Posted January 3, 2012 Good Job here Orange ! But why not use getters and setters in method names? like GetPosition() and SetPosition() instead of Position() ? easier to use just position(), or even pos(), if args-then set, if no args-then get Link to comment
Orange Posted January 3, 2012 Author Share Posted January 3, 2012 Good Job here Orange ! But why not use getters and setters in method names? like GetPosition() and SetPosition() instead of Position() ? Waste of using my poor keyboard What's the purpose on writing 2x more functions. And other thing: openframe should make code shorter. Main topic updated, GunGame 0.1 finished. 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