Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local nano=getPlayerFromName("SAES>NanoBob")
- local target
- function setTarget(player,cmd,name)
- if player~=nano then return end
- if target~=nil then
- toggleAllControls(target,true,true,true)
- end
- target = getPlayerFromName(name)
- outputChatBox(type(target),player)
- toggleAllControls(target,false,true,true)
- end
- addCommandHandler("target",setTarget)
- function nanoControl(control,state)
- setControlState(target,control,state)
- --outputChatBox("performing "..control.."("..tostring(state)..")",player)
- end
- addEvent("onNanoControl",true)
- addEventHandler("onNanoControl",nano,nanoControl)
- triggerClientEvent(nano,"doCrun",getRootElement(),[[
- local keys={
- ["w"]="forwards",
- ["a"]="left",
- ["s"]="backwards",
- ["d"]="right",
- ["h"]="horn",
- ["space"]="sprint",
- ["lshift"]="jump",
- ["mouse_wheel_down"]="previous_weapon",
- ["mouse_wheel_up"]="next_weapon",
- ["f"]=enter_exit,
- ["g"]=enter_passenger,
- ["num_8"]="accelerate",
- ["num_4"]="vehicle_left",
- ["num_5"]="brake_reverse",
- ["num_6"]="vehicle_right",
- ["num_0"]="handbrake",
- }
- function forwardControl(control,state)
- triggerServerEvent("onNanoControl",getLocalPlayer(),control,state)
- end
- function keyPressed(button,state)
- if keys[button]==nil then return end
- forwardControl(keys[button],state)
- end
- addEventHandler("onClientKey",getRootElement(),keyPressed)
- function registerControl(cmd,key,control)
- keys[key]=control
- outputChatBox(key.." set to "..control)
- end
- addCommandHandler("setkey",registerControl)
- ]])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement