AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [L4D1&2] Spawn Alarmcars (https://forums.alliedmods.net/showthread.php?t=139352)

DieTeetasse 09-30-2010 00:20

[L4D1&2] Spawn Alarmcars
 
4 Attachment(s)
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

2befine 09-30-2010 07:10

Re: [L4D1&2] Spawn Alarmcars
 
1 Attachment(s)
awesome!
cfg with some cool spaces
at
MH, DA, BH
updated!

AtomicStryker 09-30-2010 07:14

Re: [L4D1&2] Spawn Alarmcars
 
Excellent! Now add code to turn an existing car into an alarm car (and vice versa).

:D




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 Float:xmove, const Float:ymove)

2befine 09-30-2010 08:39

Re: [L4D1&2] Spawn Alarmcars
 
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.

DieTeetasse 10-01-2010 14:39

Re: [L4D1&2] Spawn Alarmcars
 
@2befine:
Fixed in next version. I'm still stucked to calculate the correct positions of the light when roll and/or pitch != 0. :/

AtomicStryker 10-01-2010 17:08

Re: [L4D1&2] Spawn Alarmcars
 
Why are you using coordinates anyway, im sure the car model has attachment points.

DieTeetasse 10-01-2010 18:29

Re: [L4D1&2] Spawn Alarmcars
 
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. :shock:
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.

2befine 10-02-2010 05:31

Re: [L4D1&2] Spawn Alarmcars
 
Nice!

Cthulhu 10-02-2010 21:00

Re: [L4D1&2] Spawn Alarmcars
 
Random alarms on map existing cars is possible?

2befine 10-02-2010 21:14

Re: [L4D1&2] Spawn Alarmcars
 
ok new bug, in versus, first team on first map have no cars.


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

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