koeno100 Posted December 25, 2014 Share Posted December 25, 2014 Can anyone help me and tell me what I have to edit in the race gamemode to force players into spectate mode if they're not logged in? Link to comment
MTA Team botder Posted December 26, 2014 MTA Team Share Posted December 26, 2014 I only tested the code alone on my server. This is an ugly hack and I don't recommend it. It probably won't put the player into spectator mode (requires more changes). File: race_server.lua Search the line addEventHandler('onPlayerQuit', g_Root and move the anonymous function out and give it a name. function handlePlayerQuit() destroyBlipsAttachedTo(source) table.removevalue(g_Players, source) -- ... end Don't forget to add the handler in onPlayerQuit and add a new event onPlayerLogout for it. addEventHandler('onPlayerQuit', g_Root, handlePlayerQuit) addEventHandler('onPlayerLogout', g_Root, handlePlayerQuit) Search for addEventHandler('onPlayerJoin', g_Root, joinHandlerByEvent) and add below that line: addEventHandler('onPlayerLogin', g_Root, joinHandlerByEvent) Search for function joinHandlerByEvent() and extend the function: function joinHandlerByEvent() if getAccountName(getPlayerAccount(source)) == 'guest' then return end setPlayerNotReady(source) joinHandlerBoth() end Search for if not table.find(g_Players, p) then and extend the code block: if not table.find(g_Players, p) then if getAccountName(getPlayerAccount(p)) ~= 'guest' then player = p break end end 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