SanZoR Posted January 9, 2008 Share 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 =) Link to comment
SanZoR Posted January 9, 2008 Author Share Posted January 9, 2008 Any chance to do it? Link to comment
x16 Posted January 9, 2008 Share Posted January 9, 2008 jesus sanzor do it yourself. http://development.mtasa.com/index.php? ... ing_Events :l and yeah anythings possible. Link to comment
SanZoR Posted January 9, 2008 Author Share Posted January 9, 2008 How about if im not the best scripter here in LUA ? Link to comment
Jumba' Posted January 9, 2008 Share 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 Link to comment
MB|Lagzilla Posted January 9, 2008 Share 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... Link to comment
SanZoR Posted January 10, 2008 Author Share 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. Link to comment
kevuwk Posted January 10, 2008 Share 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 Link to comment
[UVA]Bart Posted January 10, 2008 Share Posted January 10, 2008 lol edit things /me laughs at lil^san for learning to edit things and not the propper thing Link to comment
Jumba' Posted January 10, 2008 Share 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? Link to comment
ChrML Posted January 10, 2008 Share 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 Link to comment
SanZoR Posted January 11, 2008 Author Share Posted January 11, 2008 What i should do to it to make it work? Link to comment
XetaQuake Posted January 11, 2008 Share Posted January 11, 2008 ChrML or anybody else, can make a fully complete script to start vote when no gamemode is running? Link to comment
RottWeiller Posted January 11, 2008 Share 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. Link to comment
RottWeiller Posted January 11, 2008 Share 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. Link to comment
XetaQuake Posted January 11, 2008 Share Posted January 11, 2008 Thanks! that works perfect! Realy good work now i delet this thread from my favorites, thanks! Link to comment
SanZoR Posted January 12, 2008 Author Share 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! 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