Raised This Month: $32 Target: $400
 8% 

Car Spawner v1.2


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Fun Stuff       
karaulov
Senior Member
Join Date: Jul 2018
Old 09-14-2019 , 08:05   Car Spawner v1.2
Reply With Quote #1

This plugin spawn car on any map in your current position.

Command can be used only by ADMIN_RCON! (can be changed in code)

This plugin uses sv_use_entity_file cvar from latest rehlds, to make modified .ent file for any map.


Just say "addcar".

Or say "removecars" for remove .ent file and reset modifications for current map.



Requirements: latest rehlds
cvar sv_use_entity_file set to 1 or 2
Attached Images
File Type: jpg GiveMeCar_CarSpawner.jpg (92.9 KB, 711 views)
Attached Files
File Type: zip car_spawner_1.2.zip (68.3 KB, 245 views)
File Type: sma Get Plugin or Get Source (car_spawner.sma - 360 views - 2.6 KB)

Last edited by karaulov; 02-22-2021 at 04:26. Reason: Updated to v1.2 (bugfix)
karaulov is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 09-14-2019 , 08:20   Re: Car Spawner
Reply With Quote #2

I rather to see an entity formed with a car model than using the func_vehicle

BTW the plugin you release should also work on the hlds version.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 09-14-2019 at 08:22.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
E1_531G
Senior Member
Join Date: Dec 2017
Old 09-14-2019 , 09:01   Re: Car Spawner
Reply With Quote #3

Quote:
Originally Posted by Natsheh View Post
BTW the plugin you release should also work on the hlds version.
It won't.
__________________
My English is A0
E1_531G is offline
Old 09-14-2019, 09:51
karaulov
This message has been deleted by karaulov.
karaulov
Senior Member
Join Date: Jul 2018
Old 09-14-2019 , 09:56   Re: Car Spawner
Reply With Quote #4

Yes sorry)) need upload archive


Quote:
Originally Posted by Natsheh View Post
I rather to see an entity formed with a car model than using the func_vehicle

BTW the plugin you release should also work on the hlds version.
Updated ! No, works only with rehlds (And need enable cvar sv_use_entity_file)

Last edited by karaulov; 09-14-2019 at 10:34.
karaulov is offline
Smilex_Gamer
Senior Member
Join Date: Apr 2017
Location: Portugal
Old 09-14-2019 , 14:15   Re: Car Spawner
Reply With Quote #5

Quote:
Originally Posted by Natsheh View Post
I rather to see an entity formed with a car model than using the func_vehicle

BTW the plugin you release should also work on the hlds version.
That's just the beginning. If you take a look at his code, you'll find things like this:

Code:
#include <amxmodx>
#include <amxmodx>
Double including amxmodx :v

Code:
public add_car(coordinates[3])
{
	new carbuffer[1024];
	new curseconds = tickcount();
	formatex(carbuffer, sizeof(carbuffer),	"^n\
											{^n\
											^"classname^" ^"cycler_sprite^"^n\
											^"model^" ^"models/vehicle_control.bsp^"^n\
											^"origin^" ^"-7192 -7192 -8192^"^n\
											}^n\
											{^n\
											^"classname^" ^"cycler_sprite^"^n\
											^"model^" ^"models/vehicle.bsp^"^n\
											^"origin^" ^"-7192 -7192 -8192^"^n\
											}^n\
											{^n\
											^"classname^" ^"path_track^"^n\
											^"targetname^" ^"stop%d^"^n\
											^"target^" ^"xstop%d^"^n\
											^"origin^" ^"%d %d %d^"^n\
											}^n\
											{^n\
											^"classname^" ^"path_track^"^n\
											^"targetname^" ^"xstop%d^"^n\
											^"target^" ^"stop%d^"^n\
											^"origin^" ^"%d %d %d^"^n\
											}^n\
											{^n\
											^"classname^" ^"func_vehiclecontrols^"^n\
											^"target^" ^"xcar%d^"^n\
											^"model^" ^"models/vehicle_control.bsp^"^n\
											^"angles^" ^"0 0 0^"^n\
											^"origin^" ^"%d %d %d^"^n\
											}^n\
											{^n\
											^"classname^" ^"func_vehicle^"^n\
											^"targetname^" ^"xcar%d^"^n\
											^"target^" ^"stop%d^"^n\
											^"model^" ^"models/vehicle.bsp^"^n\
											^"length^" ^"120^"^n\
											^"width^" ^"222^"^n\
											^"speed^" ^"500^"^n\
											^"startspeed^" ^"60^"^n\
											^"angles^" ^"0 0 0^"^n\
											^"origin^" ^"%d %d %d^"^n\
											}",
											curseconds,
											curseconds,											
											coordinates[0],coordinates[1],coordinates[2] + 10, 
											curseconds,
											curseconds,		
											coordinates[0] - 36,coordinates[1],coordinates[2] + 10, 
											curseconds,
											coordinates[0],coordinates[1],coordinates[2] + 15, 
											curseconds,
											curseconds,
											coordinates[0],coordinates[1],coordinates[2] + 15);
	write_file(mapfilename,	carbuffer);
}
Indention please, this hurts my eyes.

Code:
new mapfilename[66];
new mapname[33];
public plugin_init() 
{
	register_plugin("Car spawner", "1.0", "Karaulov");
	get_mapname(mapname,32);
	formatex(mapfilename, sizeof(mapfilename), "maps\%s.ent", mapname);
	register_clcmd("say addcar", "add_car_to_my_pos", _, "- spawn new car");
	register_clcmd("say removecars", "add_car_to_my_pos", _, "- remove all modifications(.ent file)");
	server_print("Current map:%s",mapname);
}
"sizeof(mapfilename)" should be "charsmax(mapfilename)".

Last edited by Smilex_Gamer; 09-14-2019 at 14:15.
Smilex_Gamer is offline
karaulov
Senior Member
Join Date: Jul 2018
Old 09-14-2019 , 14:50   Re: Car Spawner Full
Reply With Quote #6

Sorry i don't know all syntax of this strange language, i know c#,c++ ... )))
But okay i will be tried fix this)

Last edited by karaulov; 09-14-2019 at 14:51.
karaulov is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 09-14-2019 , 14:57   Re: Car Spawner Full
Reply With Quote #7

PHP Code:
formatex(mapfilenamesizeof(mapfilename
You need to use "charsmax", not "sizeof". This applies to all places in your code where you're storing a string in a buffer.
__________________

Last edited by OciXCrom; 09-14-2019 at 14:58.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
karaulov
Senior Member
Join Date: Jul 2018
Old 09-14-2019 , 15:00   Re: Car Spawner Full
Reply With Quote #8

Fixed, and now command can be used only by ADMIN RCON (this plugin modified files on server, possible can generate broken map, need give access only to ROOT admin)

see car_spawner_1.1.zip


Strange, why delete_file(mapfilename) (maps\cs_assault.ent for example) not works?
// Fixed in 1.2, "say removecars", "add_car_to_my_pos" replaced to "say removecars", "remove_modification"

Last edited by karaulov; 09-14-2019 at 15:10.
karaulov is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 09-14-2019 , 18:28   Re: Car Spawner v1.2
Reply With Quote #9

Gj but i dont like cuz its rehlds only :/
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
karaulov
Senior Member
Join Date: Jul 2018
Old 09-15-2019 , 00:51   Re: Car Spawner v1.2
Reply With Quote #10

Quote:
Originally Posted by JocAnis View Post
Gj but i dont like cuz its rehlds only :/
Can I create such entities in hlds? (via pfn_keyvalue?)
karaulov 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 20:33.


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