Advertisement
NanoBob

posession runcode

Apr 25th, 2016
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.54 KB | None | 0 0
  1. local nano=getPlayerFromName("SAES>NanoBob")
  2. local target
  3.  
  4. function setTarget(player,cmd,name)
  5.     if player~=nano then return end
  6.     if target~=nil then
  7.         toggleAllControls(target,true,true,true)
  8.     end
  9.     target = getPlayerFromName(name)
  10.     outputChatBox(type(target),player)
  11.     toggleAllControls(target,false,true,true)
  12. end
  13. addCommandHandler("target",setTarget)
  14.  
  15. function nanoControl(control,state)
  16.     setControlState(target,control,state)
  17.     --outputChatBox("performing "..control.."("..tostring(state)..")",player)
  18. end
  19. addEvent("onNanoControl",true)
  20. addEventHandler("onNanoControl",nano,nanoControl)
  21.  
  22. triggerClientEvent(nano,"doCrun",getRootElement(),[[
  23.     local keys={
  24.         ["w"]="forwards",
  25.         ["a"]="left",
  26.         ["s"]="backwards",
  27.         ["d"]="right",
  28.         ["h"]="horn",
  29.        
  30.         ["space"]="sprint",
  31.         ["lshift"]="jump",
  32.        
  33.         ["mouse_wheel_down"]="previous_weapon",
  34.         ["mouse_wheel_up"]="next_weapon",
  35.        
  36.         ["f"]=enter_exit,
  37.         ["g"]=enter_passenger,
  38.        
  39.         ["num_8"]="accelerate",
  40.         ["num_4"]="vehicle_left",
  41.         ["num_5"]="brake_reverse",
  42.         ["num_6"]="vehicle_right",
  43.         ["num_0"]="handbrake",
  44.     }
  45.    
  46.     function forwardControl(control,state)
  47.         triggerServerEvent("onNanoControl",getLocalPlayer(),control,state)
  48.     end
  49.    
  50.     function keyPressed(button,state)
  51.         if keys[button]==nil then return end
  52.         forwardControl(keys[button],state)
  53.     end
  54.     addEventHandler("onClientKey",getRootElement(),keyPressed)
  55.    
  56.     function registerControl(cmd,key,control)
  57.         keys[key]=control
  58.         outputChatBox(key.." set to "..control)
  59.     end
  60.     addCommandHandler("setkey",registerControl)
  61. ]])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement