hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.04.28. 19:20



Jelenlévő felhasználók

Jelenleg 540 felhasználó van jelen :: 1 regisztrált, 0 rejtett és 539 vendég

A legtöbb felhasználó (1565 fő) 2020.11.21. 11:26-kor tartózkodott itt.

Regisztrált felhasználók: Google [Bot] az elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása  Hozzászólás a témához  [ 6 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: Rally Mod.
HozzászólásElküldve: 2013.10.09. 03:00 
Offline
Félisten
Avatar

Csatlakozott: 2013.03.12. 10:03
Hozzászólások: 859
Megköszönt másnak: 37 alkalommal
Megköszönték neki: 44 alkalommal
Hy Van Nekem egy Rally modom Cs-hez de viszont nem inditja el...
Valaki help?
vagy valami ötlet?
Forráskód:
SMA Forráskód: [ Mindet kijelol ]
  1. /* Plugin generated by AMXX-Studio */
  2.  
  3. #include <amxmodx>
  4. #include <fakemeta>
  5. #include <hamsandwich>
  6. #include <engine>
  7. #include <amxmisc>
  8. #include <fun>
  9. #include <playermodel>
  10.  
  11. #define PLUGIN "CS Rally"
  12. #define VERSION "3.0"
  13. #define AUTHOR "mabaclu"
  14.  
  15. #define CHECKPOINT_DISTANCE 200.0
  16. #define MAX_CHECKPOINTS 30
  17. #define CARMENU_OFFSET 123401
  18. #define FREEZETIME_OFFSET 2712
  19. #define TURBO_OFFSET 1039
  20.  
  21. #pragma dynamic 7000
  22.  
  23. new const oldknife_sounds[][] =
  24. {
  25. "weapons/knife_deploy1.wav", // Deploy Sound
  26. "weapons/knife_hit1.wav", // Hit 1
  27. "weapons/knife_hit2.wav", // Hit 2
  28. "weapons/knife_hit3.wav", // Hit 3
  29. "weapons/knife_hit4.wav", // Hit 4
  30. "weapons/knife_hitwall1.wav", // Hit Wall
  31. "weapons/knife_slash1.wav", // Slash 1
  32. "weapons/knife_slash2.wav", // Slash 2
  33. "weapons/knife_stab.wav",
  34. "common/wpn_select.wav"
  35. }
  36.  
  37. new g_CheckpointID_to_Ent[MAX_CHECKPOINTS] = 0;
  38.  
  39. new g_MaxPlayers
  40. new bool:g_lado[33];
  41. new g_DriveAngle[33];
  42.  
  43. new Float:maxs[2][3] = {{-4800.0,-4800.0,-4800.0},{-4800.0,-4800.0,-4800.0}}
  44. new Float:mins[2][3] = {{4800.0,4800.0,4800.0},{4800.0,4800.0,4800.0}}
  45.  
  46. new g_CheckpointID[33] = 0;
  47. new g_Lap[33]
  48. new g_TotalLaps
  49. new Float:g_LastTime[33]
  50. new Float:g_flRaceTime
  51. new Float:g_flRaceStarted
  52.  
  53. new bool:g_HasTurbo[33]
  54. new bool:g_TurboActivated[33]
  55.  
  56. enum _:PositionsData {
  57. ID,
  58. Position,
  59. Float: LastTime
  60. }
  61.  
  62. new Fsize = 0;
  63.  
  64. //new exploSpr
  65. new CheckpointSprite[100]
  66. new FinalCheckpointSprite[100]
  67. new g_ModelInterior[100]
  68. new g_SoundEngine[100]
  69. new g_DustSprite
  70.  
  71. new bool:g_ILoveProPortugueseGaming = true
  72.  
  73. new g_OldOrigin[33][3];
  74.  
  75. new iaPosition[33][3];
  76.  
  77. new bool:g_ThirdPerson[33];
  78.  
  79. new g_Car[33]
  80. new g_TemporaryCar[33];
  81. new bool:g_EngineSound[33];
  82. new bool:g_FreezeTime = true
  83.  
  84. new g_HideWeapon
  85.  
  86. /*
  87. ----------------------------------------------------------------------------------------------------
  88.  
  89. Plugin created by mabaclu
  90. and sold to KfarSavTa
  91.  
  92. ----------------------------------------------------------------------------------------------------
  93. */
  94.  
  95. public plugin_init() {
  96. register_plugin(PLUGIN, VERSION, AUTHOR)
  97.  
  98. g_TotalLaps = register_cvar("amx_csrally_laps","8")
  99.  
  100. RegisterHam(Ham_Spawn,"player","PlayerPostSpawn",1);
  101. set_task(1.1, "speed_task", 444990, "", 0, "b");
  102. //set_task(25.5, "sprites_task", 2697801, "", 0, "b")
  103. set_task(1.3, "engine_task", 39418, "", 0, "b")
  104. set_task(1.0, "GetPositions", 77662, "", 0, "b")
  105. set_task(0.1, "dust_task", 21492, "", 0, "b")
  106. set_task(121.0, "advertise", 1432423, "", 0, "b")
  107. g_MaxPlayers = get_maxplayers();
  108. register_forward(FM_CmdStart, "CmdStart");
  109. register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
  110. register_forward(FM_PlayerPostThink, "fw_PlayerPostThink")
  111. register_forward(FM_Think,"FM_Think_Hook")
  112. register_forward(FM_EmitSound, "fw_EmitSound")
  113. register_logevent("eRoundEnd", 2, "1=Round_End")
  114. register_logevent("RaceStart", 2, "1=Round_Start")
  115. register_event("HLTV", "event_new_round", "a", "1=0", "2=0")
  116. g_HideWeapon = get_user_msgid("HideWeapon");
  117. register_event("ResetHUD", "eReset", "b")
  118. //register_clcmd("say /start", "RaceStart")
  119. RegisterHam(Ham_Player_Jump, "player", "Player_Jump")
  120. register_dictionary("csrally.txt")
  121. register_message( get_user_msgid( "StatusIcon" ), "Msg_StatusIcon" );
  122. register_message(g_HideWeapon, "msgHideWeapon")
  123.  
  124. //register_clcmd("say /cam", "cmdCam")
  125. register_clcmd("say /kocsi", "CarMenu")
  126. register_clcmd("say /kocsik", "CarMenu")
  127. register_clcmd("say /inditas", "Engine_ON")
  128. register_clcmd("say /lealitas", "Engine_OFF")
  129.  
  130. register_concmd("amx_csrally_set_checkpoint","newcheckpoint",ADMIN_BAN,"Sets your current location to the new T checkpoint Spawn Location.")
  131.  
  132. new configfile[200]
  133. get_configsdir(configfile,199)
  134. new mapname[32]
  135. server_print(configfile)
  136. get_mapname(mapname,31)
  137. server_print(mapname)
  138. format(configfile,199,"%s/CSRally_checkpoints/%s.ini",configfile, mapname)
  139. if(file_exists(configfile))
  140. {
  141. Fsize = file_size(configfile) - 1
  142. }
  143. server_print(configfile)
  144. make_checkpoints()
  145.  
  146. register_event("CurWeapon", "Event_CurWeapon", "be","1=1")
  147. register_forward(FM_SetModel, "fw_SetModel")
  148.  
  149. for (new i; i<sizeof(g_EngineSound); i++)
  150. {
  151. g_EngineSound[i] = true;
  152. }
  153. }
  154.  
  155. public plugin_precache()
  156. {
  157. precache_model("models/rpgrocket.mdl")
  158. CheckpointSprite = "sprites/ppg_checkpoint6.spr";
  159. FinalCheckpointSprite = "sprites/ppg_finalcheckpoint.spr"
  160. precache_model(CheckpointSprite);
  161. precache_model(FinalCheckpointSprite)
  162. g_ModelInterior = "models/interior.mdl";
  163. precache_model(g_ModelInterior)
  164. precache_sound("voc/checkpoint.wav")
  165. g_SoundEngine = "engine/z28_engine.wav"
  166. precache_sound(g_SoundEngine)
  167. g_DustSprite = precache_model("sprites/lightsmoke.spr")
  168. precache_model("models/player/206/206.mdl")
  169. precache_model("models/player/accent/accent.mdl")
  170. precache_model("models/player/locust/locust.mdl")
  171. precache_sound( "fvox/ten.wav" ) ;
  172. precache_sound( "fvox/nine.wav" ) ;
  173. precache_sound( "fvox/eight.wav" ) ;
  174. precache_sound( "fvox/seven.wav" ) ;
  175. precache_sound( "fvox/six.wav" ) ;
  176. precache_sound( "fvox/five.wav" ) ;
  177. precache_sound( "fvox/four.wav" ) ;
  178. precache_sound( "fvox/three.wav" ) ;
  179. precache_sound( "fvox/two.wav" ) ;
  180. precache_sound( "fvox/one.wav" ) ;
  181. }
  182.  
  183. public eReset(id)
  184. {
  185. new iFlags
  186.  
  187. iFlags |= (1<<0)
  188. iFlags |= (1<<4)
  189. iFlags |= (1<<5)
  190. iFlags |= (1<<6)
  191.  
  192. message_begin( MSG_ONE, g_HideWeapon, _, id );
  193. write_byte(iFlags);
  194. message_end();
  195. }
  196.  
  197. public msgHideWeapon()
  198. {
  199. new iFlags
  200.  
  201. iFlags |= (1<<0)
  202. iFlags |= (1<<4)
  203. iFlags |= (1<<5)
  204. iFlags |= (1<<6)
  205. set_msg_arg_int(1, ARG_BYTE, get_msg_arg_int(1) | iFlags)
  206. }
  207.  
  208. public fw_EmitSound(id, channel, const sound[])
  209. {
  210. if(!is_user_alive(id))
  211. return FMRES_IGNORED
  212.  
  213.  
  214. // Check sound
  215. for(new i = 0; i < sizeof oldknife_sounds; i++)
  216. {
  217. if(equal(sound, oldknife_sounds[i]))
  218. {
  219. return FMRES_SUPERCEDE
  220. }
  221. }
  222.  
  223. return FMRES_IGNORED
  224. }
  225.  
  226. public Msg_StatusIcon( msgid, msgdest, id ) {
  227. static szMsg[ 8 ];
  228. get_msg_arg_string( 2, szMsg, 7 );
  229.  
  230. if( equal( szMsg, "buyzone" ) && get_msg_arg_int( 1 ) ) {
  231. set_pdata_int( id, 235, get_pdata_int( id, 235 ) & ~( 1 << 0 ) );
  232. return PLUGIN_HANDLED;
  233. }
  234.  
  235. return PLUGIN_CONTINUE;
  236. }
  237.  
  238. public event_new_round()
  239. {
  240. new FreezeTime = get_cvar_num("mp_freezetime")
  241. g_FreezeTime = true;
  242.  
  243. Countdown(FreezeTime + FREEZETIME_OFFSET)
  244. }
  245.  
  246. public Countdown(FreezeTime)
  247. {
  248. FreezeTime -= FREEZETIME_OFFSET
  249.  
  250. new szFreezeTimeWord[10]
  251. num_to_word(FreezeTime, szFreezeTimeWord, charsmax(szFreezeTimeWord))
  252.  
  253. if(1 <= FreezeTime <= 10)
  254. {
  255. client_cmd(0, "spk sound/fvox/%s.wav", szFreezeTimeWord)
  256. }
  257. FreezeTime--
  258. if(FreezeTime > 0)
  259. {
  260. set_task(1.0, "Countdown", FreezeTime + FREEZETIME_OFFSET)
  261. }
  262. }
  263.  
  264. public RaceStart()
  265. {
  266. g_FreezeTime = false
  267. for (new id;id<=g_MaxPlayers;id++)
  268. {
  269. switch(g_Car[id])
  270. {
  271. case 1:
  272. {
  273. fm_set_user_model(id, "206");
  274. }
  275. case 2:
  276. {
  277. fm_set_user_model(id, "accent");
  278. }
  279. case 3:
  280. {
  281. fm_set_user_model(id, "locust");
  282. }
  283. }
  284. set_task(9.0, "Turbo_On", id + TURBO_OFFSET)
  285. }
  286. speed_task();
  287. g_flRaceStarted = get_gametime();
  288. set_task(0.1, "StartTimer", .flags="b")
  289. }
  290.  
  291. public Turbo_On(id)
  292. {
  293. id -= TURBO_OFFSET
  294. g_HasTurbo[id] = true;
  295. }
  296.  
  297. public Turbo_Off(id)
  298. {
  299. id -= TURBO_OFFSET
  300. g_HasTurbo[id] = false;
  301. g_TurboActivated[id] = false;
  302. set_task(25.0, "Turbo_On", id + TURBO_OFFSET)
  303. }
  304.  
  305. public Turbo(id)
  306. {
  307. if (g_HasTurbo[id])
  308. {
  309. g_TurboActivated[id] = true
  310. speed_task()
  311. set_task(4.0, "Turbo_Off", id + TURBO_OFFSET)
  312. set_task(4.0, "speed_task")
  313. }
  314. }
  315.  
  316. public Event_CurWeapon(id)
  317. {
  318. set_pev(id, pev_viewmodel, engfunc(EngFunc_AllocString, g_ModelInterior))
  319. set_pev(id ,pev_weaponmodel2,"")
  320. }
  321.  
  322. public fw_SetModel(const iEntity, const szModel[])
  323. {
  324. if(pev_valid(iEntity))
  325. {
  326. set_pev(iEntity, pev_viewmodel, engfunc(EngFunc_AllocString, g_ModelInterior))
  327. set_pev(iEntity ,pev_weaponmodel2,"")
  328. }
  329. }
  330.  
  331. public client_disconnect(id)
  332. {
  333. g_Car[id] = 0;
  334. g_TemporaryCar[id] = 0;
  335. }
  336.  
  337. public PlayerPostSpawn(id)
  338. {
  339. g_Car[id] = g_TemporaryCar[id];
  340. switch(g_Car[id])
  341. {
  342. case 1:
  343. {
  344. if(!g_FreezeTime){
  345. set_pev(id, pev_maxspeed, 500.0)
  346. set_pev(id, pev_friction, 0.15)
  347. }
  348. }
  349. case 2:
  350. {
  351. if(!g_FreezeTime){
  352. set_pev(id, pev_maxspeed, 450.0)
  353. set_pev(id, pev_friction, 0.3)
  354. }
  355. }
  356. case 3:
  357. {
  358. if(!g_FreezeTime){
  359. set_pev(id, pev_maxspeed, 400.0)
  360. set_pev(id, pev_friction, 0.6)
  361. }
  362. }
  363. default:
  364. {
  365. if(!g_FreezeTime){
  366. set_pev(id, pev_maxspeed, 450.0)
  367. set_pev(id, pev_friction, 0.3)
  368. }
  369. if(g_Car[id] == 0)
  370. {
  371. if(is_user_connected(id))
  372. fm_set_user_model(id, "accent");
  373. }
  374. }
  375. }
  376. client_cmd(id, "cl_forwardspeed 1000.0")
  377. if(is_user_alive(id)){
  378. strip_user_weapons(id)
  379. give_item(id, "weapon_knife")
  380. set_user_godmode(id, 1)
  381. }
  382. }
  383.  
  384. public speed_task()
  385. {
  386. if(!g_FreezeTime){
  387. for (new id = 1; id <= g_MaxPlayers; id++)
  388. {
  389. if(!is_user_connected(id)) continue
  390.  
  391. switch(g_Car[id])
  392. {
  393. case 1:
  394. {
  395. if(g_TurboActivated[id])
  396. {
  397. set_pev(id, pev_maxspeed, 600.0)
  398. }
  399. else
  400. {
  401. set_pev(id, pev_maxspeed, 500.0)
  402. }
  403. set_pev(id, pev_friction, 0.15)
  404. }
  405. case 2:
  406. {
  407. if(g_TurboActivated[id])
  408. {
  409. set_pev(id, pev_maxspeed, 550.0)
  410. }
  411. else
  412. {
  413. set_pev(id, pev_maxspeed, 450.0)
  414. }
  415. set_pev(id, pev_friction, 0.3)
  416. }
  417. case 3:
  418. {
  419. if(g_TurboActivated[id])
  420. {
  421. set_pev(id, pev_maxspeed, 500.0)
  422. }
  423. else
  424. {
  425. set_pev(id, pev_maxspeed, 400.0)
  426. }
  427. set_pev(id, pev_friction, 0.6)
  428. }
  429. default:
  430. {
  431. if(g_TurboActivated[id])
  432. {
  433. set_pev(id, pev_maxspeed, 550.0)
  434. }
  435. else
  436. {
  437. set_pev(id, pev_maxspeed, 450.0)
  438. }
  439. set_pev(id, pev_friction, 0.3)
  440. if(g_TemporaryCar[id] == 0)
  441. CarMenu(id)
  442. }
  443. }
  444. }
  445. }
  446. set_hudmessage(255, 212, 42, 0.21, 0.91, 0, 6.0, 20.0)
  447. show_hudmessage(0, "%L", LANG_PLAYER, "SPEED")
  448. }
  449.  
  450. public CarMenu(id)
  451. {
  452. if (id>33)
  453. {
  454. id-=CARMENU_OFFSET
  455. }
  456. //first we need to make a variable that will hold the menu
  457. new szMenuName[50]
  458. format(szMenuName, charsmax(szMenuName), "%L", id, "MENU_NAME")
  459. new menu = menu_create(szMenuName, "menu_handler");
  460. //Note - menu_create
  461. //The first parameter is what the menu will be titled (what is at the very top)
  462. //The second parameter is the function that will deal/handle with the menu (which key was pressed, and what to do)
  463. new szCar1[100]
  464. new szCar2[100]
  465. new szCar3[100]
  466. formatex(szCar1, charsmax(szCar1), "%L", id, "CAR1")
  467. formatex(szCar2, charsmax(szCar2), "%L", id, "CAR2")
  468. formatex(szCar3, charsmax(szCar3), "%L", id, "CAR3")
  469. //Now lets add some things to select from the menu
  470. menu_additem(menu, szCar1, "1", 0);
  471. menu_additem(menu, szCar2, "2", 0);
  472. menu_additem(menu, szCar3, "3", 0);
  473. //Note - menu_additem
  474. //The first parameter is which menu we will be adding this item/selection to
  475. //The second parameter is what text will appear on the menu (Note that it is preceeded with a number of which item it is)
  476. //The third parameter is data that we want to send with this item
  477. //The fourth parameter is which admin flag we want to be able to access this item (I have had no experience with this, so I am just assuming this is how it works. It uses the admin flags from the amxconst.inc)
  478.  
  479. //Set a property on the menu
  480. menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
  481. //Note - menu_setprop
  482. //The first parameter is the menu to modify
  483. //The second parameter is what to modify (found in amxconst.inc)
  484. //The third parameter is what to modify it to (in this case, we are adding a option to the menu that will exit the menu. setting it to MEXIT_NEVER will disable this option)
  485.  
  486. //Lets display the menu
  487. menu_display(id, menu, 0);
  488. //Note - menu_display
  489. //The first parameter is which index to show it to (you cannot show this to everyone at once)
  490. //The second parameter is which menu to show them (in this case, the one we just made)
  491. //The third parameter is which page to start them on
  492. }
  493. //okay, we showed them the menu, now lets handle it (looking back at menu_create, we are going to use that function)
  494. public menu_handler(id, menu, item)
  495. {
  496. //we don't want to deal with them if they exited a menu
  497. if( item == MENU_EXIT )
  498. {
  499. menu_destroy(menu);
  500. //Note that you will want to destroy the menu after they do something
  501. return PLUGIN_HANDLED;
  502. }
  503.  
  504. //now lets create some variables that will give us information about the menu and the item that was pressed/chosen
  505. new data[6], szName[64];
  506. new access, callback;
  507. //heres the function that will give us that information (since it doesnt magicaly appear)
  508. menu_item_getinfo(menu, item, access, data,charsmax(data), szName,charsmax(szName), callback);
  509.  
  510. //Note - that you can do this next step how you want, this is just the way I prefer
  511.  
  512. //looking back to menu_additem, we sent data with every item we added, this is where it gets a little fishy for us (where you can do your own method)
  513. new key = str_to_num(data);
  514. //note that all my datas were numbers (you can do it with whatever type of string you want)
  515.  
  516. //now lets find which item was pressed
  517. switch(key)
  518. {
  519. case 1:
  520. {
  521. client_print(id, print_chat, "%L", id, "CAR1_CHOSEN");
  522. //note that if we dont want to continue through the function, we can't just end with a return. We want to kill the menu first
  523. //menu_destroy(menu);
  524. //return PLUGIN_HANDLED;
  525. //fm_set_user_model(id, "206");
  526. }
  527. case 2:
  528. {
  529. client_print(id, print_chat, "%L", id, "CAR2_CHOSEN");
  530. //fm_set_user_model(id, "accent");
  531. }
  532. case 3: //again i don't have experience with the admin limitations, so i don't know if you need to have a check before this (im assuming you don't though ^_^)
  533. {
  534. client_print(id, print_chat, "%L", id, "CAR3_CHOSEN");
  535. //fm_set_user_model(id, "locust");
  536. }
  537. }
  538.  
  539. //g_Car[id]=key;
  540. g_TemporaryCar[id]=key;
  541.  
  542. //lets finish up this function with a menu_destroy, and a return
  543. menu_destroy(menu);
  544. return PLUGIN_HANDLED;
  545. }
  546.  
  547. public StartTimer()
  548. {
  549. g_flRaceTime = get_gametime() - g_flRaceStarted
  550. new iRaceTime = floatround(g_flRaceTime, floatround_floor)
  551. new iMiliSec = floatround((g_flRaceTime*10.0) - (iRaceTime*10), floatround_floor)
  552. new iMinutes = floatround(iRaceTime/60.0, floatround_floor)
  553. new iSeconds = iRaceTime - iMinutes*60
  554.  
  555. client_print(0, print_center, "%i:%i.%i", iMinutes, iSeconds, iMiliSec)
  556. }
  557.  
  558. public CmdStart(Client, Handle)
  559. {
  560. new button = pev(Client,pev_button);
  561. if((button & IN_MOVELEFT) && !(button & IN_MOVERIGHT))
  562. {
  563. client_cmd(Client, "cl_sidespeed 0");
  564. g_lado[Client] = true;
  565. g_DriveAngle[Client] += 1.0
  566. }
  567. else if(!(button & IN_MOVELEFT) && (button & IN_MOVERIGHT))
  568. {
  569. client_cmd(Client, "cl_sidespeed 0");
  570. g_lado[Client] = true;
  571. g_DriveAngle[Client] -= 1.0
  572. }
  573. else
  574. {
  575. g_lado[Client] = false;
  576. }
  577. if(button & IN_USE)
  578. {
  579. Turbo(Client)
  580. }
  581. }
  582.  
  583. public fw_PlayerPostThink(id)
  584. {
  585. if(!g_lado[id])
  586. {
  587. client_cmd(id, "cl_sidespeed 400.0");
  588. }
  589. }
  590.  
  591. public fw_PlayerPreThink(id)
  592. {
  593. static target
  594. static Float:velocity[3]
  595. static Float:speedh
  596. for (new id; id<=g_MaxPlayers; id++)
  597. {
  598. if(!is_user_alive(id)) continue
  599.  
  600. target = pev(id, pev_iuser1) == 4 ? pev(id, pev_iuser2) : id
  601. pev(target, pev_velocity, velocity)
  602.  
  603. speedh = floatsqroot(floatpower(velocity[0], 2.0) + floatpower(velocity[1], 2.0))
  604.  
  605. set_user_armor(id,floatround(speedh, floatround_round))
  606. }
  607. }
  608.  
  609. public Player_Jump(id)
  610. {
  611. static iOldbuttons ; iOldbuttons = entity_get_int(id, EV_INT_oldbuttons)
  612. if( !(iOldbuttons & IN_JUMP) )
  613. {
  614. entity_set_int(id, EV_INT_oldbuttons, iOldbuttons | IN_JUMP)
  615. return HAM_HANDLED
  616. }
  617. return HAM_IGNORED
  618. }
  619.  
  620. public newcheckpoint(id,team)
  621. {
  622. new configfile[200]
  623. get_configsdir(configfile,199)
  624. new mapname[32]
  625. get_mapname(mapname,31)
  626. format(configfile,199,"%s/CSRally_checkpoints/%s.ini",configfile, mapname)
  627. Fsize = file_size(configfile) - 1
  628. new string[200]
  629.  
  630. new Float:origin[3]
  631. new Float:v_angle[3]
  632.  
  633. pev(id,pev_origin,origin)
  634. pev(id,pev_v_angle,v_angle)
  635.  
  636. if(file_exists(configfile))
  637. {
  638. Fsize = file_size(configfile,1) - 1
  639. format(string,199,"%s | %f %f %f %f %f %f",mapname,origin[0],origin[1],origin[2], v_angle[0], v_angle[1], v_angle[2])
  640. write_file(configfile,string,-1)
  641. }
  642. else
  643. {
  644. format(string,199,"%s | %f %f %f %f %f %f",mapname,origin[0],origin[1],origin[2], v_angle[0], v_angle[1], v_angle[2])
  645. write_file(configfile,string,-1)
  646.  
  647. }
  648. }
  649.  
  650. public advertise()
  651. {
  652. client_print(0, print_chat, "CS Rally %s by mabaclu", VERSION);
  653. }
  654.  
  655. public get_checkpoint_origins(checkpointid, Float:origin[3], Float:v_angle[3])
  656. {
  657. new i
  658. new Float:midpoint[2][3]
  659. for(i=0;i<2;i++)
  660. {
  661. for(new j=0;j<3;j++)
  662. {
  663. midpoint[i][j] = (maxs[i][j] + mins[i][j]) / 2.0
  664. }
  665. }
  666.  
  667. new configfile[200]
  668. get_configsdir(configfile,199)
  669. new mapname[32]
  670. get_mapname(mapname,31)
  671. format(configfile,199,"%s/CSRally_checkpoints/%s.ini",configfile, mapname)
  672.  
  673. origin[0] = midpoint[0][0]
  674. origin[1] = midpoint[0][1]
  675. origin[2] = midpoint[0][2]
  676.  
  677. new string[200]
  678. format(string,199,"%s | ",mapname)
  679.  
  680. if(file_exists(configfile))
  681. {
  682. new read[200], trash
  683. Fsize = file_size(configfile,1) - 1
  684. if (checkpointid <= Fsize)
  685. {
  686. read_file(configfile,(checkpointid - 1),read,199,trash)
  687. if(containi(read,string)==0)
  688. {
  689. format(read,199,read[strlen(string)])
  690. replace_all(read,199," | ","")
  691. strbreak(read,string,199,read,199)
  692. origin[0] = str_to_float(string)
  693. strbreak(read,string,199,read,199)
  694. origin[1] = str_to_float(string)
  695. strbreak(read,string,199,read,199)
  696. origin[2] = str_to_float(string)
  697. strbreak(read,string,199,read,199)
  698. v_angle[0] = str_to_float(string)
  699. strbreak(read,string,199,read,199)
  700. v_angle[1] = str_to_float(string)
  701. strbreak(read,string,199,read,199)
  702. v_angle[2] = str_to_float(string)
  703. }
  704. }
  705. }
  706.  
  707. return ;
  708. }
  709.  
  710. public FM_Think_Hook(ent)
  711. {
  712. if(pev_valid(ent))
  713. {
  714. static classname[32]
  715. pev(ent,pev_classname,classname,31)
  716. if(equal(classname,"CSRally_Checkpoint"))
  717. {
  718. Checkpoint_Think_Hook(ent)
  719. set_pev(ent,pev_nextthink,0.1)
  720. }
  721. }
  722. }
  723.  
  724. /*
  725. Checkpoint Think
  726. */
  727.  
  728. public Checkpoint_Think_Hook(ent)
  729. {
  730. new Float:origin[3]
  731. new Float:checkpoint_origin[3]
  732. new Float:v_angle[3]
  733. new checkpointid
  734. for (new c = 1; c < MAX_CHECKPOINTS; c++)
  735. {
  736. if (g_CheckpointID_to_Ent[c] == ent)
  737. {
  738. checkpointid = c
  739. break;
  740. }
  741. }
  742. static players[32], num
  743. get_players(players,num,"ach")
  744. for(new i=0;i<num;i++)
  745. {
  746. pev(players[i], pev_origin, origin)
  747. get_checkpoint_origins(checkpointid, checkpoint_origin, v_angle)
  748. if(get_distance_f(origin,checkpoint_origin)<CHECKPOINT_DISTANCE)
  749. {
  750. if (g_CheckpointID[players[i]] == (checkpointid - 1))
  751. {
  752. g_CheckpointID[players[i]]++;
  753. client_cmd(players[i],"spk voc/checkpoint.wav")
  754. g_LastTime[players[i]] = g_flRaceTime;
  755. //client_print(players[i], print_chat, "You have completed %i out of %i checkpoints in this lap.", g_CheckpointID[players[i]], Fsize)
  756. if (g_CheckpointID[players[i]] >= Fsize)
  757. {
  758. g_Lap[players[i]]++;
  759. g_CheckpointID[players[i]] = 0;
  760. if (g_Lap[players[i]] >= get_pcvar_num(g_TotalLaps))
  761. {
  762. g_Lap[players[i]] = 0;
  763. new name[64]
  764. get_user_name(players[i], name, sizeof(name))
  765. client_print(0, print_chat, "%L", LANG_PLAYER, "RACE_WINNER", name)
  766. eRoundEnd()
  767. set_task(2.0, "kill_winner")
  768. for (new k; k<num; k++)
  769. {
  770. if (k != i)
  771. {
  772. user_silentkill(players[k])
  773. }
  774. }
  775. }
  776. //else
  777. //{
  778. //client_print(players[i], print_chat, "You have completed %i out of %i laps.", g_Lap[players[i]], get_pcvar_num(g_TotalLaps))
  779. //}
  780. }
  781. }
  782. }
  783. }
  784. return ;
  785. }
  786.  
  787. public kill_winner()
  788. {
  789. for (new i; i<=g_MaxPlayers; i++)
  790. {
  791. if (is_user_alive(i))
  792. {
  793. user_silentkill(i)
  794. }
  795. }
  796. }
  797.  
  798. public make_checkpoints()
  799. {
  800. for (new k = 1; k <= Fsize; k++)
  801. {
  802. new Float:checkpoint_origin[3]
  803. new Float:v_angle[3]
  804. new ent = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"info_target"))
  805. g_CheckpointID_to_Ent[k] = ent;
  806. set_pev(ent,pev_classname,"CSRally_Checkpoint")
  807. //engfunc(EngFunc_SetModel,ent,red_flag_model)
  808. set_pev(ent,pev_movetype,MOVETYPE_FLY)
  809. FM_Think_Hook(ent)
  810. get_checkpoint_origins(k, checkpoint_origin, v_angle)
  811. engfunc(EngFunc_SetOrigin,ent,checkpoint_origin)
  812. if (k == Fsize)
  813. {
  814. checkpoint_final_sprite(checkpoint_origin, v_angle)
  815. }
  816. else
  817. {
  818. checkpoint_sprite(checkpoint_origin, v_angle)
  819. }
  820. }
  821. }
  822.  
  823. public GetPositions()
  824. {
  825. new _:iaPosition[33][PositionsData];
  826. new iPlayers[32], bool:idChecked[33], iNum, iPosition
  827. get_players(iPlayers, iNum);
  828.  
  829. for(new i; i<=iNum; i++)
  830. {
  831. new id = iPlayers[i]
  832. if(is_user_connected(id) && !idChecked[id])
  833. {
  834. iPosition = (Fsize*g_Lap[id])+g_CheckpointID[id]
  835.  
  836. iaPosition[id][ID] = id
  837. iaPosition[id][Position] = iPosition
  838. iaPosition[id][LastTime] = _:g_LastTime[id]
  839. }
  840. }
  841. SortCustom2D(iaPosition, 33, "fn_StatsCompare")
  842.  
  843. new szPositions[30]
  844. formatex (szPositions, charsmax(szPositions), "%L", LANG_PLAYER, "POSITIONS")
  845. new szTable[2000]
  846. formatex(szTable, charsmax(szTable), "^n^n%s:^n", szPositions)
  847. for(new i; i<=32; i++)
  848. {
  849. new id = iaPosition[i][ID]
  850. if(is_user_connected(id) && (g_Lap[id] != 0 || g_CheckpointID[id] != 0))
  851. {
  852. new szName[100]
  853. get_user_name(id, szName, charsmax(szName))
  854.  
  855. format(szName, charsmax(szName), "#%i - %s^n", i+1, szName)
  856. add(szTable, charsmax(szTable), szName)
  857. }
  858. }
  859.  
  860. new szCheckPoint[32] = "Checkpoint: "
  861. new szSlash[5] = "/"
  862. new szMLLap[20]
  863. formatex(szMLLap, charsmax(szMLLap), "%L", LANG_PLAYER, "LAP")
  864. new szLap[24]
  865. formatex(szLap, charsmax(szLap), "^n%s: ", szMLLap)
  866. new szCheckpointID[5]
  867. new szFsize[5]
  868. new szLapID[5]
  869. new szG_TotalLaps[5]
  870. new szHudMessage[2100]
  871.  
  872. for(new i;i<=g_MaxPlayers; i++)
  873. {
  874. szHudMessage = "";
  875. if(is_user_alive(i))
  876. {
  877. add(szHudMessage, charsmax(szHudMessage), szCheckPoint)
  878. num_to_str(g_CheckpointID[i], szCheckpointID, sizeof(szCheckpointID))
  879. add(szHudMessage, charsmax(szHudMessage), szCheckpointID)
  880. add(szHudMessage, charsmax(szHudMessage), szSlash)
  881. num_to_str(Fsize, szFsize, sizeof(szFsize))
  882. add(szHudMessage, charsmax(szHudMessage), szFsize)
  883. add(szHudMessage, charsmax(szHudMessage), szLap)
  884. num_to_str(g_Lap[i] + 1, szLapID, sizeof(szCheckpointID))
  885. add(szHudMessage, charsmax(szHudMessage), szLapID)
  886. add(szHudMessage, charsmax(szHudMessage), szSlash)
  887. num_to_str(get_pcvar_num(g_TotalLaps), szG_TotalLaps, sizeof(szFsize))
  888. add(szHudMessage, charsmax(szHudMessage), szG_TotalLaps)
  889. }
  890. add(szHudMessage, charsmax(szHudMessage), szTable)
  891. set_hudmessage(0, 50, 255, 0.03, 0.22, _, _, 20.0, _, _, 3)
  892. show_hudmessage(i, "%s", szHudMessage)
  893. }
  894. }
  895.  
  896. public fn_StatsCompare(elem1[], elem2[])
  897. {
  898. if(elem1[Position] > elem2[Position])
  899. {
  900. return -1;
  901. }
  902.  
  903. else if(elem1[Position] == elem2[Position])
  904. {
  905. if(g_LastTime[elem1[ID]] < g_LastTime[elem2[ID]])
  906. {
  907. return -1;
  908. }
  909. else if(g_LastTime[elem1[ID]] > g_LastTime[elem2[ID]])
  910. {
  911. return 1;
  912. }
  913.  
  914. return 0;
  915. }
  916.  
  917. return 1;
  918. }
  919.  
  920. public dust_task()
  921. {
  922. for (new id = 1; id <= g_MaxPlayers; id++)
  923. {
  924. new origin[3]
  925. if(is_user_alive(id))
  926. {
  927. get_user_origin(id, origin)
  928.  
  929. if(!(origin[0] == g_OldOrigin[id][0] && origin[1] == g_OldOrigin[id][1] && origin[2] ==g_OldOrigin[id][2]))
  930. {
  931. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  932. write_byte(TE_GLOWSPRITE)
  933. write_coord(origin[0])
  934. write_coord(origin[1])
  935. write_coord(origin[2])
  936. write_short(g_DustSprite)
  937. write_byte(2)
  938. write_byte(20)
  939. write_byte(150)
  940. message_end()
  941. }
  942. g_OldOrigin[id] = origin;
  943. }
  944. }
  945. }
  946.  
  947. public cmdCam(id)
  948. {
  949. if(g_ThirdPerson[id])
  950. {
  951. set_view(id, CAMERA_NONE)
  952. g_ThirdPerson[id] = false
  953. }
  954. else
  955. {
  956. set_view(id, CAMERA_3RDPERSON)
  957. g_ThirdPerson[id] = true
  958. }
  959. }
  960.  
  961.  
  962. public checkpoint_sprite(Float:fOrigin[3], Float:v_angle[3])
  963. {
  964. /*new origin[3]
  965. origin[0] = floatround(fOrigin[0])
  966. origin[1] = floatround(fOrigin[1])
  967. origin[2] = floatround(fOrigin[2]+20)*/
  968.  
  969. fOrigin[2] += 20;
  970. new ent = create_entity("info_target")
  971.  
  972. entity_set_string(ent,EV_SZ_classname,"ghw_spawned_ent2")
  973.  
  974. entity_set_model(ent,CheckpointSprite)
  975.  
  976. entity_set_origin(ent,fOrigin)
  977. entity_set_vector(ent,EV_VEC_v_angle,v_angle)
  978. entity_set_vector(ent,EV_VEC_angles,v_angle)
  979.  
  980. entity_set_int(ent, EV_INT_solid,SOLID_NOT)
  981. entity_set_int(ent,EV_INT_movetype,MOVETYPE_FLY)
  982. entity_set_edict(ent,EV_ENT_owner,33)
  983.  
  984. entity_set_float(ent,EV_FL_framerate,1.0)
  985. entity_set_int(ent,EV_INT_sequence,0)
  986.  
  987. entity_set_size(ent,Float:{-0.1, -0.1, -0.1},Float:{0.1, 0.1, 0.1})
  988.  
  989. //entity_set_int(ent,EV_INT_renderfx,kRenderFxNone);
  990. //entity_set_vector(ent,EV_VEC_rendercolor,{100,100,100});
  991. //entity_set_int(ent,EV_INT_rendermode,kRenderTransTexture);
  992. //set_pev(ent,pev_rendermode,kRenderTransAdd);
  993. //entity_set_float(ent,EV_FL_renderamt,0.0);
  994.  
  995. set_rendering(ent, kRenderFxNone, 0, 0, 0, kRenderTransAdd, 255)
  996.  
  997. /*message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  998. write_byte(TE_GLOWSPRITE)
  999. write_coord(origin[0])
  1000. write_coord(origin[1])
  1001. write_coord(origin[2])
  1002. write_short(exploSpr)
  1003. write_byte(99999999999999999999)
  1004. write_byte(20)
  1005. write_byte(150)
  1006. message_end()*/
  1007.  
  1008. /*message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
  1009. write_byte(TE_SPRITE)
  1010. write_coord(origin[0])
  1011. write_coord(origin[1])
  1012. write_coord(origin[2])
  1013. write_short(exploSpr)
  1014. write_byte(9999999999999999999)
  1015. write_byte(255)
  1016. message_end()*/
  1017. }
  1018.  
  1019. public checkpoint_final_sprite(Float:fOrigin[3], Float:v_angle[3])
  1020. {
  1021. fOrigin[2] += 20;
  1022. new ent = create_entity("info_target")
  1023.  
  1024. entity_set_string(ent,EV_SZ_classname,"ghw_spawned_ent3")
  1025.  
  1026. entity_set_model(ent,FinalCheckpointSprite)
  1027.  
  1028. entity_set_origin(ent,fOrigin)
  1029. entity_set_vector(ent,EV_VEC_v_angle,v_angle)
  1030. entity_set_vector(ent,EV_VEC_angles,v_angle)
  1031.  
  1032. entity_set_int(ent, EV_INT_solid,SOLID_NOT)
  1033. entity_set_int(ent,EV_INT_movetype,MOVETYPE_FLY)
  1034. entity_set_edict(ent,EV_ENT_owner,33)
  1035.  
  1036. entity_set_float(ent,EV_FL_framerate,1.0)
  1037. entity_set_int(ent,EV_INT_sequence,0)
  1038.  
  1039. entity_set_size(ent,Float:{-0.1, -0.1, -0.1},Float:{0.1, 0.1, 0.1})
  1040.  
  1041. set_rendering(ent, kRenderFxNone, 0, 0, 0, kRenderTransAdd, 255)
  1042. }
  1043.  
  1044. public sprites_task()
  1045. {
  1046. new Float:origin[3]
  1047. new Float:v_angle[3]
  1048. for (new checkpointid = 1; checkpointid <= Fsize; checkpointid++)
  1049. {
  1050. get_checkpoint_origins(checkpointid, origin, v_angle)
  1051. checkpoint_sprite(origin, v_angle)
  1052. }
  1053. }
  1054.  
  1055. public engine_task()
  1056. {
  1057. for (new id = 1; id <= g_MaxPlayers; id++)
  1058. {
  1059. if(is_user_alive(id) && g_EngineSound[id])
  1060. {
  1061. client_cmd(id, "spk ^"%s^"", g_SoundEngine)
  1062. }
  1063. }
  1064. }
  1065.  
  1066. public Engine_ON(id)
  1067. {
  1068. g_EngineSound[id] = true;
  1069. }
  1070.  
  1071. public Engine_OFF(id)
  1072. {
  1073. g_EngineSound[id] = false;
  1074. }
  1075.  
  1076. public eRoundEnd()
  1077. {
  1078. for (new id = 1; id <= g_MaxPlayers; id++)
  1079. {
  1080. g_CheckpointID[id] = 0
  1081. g_Lap[id] = 0
  1082. iaPosition[id][0] = 0
  1083. iaPosition[id][1] = 0
  1084. }
  1085. }

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Rally Mod.
HozzászólásElküldve: 2013.10.09. 06:51 
Offline
Signore Senior
Avatar

Csatlakozott: 2011.09.09. 17:39
Hozzászólások: 4020
Megköszönt másnak: 12 alkalommal
Megköszönték neki: 139 alkalommal
amxmodx log?


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Rally Mod.
HozzászólásElküldve: 2013.10.09. 11:39 
Offline
Félisten
Avatar

Csatlakozott: 2013.03.12. 10:03
Hozzászólások: 859
Megköszönt másnak: 37 alkalommal
Megköszönték neki: 44 alkalommal
SMA Forráskód: [ Mindet kijelol ]
  1. L 10/09/2013 - 02:40:28: Start of error session.
  2. L 10/09/2013 - 02:40:28: Info (map "rc_vegas319") (file "addons/amxmodx/logs/error_20131009.log")
  3. L 10/09/2013 - 02:40:28: [AMXX] Invalid Plugin (plugin "cs_rally.amxx")
  4. L 10/09/2013 - 02:41:29: Start of error session.
  5. L 10/09/2013 - 02:41:29: Info (map "rc_vegas319") (file "addons/amxmodx/logs/error_20131009.log")
  6. L 10/09/2013 - 02:41:29: [AMXX] Invalid Plugin (plugin "cs_rally.amxx")
  7. L 10/09/2013 - 02:44:42: Start of error session.
  8. L 10/09/2013 - 02:44:42: Info (map "rc_vegas319") (file "addons/amxmodx/logs/error_20131009.log")
  9. L 10/09/2013 - 02:44:42: [AMXX] Invalid Plugin (plugin "cs_rally.amxx")
  10. L 10/09/2013 - 03:02:43: Start of error session.
  11. L 10/09/2013 - 03:02:43: Info (map "gt_lvc") (file "addons/amxmodx/logs/error_20131009.log")
  12. L 10/09/2013 - 03:02:43: [AMXX] Invalid Plugin (plugin "cs_rally.amxx")

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Rally Mod.
HozzászólásElküldve: 2013.10.09. 11:44 
Offline
Tiszteletbeli
Avatar

Csatlakozott: 2011.09.18. 13:01
Hozzászólások: 4270
Megköszönt másnak: 55 alkalommal
Megköszönték neki: 513 alkalommal
Papi írta:
SMA Forráskód: [ Mindet kijelol ]
  1. L 10/09/2013 - 02:40:28: Start of error session.
  2. L 10/09/2013 - 02:40:28: Info (map "rc_vegas319") (file "addons/amxmodx/logs/error_20131009.log")
  3. L 10/09/2013 - 02:40:28: [AMXX] Invalid Plugin (plugin "cs_rally.amxx")
  4. L 10/09/2013 - 02:41:29: Start of error session.
  5. L 10/09/2013 - 02:41:29: Info (map "rc_vegas319") (file "addons/amxmodx/logs/error_20131009.log")
  6. L 10/09/2013 - 02:41:29: [AMXX] Invalid Plugin (plugin "cs_rally.amxx")
  7. L 10/09/2013 - 02:44:42: Start of error session.
  8. L 10/09/2013 - 02:44:42: Info (map "rc_vegas319") (file "addons/amxmodx/logs/error_20131009.log")
  9. L 10/09/2013 - 02:44:42: [AMXX] Invalid Plugin (plugin "cs_rally.amxx")
  10. L 10/09/2013 - 03:02:43: Start of error session.
  11. L 10/09/2013 - 03:02:43: Info (map "gt_lvc") (file "addons/amxmodx/logs/error_20131009.log")
  12. L 10/09/2013 - 03:02:43: [AMXX] Invalid Plugin (plugin "cs_rally.amxx")

Talan ha error logot kuldened el akkor meg tudnank is a hibat nyisd meg es azt kuld el.

_________________
Idk. Csak ugy funbooo.
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Rally Mod.
HozzászólásElküldve: 2013.10.09. 12:17 
Offline
Félisten
Avatar

Csatlakozott: 2013.03.12. 10:03
Hozzászólások: 859
Megköszönt másnak: 37 alkalommal
Megköszönték neki: 44 alkalommal
ez van az error logba..

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Rally Mod.
HozzászólásElküldve: 2013.10.09. 14:38 
Offline
Signore Senior
Avatar

Csatlakozott: 2011.09.09. 17:39
Hozzászólások: 4020
Megköszönt másnak: 12 alkalommal
Megköszönték neki: 139 alkalommal
Valami bibi volt konvertálás közbe és baj van az amxx fájllal. Konvertáld újra és úgy próbáld.

(Egyébként ezt a logot kértem, ne okoskodj Detector)


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése:  Rendezés  
Új téma nyitása  Hozzászólás a témához  [ 6 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 71 vendég


Nyithatsz új témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség
Portal: Kiss Portal Extension © Michael O'Toole