SanZoR Posted January 9, 2008 Posted January 9, 2008 Hello, I would like to have script, what starts instantly mode vote when player joins (If theres no other gamemods running at same time) Thank you =) Finnish Multi Theft Auto Networks Community @ http://fin-mta.net OWNED 100mbit fiber linez ownz
SanZoR Posted January 9, 2008 Author Posted January 9, 2008 Any chance to do it? Finnish Multi Theft Auto Networks Community @ http://fin-mta.net OWNED 100mbit fiber linez ownz
x16 Posted January 9, 2008 Posted January 9, 2008 jesus sanzor do it yourself. http://development.mtasa.com/index.php? ... ing_Events :l and yeah anythings possible.
SanZoR Posted January 9, 2008 Author Posted January 9, 2008 How about if im not the best scripter here in LUA ? Finnish Multi Theft Auto Networks Community @ http://fin-mta.net OWNED 100mbit fiber linez ownz
Jumba' Posted January 9, 2008 Posted January 9, 2008 (edited) I never made something in lua but i tried. It doesn't give an error, nor does it work, but here ya go function startVote( ) local mode = getGameType () local joinedPlayerName = getClientName ( source ) if( mode == nil ) then executeCommandHandler ( "votemode", source ) end end addEventHandler ( "onPlayerJoin", getRootElement(), startVote ) dont laugh Edited January 10, 2008 by Guest
MB|Lagzilla Posted January 9, 2008 Posted January 9, 2008 How about if im not the best scripter here in LUA ? Ummm, learn? Best way to learn is too try for yourself...
SanZoR Posted January 10, 2008 Author Posted January 10, 2008 Hey edison, im learning it all the time. Note that i have learnt LUA just 3 days, and now i can edit stuff, but cant done own. Finnish Multi Theft Auto Networks Community @ http://fin-mta.net OWNED 100mbit fiber linez ownz
kevuwk Posted January 10, 2008 Posted January 10, 2008 a script isn't classed as a game mode so if there is a script (it think hay is classed as a script) then it will bring up the vote Kevuwk Any comments made are purely my own and do not represent the interests of the MTA Team
[UVA]Bart Posted January 10, 2008 Posted January 10, 2008 lol edit things /me laughs at lil^san for learning to edit things and not the propper thing Scripts Links Fuel Script For Mta Dm slr-v-1.1.3.rar For MTA Race Website Feel Free To Join -->http://www.teamslr.110mb.com <--
Jumba' Posted January 10, 2008 Posted January 10, 2008 a script isn't classed as a game mode so if there is a script (it think hay is classed as a script) then it will bring up the vote Which function can I use to check and see if there's a mode running?
ChrML Posted January 10, 2008 Posted January 10, 2008 The mapmanager resource has a function to check: getRunningGamemode http://development.mtasa.com/index.php? ... ap_manager For example: local resource = call ( getResourceFromName ( "mapmanager" ), "getRunningGamemode" ) if ( resource ) then -- gamemode is running else -- gamemode is not running end Linus Torvalds: "Software is like sex: it's better when it's free."
SanZoR Posted January 11, 2008 Author Posted January 11, 2008 What i should do to it to make it work? Finnish Multi Theft Auto Networks Community @ http://fin-mta.net OWNED 100mbit fiber linez ownz
XetaQuake Posted January 11, 2008 Posted January 11, 2008 ChrML or anybody else, can make a fully complete script to start vote when no gamemode is running? // Connect to Server - Open Website // ° Youtube - Twitter °
RottWeiller Posted January 11, 2008 Posted January 11, 2008 Hi, This script will do just what you guys are asking for I can't upload attachments so, here it is the code: First, create a folder named "votegmonjoin" in "...\MTA San Andreas\server\mods\deathmatch\resources\" Now, create a file named "votegmonjoin_server.lua" inside the folder you created before. Copy and paste the code bellow to this file: function vgmGameModeRunning() outputDebugString("<DEBUG>(Server): vgmGameModeRunning() called!") local resource = call ( getResourceFromName("mapmanager"), "getRunningGamemode" ) if ( resource == nil ) then --TODO: Its this check always valid? -- gamemode is not running = Start vote! executeCommandHandler ( "votemode", source ) return false end return true end addEventHandler("onPlayerJoin", getRootElement(), vgmGameModeRunning) Create another file named "meta.xml" inside the folder you created before. Copy and paste the code bellow to this file: <meta> <info author="impression" description="Execute /votemode on player join if no game modes are running." type="script" version="0.1" /> <include resource="mapmanager" /> <include resource="votemanager" /> <script src="votegmonjoin_server.lua" type="server"/> </meta> Now, whe need to give permission to this script to execute the function "executeCommandHandler ()". Open the ACL file (acl.xml) located in " "...\MTA San Andreas\server\mods\deathmatch\" and, add the following code at top of file after the tag "": <group name="VoteGmOnJoin"> <acl name="VoteGmOnJoin"/> <object name="resource.votegmonjoin"/> </group> Scroll down to the bottom of the file and add the following code before the last "": <acl name="VoteGmOnJoin"> <right name="function.executeCommandHandler" access="true"/> </acl> Start the script and you are set. Now, when a player joins the server, and no gamemode is being executed, he will automatically execute the "/votemode" command from the "votemanager" script. Have fun. EDIT: Fixed a typo in the "meta.xml" file code.
RottWeiller Posted January 11, 2008 Posted January 11, 2008 I edited my original post to fix a typo in the "meta.xml" file. If you copied the code before I fixed, copy the "meta.xml" part again. Sorry about that.
XetaQuake Posted January 11, 2008 Posted January 11, 2008 Thanks! that works perfect! Realy good work now i delet this thread from my favorites, thanks! // Connect to Server - Open Website // ° Youtube - Twitter °
SanZoR Posted January 12, 2008 Author Posted January 12, 2008 Hi,This script will do just what you guys are asking for I can't upload attachments so, here it is the code: First, create a folder named "votegmonjoin" in "...\MTA San Andreas\server\mods\deathmatch\resources\" Now, create a file named "votegmonjoin_server.lua" inside the folder you created before. Copy and paste the code bellow to this file: function vgmGameModeRunning() outputDebugString("<DEBUG>(Server): vgmGameModeRunning() called!") local resource = call ( getResourceFromName("mapmanager"), "getRunningGamemode" ) if ( resource == nil ) then --TODO: Its this check always valid? -- gamemode is not running = Start vote! executeCommandHandler ( "votemode", source ) return false end return true end addEventHandler("onPlayerJoin", getRootElement(), vgmGameModeRunning) Create another file named "meta.xml" inside the folder you created before. Copy and paste the code bellow to this file: <meta> <info author="impression" description="Execute /votemode on player join if no game modes are running." type="script" version="0.1" /> <include resource="mapmanager" /> <include resource="votemanager" /> <script src="votegmonjoin_server.lua" type="server"/> </meta> Now, whe need to give permission to this script to execute the function "executeCommandHandler ()". Open the ACL file (acl.xml) located in " "...\MTA San Andreas\server\mods\deathmatch\" and, add the following code at top of file after the tag "": <group name="VoteGmOnJoin"> <acl name="VoteGmOnJoin"/> <object name="resource.votegmonjoin"/> </group> Scroll down to the bottom of the file and add the following code before the last "": <acl name="VoteGmOnJoin"> <right name="function.executeCommandHandler" access="true"/> </acl> Start the script and you are set. Now, when a player joins the server, and no gamemode is being executed, he will automatically execute the "/votemode" command from the "votemanager" script. Have fun. EDIT: Fixed a typo in the "meta.xml" file code. Nice job! This is what i was looking for Thank you very much! Finnish Multi Theft Auto Networks Community @ http://fin-mta.net OWNED 100mbit fiber linez ownz
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