Raised This Month: $ Target: $400
 0% 

[CS:S] Passenger support for Drivable Vehicles


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
NatalyaAF
Senior Member
Join Date: Dec 2008
Old 06-03-2011 , 13:55   [CS:S] Passenger support for Drivable Vehicles
Reply With Quote #1





http://pastebin.com/FSMfHmsq

This is basically all the code needed for passenger support in drivable vehicles. This code is incomplete and does not constitute an individual plugin.

How passengers work in CS:S and possibly HL2DM vehicles:

- You spawn a car
- If the car was made by me or someone else willing to put a bonemerge-able valve skeleton into it then the plugin detects when someone hops in.
- When someone is in the car it gets the player model they are using and spawns a prop_physics_override of it, then parents it to the car, and sets its parent attachment to something (doesn't matter what) and the prop will become bonemerged with the car's player skeleton so they appear to sit in the driver's seat and it is awesome.
- Passenger seats are basically the same as cars but they in turn are parented to the car itself. They are prop_vehicle_driveable but we make them not able to drive and they are small models that you aren't supposed to see with the valve player skeleton so basically you spawn this object and a player can sit in it with the same process as for the car, but then it gets parented to the right attachment within the car so it looks like you're a passenger.

Sample car config file:

PHP Code:
//Configure your menu here
"Cars"
{
    
//Name of the item to appear in the menu
    
"Chevrolet Impala"
    
{
        
"price"            "15000"
            "type"            "impala"
            "val_1"            "6"
            "val_2"            "1"
        "model"            "models/natalya/vehicles/impala_v2.mdl"
        "script"            "scripts/vehicles/impala.txt"
        "vip"                "0"
        "gas_tank"            "17"
        "mpg"                "22"
        "siren"            "0"
        "lights"            "1"
        "police_lights"        "0"
        "view"            "1"
        "driver"            "1"
        "0"                "White"
        "1"                "Red"
        "2"                "Black"
        "3"                "Beige"
        "4"                "Green"
        "5"                "Cobalt"
        "passengers"            "3"
        "p1_model"            "models/natalya/vehicles/chair_impala.mdl"
        "p1_attachment"            "seat_fr"
        "p2_model"            "models/natalya/vehicles/chair_impala.mdl"
        "p2_attachment"            "seat_rr"
        "p3_model"            "models/natalya/vehicles/chair_impala.mdl"
        "p3_attachment"            "seat_rl"
    
}
    
"Toyota Tacoma"
    
{
        
"price"            "18000"
            "type"            "tacoma"
            "val_1"            "8"
            "val_2"            "1"
        "model"            "models/natalya/vehicles/tacoma_v2.mdl"
        "script"            "scripts/vehicles/tacoma.txt"
        "vip"                "0"
        "gas_tank"            "17"
        "mpg"                "16"
        "siren"            "0"
        "lights"            "1"
        "police_lights"        "0"
        "view"            "1"
        "driver"            "1"
        "0"                "Lt Green"
        "1"                "White"
        "2"                "Dark Red"
        "3"                    "Pale Tan"
        "4"                "Dk Green"
        "5"                "Black"
        "6"                "Tan"
        "7"                "Blue"
        "passengers"            "3"
        "p1_model"            "models/natalya/vehicles/chair_tacoma_right2.mdl"
        "p1_attachment"            "vehicle_feet_passenger1"
        "p2_model"            "models/natalya/vehicles/chair_tacoma_rear.mdl"
        "p2_attachment"            "vehicle_feet_passenger1"
        "p3_model"            "models/natalya/vehicles/chair_tacoma_rear2.mdl"
        "p3_attachment"            "vehicle_feet_passenger0"
    
}
    
"Police Impala"
    
{
            
"price"            "30000"
            "type"            "impala_police"
            "val_1"            "6"
            "val_2"            "1"
        "model"            "models/natalya/vehicles/police_impala_v2.mdl"
        "script"            "scripts/vehicles/impala_police.txt"
        "vip"                "0"
        "gas_tank"            "17"
        "mpg"                "20"
        "siren"            "1"
        "lights"            "1"
        "police_lights"        "1"
        "view"            "1"
        "driver"            "1"
        "0"                "GSU Police"
        "1"                "White"
        "2"                "B & W"
        "3"                "FC Police"
        "4"                "California Highway Patrol"
        "5"                "NYPD"
        "passengers"            "3"
        "p1_model"            "models/natalya/vehicles/chair_impala.mdl"
        "p1_attachment"            "seat_fr"
        "p2_model"            "models/natalya/vehicles/chair_impala.mdl"
        "p2_attachment"            "seat_rr"
        "p3_model"            "models/natalya/vehicles/chair_impala.mdl"
        "p3_attachment"            "seat_rl"
    
}
    
"S197 Mustang"
    
{
            
"price"            "30000"
            "type"            "s197_mustang"
            "val_1"            "8"
            "val_2"            "1"
        "model"            "models/natalya/vehicles/s197_mustang_v2.mdl"
        "script"            "scripts/vehicles/s197.txt"
        "vip"                "0"
        "gas_tank"            "16"
        "mpg"                "20"
        "siren"            "0"
        "lights"            "1"
        "police_lights"        "0"
        "view"            "1"
        "driver"            "1"
        "0"                "Teal Blue"
        "1"                "Grey/White"
        "2"                "Grey/Orange"
        "3"                "Dark Red"
        "4"                "Plain White"
        "5"                "Plain Blue"
        "6"                "Black"
        "7"                "Vibrant Blue"
        "passengers"            "1"
        "p1_model"            "models/natalya/vehicles/chair_s197_right2.mdl"
        "p1_attachment"            "vehicle_feet_passenger1"
    
}
    
"Mustang GT"
    
{
            
"price"            "60000"
            "type"            "mustang"
            "val_1"            "8"
            "val_2"            "1"
        "model"            "models/vehicles/ep1/mustang_gt_redux.mdl"
        "script"            "scripts/vehicles/mustang.txt"
        "vip"                "1"
        "gas_tank"            "16"
        "mpg"                "16"
        "siren"            "0"
        "lights"            "1"
        "police_lights"        "0"
        "view"            "1"
        "driver"            "1"
        "0"                "Black"
        "1"                "White"
        "2"                "Red"
        "3"                "Orange"
        "4"                "Yellow"
        "5"                "Green"
        "6"                "Blue"
        "7"                "Violet"
        "passengers"            "1"
        "p1_model"            "models/natalya/vehicles/chair_gt_right.mdl"
        "p1_attachment"            "vehicle_feet_passenger0"
    
}
    
"Mini Cooper"
    
{
            
"price"            "60000"
            "type"            "mini"
            "val_1"            "16"
            "val_2"            "1"
        "model"            "models/vehicles/ep1/mini_v2.mdl"
        "script"            "scripts/vehicles/mini.txt"
        "vip"                "1"
        "gas_tank"            "14"
        "mpg"                "22"
        "siren"            "0"
        "police_lights"        "0"
        "lights"            "1"
        "view"            "1"
        "driver"            "1"
        "0"                "White + CK"
        "1"                "Black + White"
        "2"                "Red + White"
        "3"                "Orange + CK"
        "4"                "Yellow + Stripes"
        "5"                "Lime + White"
        "6"                "Green + Stripes"
        "7"                "Turquoise + White"
        "8"                "Light Blue + CK"
        "9"                "Blue + Union Jack"
        "10"                "Purple + CK"
        "11"                "Sky Blue + Stripes"
        "12"                "Green + Union Jack"
        "13"                "Grey + White"
        "14"                "Dark Red + Stripes"
        "15"                "Red + Union Jack"
        "passengers"            "3"
        "p1_model"            "models/natalya/vehicles/chair_mini_passenger.mdl"
        "p1_attachment"            "vehicle_feet_passenger1"
        "p2_model"            "models/natalya/vehicles/chair_mini_rear.mdl"
        "p2_attachment"            "vehicle_feet_passenger1"
        "p3_model"            "models/natalya/vehicles/chair_mini_rear.mdl"
        "p3_attachment"            "vehicle_feet_passenger0"
    
}
    
"Dirt Bike"
    
{
            
"price"        "3000"
            "type"        "dirtbike"
        "model"        "models/natalya/vehicles/dirtbike.mdl"
        "script"        "scripts/vehicles/dirtbike.txt"
            "val_1"            "8"
            "val_2"            "1"
        "0"        "White"
        "1"        "Black"
        "2"        "Red"
        "3"        "Orange"
        "4"        "Yellow"
        "5"        "Green"
        "6"        "Blue"
        "7"        "Purple"
        "vip"                "0"
        "gas_tank"            "3"
        "mpg"                "50"
        "siren"            "0"
        "police_lights"        "0"
        "lights"            "1"
        "view"            "1"
        "driver"            "1"
        "passengers"        "0"
    

I hope this helps someone.


__________________
Talk to me on Steam: natalyaaf
See my website for downloads: www.lady-natalya.info

Natalya: killing someone while they make a plugin
Natalya: perfect analogy
Natalya: for the mayan apocalypse

Last edited by NatalyaAF; 06-03-2011 at 14:04.
NatalyaAF is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:37.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode