el_motoblock Posted December 8, 2012 Share Posted December 8, 2012 А точнее - как вычесть деньги у взявшего пикап и передать водителю? function onDoctorMode ( theVehicle, seat, jacked ) if ( getElementModel ( theVehicle ) == 416 ) then -- доктормобиль outputChatBox("[+] Now You Are Doctor [+]", source, 255, 0, 0, true) bindKey ( source, "lshift", "down", createFirstAid ) bindKey ( source, "lctrl", "down", clearMemoryFA ) --bindKey ( source, "rshift", "down", forDriverFA ) driverDoctor = getVehicleOccupant ( theVehicle ) end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), onDoctorMode ) function offDoctorMode ( theVehicle, seat, jacked ) if ( getElementModel ( theVehicle ) == 416 ) then -- доктормобиль outputChatBox("[x] Now You're not a doctor [x]", source, 91, 127, 0, true) unbindKey ( source, "lshift", "down", createFirstAid ) unbindKey ( source, "lctrl", "down", clearMemoryFA ) --unbindKey ( source, "rshift", "down", forDriverFA ) destroyElement(firstAid) destroyElement(docCar_x) destroyElement(docCar_y) destroyElement(docCar_z) destroyElement(driverDoctor) end end addEventHandler ( "onPlayerVehicleExit", getRootElement(), offDoctorMode ) function createFirstAid (thePlayer) destroyElement(firstAid) destroyElement(docCar_x) destroyElement(docCar_y) destroyElement(docCar_z) docCar_x, docCar_y, docCar_z = getElementPosition(thePlayer) firstAid = createPickup ( docCar_x, docCar_y, docCar_z, 0, 100, 10000 ) if(isPickupSpawned(firstAid))then outputChatBox("*Pickup created", source, 128, 128, 128, true) setTimer ( clearMemoryFA, 5000, 1) else outputChatBox("*Pickup not created", source, 128, 128, 128, true) end end function clearMemoryFA () if(isPickupSpawned(firstAid))then destroyElement(firstAid) destroyElement(docCar_x) destroyElement(docCar_y) destroyElement(docCar_z) outputChatBox("*Pickup destroyed", source, 128, 128, 128, true) else outputChatBox("*Pickup not present", source, 128, 128, 128, true) end end function pickupTakenFA ( player ) givePlayerMoney ( player, -100) --берет у подобравшего плату givePlayerMoney ( driverDoctor, 100) --дает водителю-доктору outputChatBox("*bought first aid kit for $ 100", player, 128, 128, 128, true) outputChatBox("*sold first aid kit for $ 100", source, 128, 128, 128, true) end addEventHandler ( "onPickupHit", firstAid, pickupTakenFA ) Link to comment
Vamp1r Posted December 8, 2012 Share Posted December 8, 2012 Прочитай подробнее про https://wiki.multitheftauto.com/wiki/BindKey Первый аргумент должен содержать элемент - player. А так же, по-моему, агрументы, которые есть у тебя - нет в bindKey. А так же, вместо переменных типа, driverDoctor, docCar_x и т.д. используй таблицы, т.к. если два игрока сядут в два докторских автомобиля, данная переменная будет содержать инфу о том, кто последний сел в автомобиль. Link to comment
el_motoblock Posted December 9, 2012 Author Share Posted December 9, 2012 агрументы, которые есть у тебя - нет в bindKey seat, jacked - это я из другого скрипта свой делал, и я их так и оставил пока 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