rafael15420 Posted October 24, 2014 Share Posted October 24, 2014 (edited) Hello, can anyone help me, i am new in the community My question is, as I put script to run only when the player finishes server download ? Edited October 29, 2014 by Guest Link to comment
rafael15420 Posted October 24, 2014 Author Share Posted October 24, 2014 someone please Link to comment
Banex Posted October 24, 2014 Share Posted October 24, 2014 Server max_lost_percent = 30 -- maximum allowed percent of lost packets function checkPacketLost() for i,v in ipairs ( getElementsByType("player")) do local lost = getNetworkStats(v).packetlossLastSecond if lost > max_lost_percent then kickPlayer ( v, "Big amount of lost packets" ) end end end addEvent("onDownloadFinish",true) addEventHandler("onDownloadFinish",root, function () setTimer(checkPacketLost,5000,0) end) Client addEventHandler ( "onClientFileDownloadComplete", getRootElement(), function () triggerServerEvent("onDownloadFinish",localPlayer) end) Link to comment
RenanPG Posted October 24, 2014 Share Posted October 24, 2014 Server max_lost_percent = 30 -- maximum allowed percent of lost packets function checkPacketLost() for i,v in ipairs ( getElementsByType("player")) do local lost = getNetworkStats(v).packetlossLastSecond if lost > max_lost_percent then kickPlayer ( v, "Big amount of lost packets" ) end end end addEvent("onDownloadFinish",true) addEventHandler("onDownloadFinish",root, function () setTimer(checkPacketLost,5000,0) end) Client addEventHandler ( "onClientFileDownloadComplete", getRootElement(), function () triggerServerEvent("onDownloadFinish",localPlayer) end) Don't forget to give admin rights on ACL. Link to comment
rafael15420 Posted October 25, 2014 Author Share Posted October 25, 2014 thank you so much, Banex, Hornet Link to comment
rafael15420 Posted October 25, 2014 Author Share Posted October 25, 2014 After I did this procedure the script stopped working Link to comment
Anubhav Posted October 25, 2014 Share Posted October 25, 2014 Don't forget to give admin rights on ACL. kickPlayer doesn't need admin rights. Always see wiki, I'm not offending you. Link to comment
RenanPG Posted October 25, 2014 Share Posted October 25, 2014 Don't forget to give admin rights on ACL. kickPlayer doesn't need admin rights. Always see wiki, I'm not offending you. "responsiblePlayer: The player that is responsible for the event. Note: If left out as in the second syntax, responsible player for the kick will be "Console" (Maximum 30 characters if using a string)." Community. In that case the responsible is Console, probably need ACL. I didn't test. Link to comment
Anubhav Posted October 25, 2014 Share Posted October 25, 2014 It doesn't need. Its nowhere written. Link to comment
Bilal135 Posted October 25, 2014 Share Posted October 25, 2014 Well, I just created a simple script to test kickPlayer, and yes, the console asks for admin rights. We need to give admin rights to the resource or it won't work. EDIT: https://wiki.multitheftauto.com/wiki/KickPlayer Check it out, I added the note on the top. 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