Xwad Posted July 26, 2016 Share Posted July 26, 2016 how can i kill all players with a command? i know there is a function killPed, but i want to kill all players on the server with that function. Is there any function to get all players on the server? Thanks Link to comment
Simple0x47 Posted July 26, 2016 Share Posted July 26, 2016 I'll give you a tip :v getElementsByType("ped") Link to comment
Xwad Posted July 26, 2016 Author Share Posted July 26, 2016 thanks. I made a script , but its not working:/ function killAllPlayers () local players = getElementsByType ( "ped" ) for theKey,thePlayer in ipairs(players) do killPed ( players, players ) end end addCommandHandler ( "k", killAllPlayers ) Link to comment
Walid Posted July 26, 2016 Share Posted July 26, 2016 replace "ped" with "player". and put your code server side. Link to comment
Simple0x47 Posted July 26, 2016 Share Posted July 26, 2016 Try this on server side :v function killAllPlayers() local players = getElementsByType("ped") for I = 1, #players do local p = players[I] killPed( p, p ) end end addCommandHandler( "k", killAllPlayers ) Link to comment
Simple0x47 Posted July 26, 2016 Share Posted July 26, 2016 Why do you need it on client side? Client Side function killSuckers() triggerServerEvent('onPlayerWantsToKillSuckas', localPlayer) end addCommandHandler('killSuckas', killSuckers) Server Side addEvent('onPlayerWantsToKillSuckas', true) function killSuckas() local suckas = getElementsByType('ped') for i = 1, #suckas do killPed(suckas[i], suckas[i]) end end addEventHandler('onPlayerWantsToKillSuckas', root, killSuckas) 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