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

VINEWOOD

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

Learn Lua - Learn to script - GUI scripting

Scripter tools - Find/fix errors yourself(!)

Don't pm me for scripting help, keep it for the Scripting subforum!

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 ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Try something by yourself next time :P

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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

VINEWOOD

Posted

I don't understand.. the script we fixed was to check when you enter that "policeVehicle".

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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

VINEWOOD

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 ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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

VINEWOOD

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.

VINEWOOD

Posted

You put random code and expect us to fix it? no way! you better think twice.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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

VINEWOOD

Posted

omfg! you are doing random code as i said, this makes no sense o_o, you want to setPlayerName in a vehicle??

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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