Jump to content

[Problem] Skin Cop for Vehicle


Jumper_Mych

Recommended Posts

Posted (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 :o

EDIT: Not Copy My Code!

Edited by Guest
Posted
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

Posted
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 ) 

Posted

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 :(

Posted

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

Posted

I could be misunderstanding you, but the medic vehicle is the same as the cop car in that script :roll: So off course it will not work, change it to the correct vehicle ID's

Posted
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.

Posted
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 ) 

Posted
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

Posted

2/2 part :mrgreen:

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.

Posted

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

Posted

Maybe you should try to understand the error instead of posting it here and complain, the debugcript isnt there to copy paste it

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...