K4stic Posted September 27, 2013 Share Posted September 27, 2013 Hello this is Tutorial of Advansed kill script ( Server-Side script ) 1. creating table local antispam = {} -- table 2. we use with command name addCommandHandler("kill", -- command 3. We make function function ( player ) -- function 4. an element to get players wanted level local getwantedlevel = getPlayerWantedLevel ( player ) -- get's Players wanted Level 5. We use table to make Player to can't use multible time the /kill ( /kill antispam with other words ) if player want use it before of 2 mins they will see the message if ( antispam[getPlayerSerial(player)] ) and ( getTickCount()-antispam[getPlayerSerial(player)] < 120000 ) then outputChatBox( "You can't use /kill Multible Times only once every 2 minutes!", player, 225, 0, 0 ) -- Using Table to make Antispam and can use it every 2 mins if player have realy use it it will send him message 6. checking wanted level to wanted players can't use kill ( to reduse abusing ) and if player have more that 0 stars then he can't use /kill elseif ( getwantedlevel > 0 ) then -- check if player have more that 0 stars outputChatBox( "You can't use /kill while Wanted", player, 225, 0, 0 ) -- send a message if he have more that 0 stars 7. if player use /kill after 2 mins and not wanted them else antispam[getPlayerSerial( player )] = getTickCount() -- to refresh time if he want use the /kill again setTimer( killPed, 5000, 1, player ) -- setTimer to froze player for 5 sec setElementFrozen ( player, true ) -- set's Player Zrozen outputChatBox( "You'll die in 5 seconds!", player, 255, 0, 0 ) -- Send to player the Message Final Code local antispam = {} -- table addCommandHandler("kill", -- command function( player ) local getwantedlevel = getPlayerWantedLevel ( player ) -- get's Players wanted Level if ( antispam[getPlayerSerial(player)] ) and ( getTickCount()-antispam[getPlayerSerial(player)] < 120000 ) then outputChatBox( "You can't use /kill Multible Times only once every 2 minutes!", player, 225, 0, 0 ) elseif ( getwantedlevel > 0 ) then outputChatBox( "You can't use /kill while Wanted", player, 225, 0, 0 ) else antispam[getPlayerSerial( player )] = getTickCount() -- to refresh time if he want use the /kill again setTimer( killPed, 5000, 1, player ) -- setTimer to froze player for 5 sec setElementFrozen ( player, true ) -- set's Player Zrozen outputChatBox( "You'll die in 5 seconds!", player, 255, 0, 0 ) -- Send to player the Message end -- close the if,elseif,else end -- close the function ) -- to close the command Meta .Xml of /kill Script <meta> <info author="CASTIEL" version="1.0" type="script" /> <script src="script.lua" type="server" /> </meta> Enjoy & Test it! Don't forget to Comment. 1 Link to comment
Recommended Posts