Raised This Month: $51 Target: $400
 12% 

[L4D1&2] Spawn Alarmcars


Post New Thread Reply   
 
Thread Tools Display Modes
Author
DieTeetasse
Senior Member
Join Date: Jul 2009
Plugin ID:
1976
Plugin Version:
1.0.4
Plugin Category:
Gameplay
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Spawns fully function alarm cars.
    Old 09-30-2010 , 00:20   [L4D1&2] Spawn Alarmcars
    Reply With Quote #1

    Spawn Alarmcars

    What is the idea?

    Simple idea: spawn a fully functional alarm car.
    The plugin provides not only the ability to spawn standard alarm cars. You can spawn many different types of alarm cars. The plugin can save your settings and respawn the cars at every round start.

    How does it work?
    The plugin spawns all necessary entities and adding all dependencies.

    Known Bugs?
    None.

    Commands (admin only)?

    sm_alarmcar_list_customs | Lists all custom cars from config.
    sm_alarmcar_move <x> <y> <z> [pitch] [yaw] [roll] | Moves alarm car in front of you. Optional rotates the car too.
    sm_alarmcar_move_at <x> <y> <z> <newX> <newY> <newZ> [pitch] [yaw] [roll] | Moves alarm car at the given position. Optional rotates the car too.
    sm_alarmcar_remove | Removes alarm car in front of you.
    sm_alarmcar_remove_at <x> <y> <z> | Removes alarm car at the given position.
    sm_alarmcar_rotate <pitch> <yaw> <roll> | Rotates alarm car in front of you.
    sm_alarmcar_rotate_at <x> <y> <z> <pitch> <yaw> <roll> | Rotates alarm car at the given position.
    sm_alarmcar_save_to_config | Saves current created cars into the config and overrides old ones.
    sm_alarmcar_spawn | Spawns a fully functional alarm car in front of you.
    sm_alarmcar_spawn_at <x> <y> <z> <pitch> <yaw> <roll> [r] [g] [b] | Spawns a fully functional alarm car at the given position, angles and optional color.
    sm_alarmcar_spawn_custom <type> | Spawns a fully functional alarm custom car in front of you.
    sm_alarmcar_spawn_custom_at <type> <x> <y> <z> <pitch> <yaw> <roll> [r] [g] [b] | Spawns a fully functional alarm custom car at the given position, angles and optional color.
    sm_alarmcar_spawn_truck <type> | Spawns a fully functional alarm truck in front of you.
    sm_alarmcar_spawn_truck_at <type> <x> <y> <z> <pitch> <yaw> <roll> | Spawns a fully functional alarm truck at the given position and optional angles.

    Cvars?
    sm_alarmcar_version - version
    sm_alarmcar_mapstart - enable/disable mapstart spawning of cars (need the config file)

    Anything else?
    Config file structure:
    PHP Code:
    "alarmcars"
    {
        
    "c1m2_streets"
        
    {
            
    "info"
            
    {
                
    "count" "2" // count of cars of the map
                
    "count_custom"     "1" // count of custom cars
                
    "count_truck"     "1" // count of custom trucks
            
    }
            
    "data"
            
    {
                
    "1" // just an identifier
                
    {
                    
    "position" "1498.104004 2780.024658 578.031250" // necessary
                    
    "angle" "0 131.807129 0" // necessary
                    
    "color" "255 255 255" // optional color for the car
                
    }
                
    "2"
                
    {
                    
    "position" "-2200.863281 2120.350342 0.031250"
                    "angle" "0 61.054562 0"
                
    }
            }
            
    "data_custom"
            
    {
                
    "1"
                
    {
                    
    "modelname"    "models/props_vehicles/cara_82hatchback.mdl" // necessary name of the model (has to be inside the model.cfg)
                    
    "position"     "2445.747559 838.954773 78.031250" // necessary
                    
    "angle"     "0.0 177.367325 0.0" // necessary
                    
    "color"     "0 255 0" // necessary
                
    }
            }
            
    "data_truck"
            
    {
                
    "1"
                
    {
                    
    "modelname"    "models/props_vehicles/cement_truck01.mdl"
                    "position"     "805.70 2957.09 16.03"
                    "angle"     "0.00 89.68 0.00"
                    
    // no color for trucks
                
    }
            }
        }
        
    "c1m3_mall"
          
    {
            [
    same again here...]
        }


    The config file locations:
    ./cfg/sourcemod/alarmcars_location.cfg
    ./cfg/sourcemod/alarmcars_models.cfg

    History?
    Quote:
    v1.0.0 (70 downloads):
    - initial release
    v1.0.1 (non public):
    - fixed chirp/alarm for every car and not for the one shot at
    - fixed no spawning in 2nd round of versus mode
    v1.0.2 (79 downloads):
    - fixed pitch and roll for cars
    - renamed old commands
    - added new commands for removing
    v1.0.3 (73 downloads):
    - fixed car not moving and glass/lights are parented to the car
    - fixed no spawning cars at 1st round of versus and on mapchange
    - added new commands for moving and rotating cars
    - added new command to save current cars into the config (overriding previous cars of the map)
    v1.0.4:
    - fixed errors in log, when two map loadings appeared very fast after each other
    - added #pragma semicolon 1 (copy paste of file header mistake xD)
    - major update:
    + updated plugin for support of custom alarm car models divided in two categories (cars / trucks)
    + updated config file to support custom models
    + added new commands for spawning --> sm_alarmcar_spawn_custom, sm_alarmcar_spawn_custom_at, sm_alarmcar_spawn_truck and sm_alarmcar_spawn_truck_at
    + added new command to list alle possible models to spawn --> sm_alarmcar_list_customs
    + updated old commands --> sm_alarmcar_move, sm_alarmcar_remove and sm_alarmcar_remove_at
    + updated save command and mapstart function for new config files
    Attached Files
    File Type: cfg alarmcars_location.l4d1.cfg (317 Bytes, 1429 views)
    File Type: cfg alarmcars_location.l4d2.cfg (1.1 KB, 1861 views)
    File Type: cfg alarmcars_models.cfg (1.7 KB, 2602 views)
    File Type: sp Get Plugin or Get Source (l4d_spawn_alarmcars.sp - 4453 views - 70.7 KB)
    __________________

    Last edited by DieTeetasse; 10-19-2010 at 10:38.
    DieTeetasse is offline
    2befine
    Junior Member
    Join Date: Nov 2009
    Old 09-30-2010 , 07:10   Re: [L4D1&2] Spawn Alarmcars
    Reply With Quote #2

    awesome!
    cfg with some cool spaces
    at
    MH, DA, BH
    updated!
    Attached Files
    File Type: cfg alarmcars_location.cfg (3.8 KB, 748 views)

    Last edited by 2befine; 10-05-2010 at 05:30.
    2befine is offline
    AtomicStryker
    Veteran Member
    Join Date: Apr 2009
    Location: Teutonia!!
    Old 09-30-2010 , 07:14   Re: [L4D1&2] Spawn Alarmcars
    Reply With Quote #3

    Excellent! Now add code to turn an existing car into an alarm car (and vice versa).






    EDIT

    Looking at the code:

    PHP Code:
    MovePositionFront(Float:position[3], const Float:constAngles[3]) {
        
    decl Float:angles[3], Float:direction[3];
        
    angles[1] = constAngles[1];
        
        
    GetAngleVectors(anglesdirectionNULL_VECTORNULL_VECTOR);
        
    position[0] = position[0] + direction[0] * distanceFront;
        
    position[1] = position[1] + direction[1] * distanceFront;
    }

    MovePositionLeft(Float:position[3], const Float:constAngles[3], const Float:distance) {
        
    decl Float:angles[3], Float:direction[3];
        
    angles[1] = constAngles[1] + 90.0;
        
        
    GetAngleVectors(anglesdirectionNULL_VECTORNULL_VECTOR);
        
    position[0] = position[0] + direction[0] * distance;
        
    position[1] = position[1] + direction[1] * distance;
    }

    MovePositionBack(Float:position[3], const Float:constAngles[3]) {
        
    decl Float:angles[3], Float:direction[3];
        
    angles[1] = constAngles[1] + 180.0;
        
        
    GetAngleVectors(anglesdirectionNULL_VECTORNULL_VECTOR);
        
    position[0] = position[0] + direction[0] * distanceBack;
        
    position[1] = position[1] + direction[1] * distanceBack;
    }

    MovePositionRight(Float:position[3], const Float:constAngles[3], const Float:distance) {
        
    decl Float:angles[3], Float:direction[3];
        
    angles[1] = constAngles[1] + 270.0;
        
        
    GetAngleVectors(anglesdirectionNULL_VECTORNULL_VECTOR);
        
    position[0] = position[0] + direction[0] * distance;
        
    position[1] = position[1] + direction[1] * distance;

    This looks like you could make one function to handle all this. Like MovePosition(Float:position[3], const Float:constAngles[3], const Floatmove, const Float:ymove)

    Last edited by AtomicStryker; 09-30-2010 at 07:17.
    AtomicStryker is offline
    2befine
    Junior Member
    Join Date: Nov 2009
    Old 09-30-2010 , 08:39   Re: [L4D1&2] Spawn Alarmcars
    Reply With Quote #4

    at versus mode, extra cars spawns only for first team, no cars for second one, how to fix that?
    sm plugins reload l4d_spawn_alarmcars helps but... would be cool if it will works automatic for versus.

    Last edited by 2befine; 10-01-2010 at 07:49.
    2befine is offline
    DieTeetasse
    Senior Member
    Join Date: Jul 2009
    Old 10-01-2010 , 14:39   Re: [L4D1&2] Spawn Alarmcars
    Reply With Quote #5

    @2befine:
    Fixed in next version. I'm still stucked to calculate the correct positions of the light when roll and/or pitch != 0. :/
    __________________
    DieTeetasse is offline
    AtomicStryker
    Veteran Member
    Join Date: Apr 2009
    Location: Teutonia!!
    Old 10-01-2010 , 17:08   Re: [L4D1&2] Spawn Alarmcars
    Reply With Quote #6

    Why are you using coordinates anyway, im sure the car model has attachment points.
    AtomicStryker is offline
    DieTeetasse
    Senior Member
    Join Date: Jul 2009
    Old 10-01-2010 , 18:29   Re: [L4D1&2] Spawn Alarmcars
    Reply With Quote #7

    Thought that too, but no.
    It seems, that even the level modellers just placed the lights themselves. Because in No Mercy 1 the alarm car yellow turn lights on the front side are placed too much inside of the car and are almost not visible. Instead in No Mercy 2 you see the lights very clearly.

    And it seems GetAngleVectors() inbuilt function of sourcemod is some kind "wrong". It rotates vectors sometimes at the wrong axis.
    I am using now my own method to rotate the vector (like in the book) and it works perfectly.

    I will release a new version definitely today.

    Edit:
    Updated to v1.0.2.
    Fixed versus, fixed all cars blinking and added removing commands and pitch/roll are now working correctly.
    __________________

    Last edited by DieTeetasse; 10-02-2010 at 00:34.
    DieTeetasse is offline
    2befine
    Junior Member
    Join Date: Nov 2009
    Old 10-02-2010 , 05:31   Re: [L4D1&2] Spawn Alarmcars
    Reply With Quote #8

    Nice!
    2befine is offline
    Cthulhu
    Member
    Join Date: Apr 2010
    Old 10-02-2010 , 21:00   Re: [L4D1&2] Spawn Alarmcars
    Reply With Quote #9

    Random alarms on map existing cars is possible?
    Cthulhu is offline
    2befine
    Junior Member
    Join Date: Nov 2009
    Old 10-02-2010 , 21:14   Re: [L4D1&2] Spawn Alarmcars
    Reply With Quote #10

    ok new bug, in versus, first team on first map have no cars.
    2befine is offline
    Reply



    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 09:22.


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