Jumper_Mych Posted January 15, 2011 Share Posted January 15, 2011 (edited) 1/2 part policeVehicle = createVehicle ( 426, 2418.4436035156, 85.328956604004, 26.292650222778, 0, 0, 90 ) policeSkins = { [286]=true,[288]=true } function enterVehicle ( player, seat, jacked ) if ( policeVehicle[getElementModel( source )] ) and ( not policeSkins[getElementModel( player )] ) then outputChatBox ( "You're not a cop!", player ) cancelEvent() end end addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle ) Doesn't Work EDIT: Not Copy My Code! Edited January 17, 2011 by Guest Link to comment
Buffalo Posted January 15, 2011 Share Posted January 15, 2011 policeVehicle is not a table: if (getElementModel( source ) == policeVehicle ) and ( not policeSkins[getElementModel( player )] ) then Link to comment
Jumper_Mych Posted January 15, 2011 Author Share Posted January 15, 2011 doesn't work Link to comment
SDK Posted January 15, 2011 Share Posted January 15, 2011 policeVehicle = createVehicle ( 426, 2418.4436035156, 85.328956604004, 26.292650222778, 0, 0, 90 ) policeSkins = { [286]=true,[288]=true } function enterVehicle ( player, seat, jacked ) if (policeVehicle == source) and not policeSkins[getElementModel(player)] then outputChatBox ( "You're not a cop!", player ) cancelEvent() end end addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle ) This is really basic stuff, stop putting "Don't copy my code" and start learning more lua Link to comment
Castillo Posted January 15, 2011 Share Posted January 15, 2011 policeVehicle = createVehicle ( 426, 2418.4436035156, 85.328956604004, 26.292650222778, 0, 0, 90 ) policeSkins = { [286]=true,[288]=true } function enterVehicle ( player, seat, jacked ) if (getElementModel( source ) == getElementModel(policeVehicle) ) and ( not policeSkins[getElementModel( player )] ) then outputChatBox ( "You're not a cop!", player ) cancelEvent() end end addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle ) Link to comment
Jumper_Mych Posted January 15, 2011 Author Share Posted January 15, 2011 Thanks you!!! Maybe kiss you?! joke, Nice work Link to comment
Castillo Posted January 15, 2011 Share Posted January 15, 2011 Try something by yourself next time Link to comment
Jumper_Mych Posted January 15, 2011 Author Share Posted January 15, 2011 Bad Script! I create vehicle from Police and Medic, Get Skin Cops go Enter the vehicle cop a chatbox type "You're not a Medic" that vehicle Police, and two vehicle from Medic and skin Medic type " You're not a Cops" this Problem Link to comment
Castillo Posted January 15, 2011 Share Posted January 15, 2011 I don't understand.. the script we fixed was to check when you enter that "policeVehicle". Link to comment
Jumper_Mych Posted January 15, 2011 Author Share Posted January 15, 2011 For Police policeVehicle = createVehicle ( 426, 2401.4436035156, 76.328956604004, 25.292650222778, 0, 0, 90 ) policeSkins = { [286]=true,[288]=true } function enterVehicle ( player, seat, jacked ) if (getElementModel( source ) == getElementModel(policeVehicle) ) and ( not policeSkins[getElementModel( player )] ) then outputChatBox ( "You're not a cop!", player ) cancelEvent() end end addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle ) For medic medicVehicle = createVehicle ( 426, 2418.4436035156, 85.328956604004, 26.292650222778, 0, 0, 90 ) medicSkins = { [275]=true,[277]=true } function enterVehicle ( player, seat, jacked ) if (getElementModel( source ) == getElementModel(medicVehicle) ) and ( not medicSkins[getElementModel( player )] ) then outputChatBox ( "You're not a medic!", player ) cancelEvent() end end addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle ) two same id vehicle so two type and other skin: You're not a cop! You're not a medic! and change skin to cop and enter to Cop Vehicle You're not a medic! Connect id vehicle, to separation medic and police. If don't u understand. i work rec monitoring and Add Youtube. some you know Link to comment
SDK Posted January 15, 2011 Share Posted January 15, 2011 I could be misunderstanding you, but the medic vehicle is the same as the cop car in that script So off course it will not work, change it to the correct vehicle ID's Link to comment
Jumper_Mych Posted January 16, 2011 Author Share Posted January 16, 2011 I want separation and ditto id vehicle Link to comment
Jumper_Mych Posted January 16, 2011 Author Share Posted January 16, 2011 I should at least try something first. Link to comment
xUltimate Posted January 17, 2011 Share Posted January 17, 2011 policeVehicle = createVehicle ( 426, 2401.4436035156, 76.328956604004, 25.292650222778, 0, 0, 90 ) policeSkins = { [286]=true,[288]=true } medicVehicle = createVehicle ( 426, 2418.4436035156, 85.328956604004, 26.292650222778, 0, 0, 90 ) medicSkins = { [275]=true,[277]=true } function enterVehicle ( player, seat, jacked ) if (getElementModel( source ) == getElementModel(policeVehicle) ) and ( not policeSkins[getElementModel( player )] ) then outputChatBox ( "You're not a cop!", player ) cancelEvent() elseif(getElementModel( source ) == getElementModel(medicVehicle) ) and ( not medicSkins[getElementModel( player )] ) then outputChatBox ( "You're not a medic!", player ) cancelEvent() end end addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle ) Try that. Link to comment
Jumper_Mych Posted January 17, 2011 Author Share Posted January 17, 2011 doesn't work, Same my video Link to comment
Jumper_Mych Posted January 17, 2011 Author Share Posted January 17, 2011 Sure error getElementModel maybe other to getElement...? Try Vehicle ID 496 are own Jumper_Mych and ID 496 is same but own James_Bonner try change to skin cops Link to comment
Castillo Posted January 17, 2011 Share Posted January 17, 2011 policeVehicle = createVehicle ( 426, 2418.4436035156, 85.328956604004, 26.292650222778, 0, 0, 90 ) setElementData(policeVehicle,"vehicle","police") policeSkins = { [286]=true,[288]=true } medicVehicle = createVehicle ( 426, 2401.4436035156, 76.328956604004, 25.292650222778, 0, 0, 90 ) setElementData(medicVehicle,"vehicle","medic") medicSkins = { [275]=true,[277]=true } function enterVehicle ( player, seat, jacked ) if (getElementData(source, "vehicle" ) == "police") and ( not policeSkins[getElementModel( player )] ) then outputChatBox ( "You're not a cop!", player ) cancelEvent() end if (getElementData(source, "vehicle" ) == "medic") and ( not medicSkins[getElementModel( player )] ) then outputChatBox ( "You're not a medic!", player ) cancelEvent() end end addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle ) Link to comment
Jumper_Mych Posted January 17, 2011 Author Share Posted January 17, 2011 policeVehicle = createVehicle ( 426, 2418.4436035156, 85.328956604004, 26.292650222778, 0, 0, 90 ) setElementData(policeVehicle,"vehicle","police") policeSkins = { [286]=true,[288]=true } medicVehicle = createVehicle ( 426, 2401.4436035156, 76.328956604004, 25.292650222778, 0, 0, 90 ) setElementData(medicVehicle,"vehicle","medic") medicSkins = { [275]=true,[277]=true } function enterVehicle ( player, seat, jacked ) if (getElementData(source, "vehicle" ) == "police") and ( not policeSkins[getElementModel( player )] ) then outputChatBox ( "You're not a cop!", player ) cancelEvent() end if (getElementData(source, "vehicle" ) == "medic") and ( not medicSkins[getElementModel( player )] ) then outputChatBox ( "You're not a medic!", player ) cancelEvent() end end addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle ) Thanks you! That My Topic is Very problem and hard work Link to comment
Jumper_Mych Posted January 17, 2011 Author Share Posted January 17, 2011 2/2 part vehicle = createVehicle ( 496, 2425, -55, 27, 0, 0, 0 ) setElementData(vehicle,"vehicle","car") bes = getElementType ( vehicle ) == "Jumper_Mych" function enterVehicle ( player, seat, jacked ) if (getElementData(source, "vehicle" ) == "car") and ( not bes[getElementModel( player )] ) then outputChatBox ( "Vehicle owner: Jumper_Mych", player ) cancelEvent() end end addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle ) Doesn't work Player Can't get vehicle for Jumper_Mych and "Vehicle owner: Jumper_Mych" A Nick Jumper_Mych can enter vehicle. and Jumper_mych is in the vehicle ped can enter sit in vehicle. Link to comment
Castillo Posted January 18, 2011 Share Posted January 18, 2011 You put random code and expect us to fix it? no way! you better think twice. Link to comment
Jumper_Mych Posted January 18, 2011 Author Share Posted January 18, 2011 I have no issue, and still i think code Link to comment
Jumper_Mych Posted January 18, 2011 Author Share Posted January 18, 2011 doesn't work vehicle = createVehicle ( 496, 2425, -55, 27, 0, 0, 0 ) setElementData(vehicle,"vehicle","car") bes = setPlayerName ( car, "Jumper_Mych" ) function enterVehicle ( player, seat, jacked ) if (getElementData(source, "vehicle" ) == "car") and ( not bes[getPlayerName( player )] ) then outputChatBox ( "Vehicle owner: Jumper_Mych", player ) cancelEvent() end end addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle ) I think that already 6 times but not help [09:45:13] ERROR: vehicle\mod8.lua:6: attempt to index global 'bes' (a boolean value) Error Link to comment
SDK Posted January 18, 2011 Share Posted January 18, 2011 Maybe you should try to understand the error instead of posting it here and complain, the debugcript isnt there to copy paste it Link to comment
Jumper_Mych Posted January 18, 2011 Author Share Posted January 18, 2011 i can line 6 number is error but i change to getPlayerName or setPlayerName, getPlayerFromNick and getPlayerType i can't work it fixed by my code. Link to comment
Castillo Posted January 18, 2011 Share Posted January 18, 2011 omfg! you are doing random code as i said, this makes no sense o_o, you want to setPlayerName in a vehicle?? 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