el_motoblock Posted December 2, 2012 Share Posted December 2, 2012 ...в которой сидит игрок в переменную local doctorX, doctorY, doctorZ = getElementPosition ( player ) 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 ) end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), onDoctorMode ) function offDoctorMode ( theVehicle, seat, jacked ) if ( getElementModel ( theVehicle ) == 416 ) then -- доктормобиль outputChatBox("Now You're not a doctor [x]", source, 91, 127, 0, true) unbindKey ( source, "lshift", "down", createFirstAid ) end end addEventHandler ( "onPlayerVehicleExit", getRootElement(), offDoctorMode ) function createFirstAid ( source ) firstAid = createPickup ( doctorX, doctorY, doctorZ, 0, 1240, 10000, 100 ) end Link to comment
el_motoblock Posted December 2, 2012 Author Share Posted December 2, 2012 local doctorX, doctorY, doctorZ = getElementPosition ( theVehicle ) тоже не помогло мне надо взять коорды машины, а они не берутся дебагскрипт всё ругается машины в которой сидит игрок Link to comment
TheNormalnij Posted December 2, 2012 Share Posted December 2, 2012 local theVehicle = getPedOccupiedVehicle ( thePlayer ) Link to comment
el_motoblock Posted December 2, 2012 Author Share Posted December 2, 2012 local theVehicle = getPedOccupiedVehicle ( thePlayer ) local doctorX, doctorY, doctorZ = getElementPosition ( theVehicle ) 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 ) end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), onDoctorMode ) function offDoctorMode ( theVehicle, seat, jacked ) if ( getElementModel ( theVehicle ) == 416 ) then -- доктормобиль outputChatBox("Now You're not a doctor [x]", source, 91, 127, 0, true) unbindKey ( source, "lshift", "down", createFirstAid ) end end addEventHandler ( "onPlayerVehicleExit", getRootElement(), offDoctorMode ) function createFirstAid ( source ) firstAid = createPickup ( doctorX, doctorY, doctorZ, 0, 1240, 10000, 100 ) end Link to comment
Kernell Posted December 2, 2012 Share Posted December 2, 2012 а thePlayer откуда взяли? Link to comment
el_motoblock Posted December 2, 2012 Author Share Posted December 2, 2012 это же вроде общепризнанная(или там как её) переменная также как source, или player Link to comment
el_motoblock Posted December 2, 2012 Author Share Posted December 2, 2012 я не знаю от куда ее брать, в других скриптах её тоже из воздуха берут вот fstyle к примеру function getPlayerFightStyle ( thePlayer, commandName ) local playerstyle = getPedFightingStyle ( thePlayer ) -- store the fighting style in a variable outputChatBox ( tostring(playerstyle), thePlayer ) -- output it to the player end addCommandHandler ( "style", getPlayerFightStyle ) function consoleSetFightingStyle ( thePlayer, commandName, id ) if ( thePlayer and id ) then -- If player and ID are specified local status = setPedFightingStyle ( thePlayer, tonumber(id) ) -- set the fighting style if ( not status ) then -- if that failed outputConsole ( "Failed to set fighting style.", thePlayer ) -- show a message end end end addCommandHandler ( "setstyle", consoleSetFightingStyle ) Link to comment
Flaker Posted December 2, 2012 Share Posted December 2, 2012 addCommandHandler - вот оно ее устанавливает Link to comment
Kernell Posted December 2, 2012 Share Posted December 2, 2012 el_motoblock, вы что не видите что она была передана через аргумент? Вам бы сначала за основы программирования взяться.. Link to comment
el_motoblock Posted December 2, 2012 Author Share Posted December 2, 2012 Ладно придется искать всякие исходники в чужих скриптах Сделал! Дебагскрипт не ругается, но всеравно пикап не создаётся function initial(thePlayer) docCar_x, docCar_y, docCar_z = getElementPosition(thePlayer) end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), initial ) 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 ) end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), onDoctorMode ) function offDoctorMode ( theVehicle, seat, jacked ) if ( getElementModel ( theVehicle ) == 416 ) then -- доктормобиль outputChatBox("Now You're not a doctor [x]", source, 91, 127, 0, true) unbindKey ( source, "lshift", "down", createFirstAid ) end end addEventHandler ( "onPlayerVehicleExit", getRootElement(), offDoctorMode ) function createFirstAid (source) firstAid = createPickup ( docCar_x, docCar_y, docCar_z, 0, 1240, 10000, 100 ) end Link to comment
TheNormalnij Posted December 2, 2012 Share Posted December 2, 2012 из wiki ammo: An integer representing the amount of ammo a pickup contains. This is only valid when the pickup type is a weapon pickup. source и firstAid = по идее не требуются Link to comment
el_motoblock Posted December 3, 2012 Author Share Posted December 3, 2012 Переменная мне нужна, чтобы выгружать через некоторое время неиспользуемый пикап Link to comment
Scripting Moderators Sarrum Posted December 3, 2012 Scripting Moderators Share Posted December 3, 2012 Может: firstAid = createPickup ( docCar_x, docCar_y, docCar_z, 0, 100, 10000 ) ? Link to comment
el_motoblock Posted December 4, 2012 Author Share Posted December 4, 2012 спс, помогло, я понял это типа если тип пикапа 0(аптечка), то и модельку не надо указывать, кто бы знал... проблема решена!!! 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