[STM]Metalhero Posted July 8, 2010 Share Posted July 8, 2010 Can any give me a easy afk killer Link to comment
m4rsje Posted July 8, 2010 Share Posted July 8, 2010 thats a hard one, i suggest you to not keep asking can some1 make this, and this. try it your self you will need to know how timers work and if the position is changed in the time, if not kill him Link to comment
dzek (varez) Posted July 8, 2010 Share Posted July 8, 2010 edit: there WAS topics with full script. search them. Link to comment
[STM]Metalhero Posted July 8, 2010 Author Share Posted July 8, 2010 not with server side ok i have try to make waht but i dont work pl shelp SERVER: addEvent "Killer" function blowVehicle(player) end triggerClientEvent(getRootElement(),"onkillTimer") addEventHandler("onMapStarting") CLIENT: afkTime = 3000 function funcInput ( key, keyState ) if ( keyState == "up" ) then if not isTimer(afktimer) then afktimer = setTimer(function() outputChatBox("afk") end,afkTime,1) end else if isTimer( afktimer) then killTimer ( afktimer ) end end end function bindTheKeys () bindKey("fire","both",clientAction) bindKey("next_weapon","both",clientAction) bindKey("previous_weapon","both",clientAction) bindKey("forwards","both",clientAction) bindKey("backwards","both",clientAction) bindKey("left","both",clientAction) bindKey("right","both",clientAction) bindKey("zoom_in","both",clientAction) bindKey("zoom_out","both",clientAction) bindKey("change_camera","both",clientAction) bindKey("jump","both",clientAction) bindKey("sprint","both",clientAction) bindKey("look_behind","both",clientAction) bindKey("crouch","both",clientAction) bindKey("action","both",clientAction) bindKey("walk","both",clientAction) bindKey("aim_weapon","both",clientAction) bindKey("conversation_yes","both",clientAction) bindKey("conversation_no","both",clientAction) bindKey("group_control_forwards","both",clientAction) bindKey("group_control_back","both",clientAction) bindKey("enter_exit","both",clientAction) bindKey("vehicle_fire","both",clientAction) bindKey("vehicle_secondary_fire","both",clientAction) bindKey("vehicle_left","both",clientAction) bindKey("vehicle_right","both",clientAction) bindKey("steer_forward","both",clientAction) bindKey("steer_back","both",clientAction) bindKey("accelerate","both",clientAction) bindKey("brake_reverse","both",clientAction) bindKey("radio_next","both",clientAction) bindKey("radio_previous","both",clientAction) bindKey("radio_user_track_skip","both",clientAction) bindKey("horn","both",clientAction) bindKey("sub_mission","both",clientAction) bindKey("handbrake","both",clientAction) bindKey("vehicle_look_left","both",clientAction) bindKey("vehicle_look_right","both",clientAction) bindKey("vehicle_look_behind","both",clientAction) bindKey("vehicle_mouse_look","both",clientAction) bindKey("special_control_left","both",clientAction) bindKey("special_control_right","both",clientAction) bindKey("special_control_down","both",clientAction) bindKey("special_control_up","both",clientAction) bindKey("enter_passenger","both",clientAction) bindKey("playerlist","both",clientAction) bindKey("screenshot","both",clientAction) bindKey("chatbox","both",clientAction) bindKey("radar","both",clientAction) bindKey("radar_zoom_in","both",clientAction) bindKey("radar_zoom_out","both",clientAction) bindKey("radar_move_north","both",clientAction) bindKey("radar_move_south","both",clientAction) bindKey("radar_move_east","both",clientAction) bindKey("radar_move_west","both",clientAction) bindKey("radar_attach","both",clientAction) end addEventHandler("onClientResourceStart",getRootElement(),bindTheKeys,Killer) Link to comment
MaddDogg Posted July 8, 2010 Share Posted July 8, 2010 And again I have to say: You seem to have no idea of scripting. Your script is a total mess. The syntax is completely wrong at several points and it doesn't even make sense. You trigger events, which don't exist, same goes for functions. There is no client event "onkillTimer" and no "onMapStarting". Also there is no function "clientAction". "blowVehicle(player)" makes absolutely no sense, the player is no vehicle. It just looks like you just copied together several script parts. Just START learning Lua and scripting in MTA. You can't just go on snipping together sample scripts. Either you consider that or nobody will help you. Link to comment
dzek (varez) Posted July 8, 2010 Share Posted July 8, 2010 okay, great, you found client-side on the forums, now do the same for server side, or spent few hours on trying to get to know the general scripting idea Link to comment
AeroXbird Posted July 11, 2010 Share Posted July 11, 2010 A little redone of that afk kill script: Server: addEvent("KillAFK", true) function killPlayer(player) killPed(player, player) outputChatBox("The player:"..getPlayerName(player).." was killed for being away from keyboard!") outputDebugString("A player was successfully killed for being AFK", 3) end addEventHandler("KillAFK", getRootElement(), killPlayer) Client: afkTime = 3000 -- 3000 ms(miliseconds) is equal to 3 seconds -- so the formula is: i x 1000 = v -- i == amount of time in seconds -- v = the outcome function checkAFK ( key, keyState ) if ( keyState == "up" ) then if not isTimer(afktimer) then setTimer(triggerServerEvent("KillAFK", getRootElement()), afkTime, 1) end if elseif( keyState == "down") then if isTimer( afktimer) then killTimer ( afktimer ) end end end function keys () bindKey("fire","both",clientAction) bindKey("next_weapon","both",clientAction) bindKey("previous_weapon","both",clientAction) bindKey("forwards","both",clientAction) bindKey("backwards","both",clientAction) bindKey("left","both",clientAction) bindKey("right","both",clientAction) bindKey("jump","both",clientAction) bindKey("sprint","both",clientAction) bindKey("look_behind","both",clientAction) bindKey("crouch","both",clientAction) bindKey("action","both",clientAction) bindKey("walk","both",clientAction) bindKey("aim_weapon","both",clientAction) bindKey("enter_exit","both",clientAction) bindKey("vehicle_fire","both",clientAction) bindKey("vehicle_secondary_fire","both",clientAction) bindKey("accelerate","both",clientAction) bindKey("brake_reverse","both",clientAction) setTimer(checkAFK, afkTime, 0) end addEventHandler("onClientResourceStart",getRootElement(),keys) Although i am NOT a 100% sure this will work, so just try, and let me know if it doesnt work. Link to comment
50p Posted July 11, 2010 Share Posted July 11, 2010 I'll tell you straight away that your script will not work... Why? Look at setTimer parameters on wiki and your arguments. Link to comment
[STM]Metalhero Posted July 18, 2010 Author Share Posted July 18, 2010 it not work pls help me Link to comment
MaddDogg Posted July 18, 2010 Share Posted July 18, 2010 Just learn scripting. https://wiki.multitheftauto.com/wiki/SetTimer You can't just expect from us that we fix every code for you, you have to do the fixing by yourself. 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