hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2025.06.17. 16:51



Jelenlévő felhasználók

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

A legtöbb felhasználó (2761 fő) 2025.01.09. 20:06-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  [2 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: NPC, entity
HozzászólásElküldve:2012.07.08. 18:26 
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
Hogy lehet egy egyszerű npc-t lespawnolni? Nem kell h mozogjon, csak legyen :D


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: NPC, entity
HozzászólásElküldve:2012.07.08. 18:28 
Offline
Tiszteletbeli
Avatar

Csatlakozott:2011.09.18. 13:01
Hozzászólások:4274
Megköszönt másnak: 55 alkalommal
Megköszönték neki: 515 alkalommal
Kód:
  1. #include <amxmodx>

  2. #include <amxmisc>

  3. #include <fakemeta>

  4. #include <engine>

  5. #include <hamsandwich>

  6.  

  7.  

  8. //Boolean of when NPC spawned

  9. new bool: g_NpcSpawn[256];

  10. //Boolean to check if NPC is alive or not

  11. new bool: g_NpcDead[256];

  12. //Classname for our NPC

  13. new const g_NpcClassName[] = "ent_npc";

  14. //Constant model for NPC

  15. new const g_NpcModel[] = "models/barney.mdl";

  16.  

  17. //List of sounds our NPC will emit when damaged

  18. new const g_NpcSoundPain[][] =  

  19. {

  20.     "barney/ba_pain1.wav",

  21.     "barney/ba_pain2.wav",

  22.     "barney/ba_pain3.wav"

  23. }

  24.  

  25. //Sounds when killed

  26. new const g_NpcSoundDeath[][] =

  27. {

  28.     "barney/ba_die1.wav",

  29.     "barney/ba_die2.wav",

  30.     "barney/ba_die3.wav"

  31. }

  32.  

  33. //Sounds when we knife our flesh NPC

  34. new const g_NpcSoundKnifeHit[][] =

  35. {

  36.         "weapons/knife_hit1.wav",

  37.         "weapons/knife_hit2.wav",

  38.         "weapons/knife_hit3.wav",

  39.         "weapons/knife_hit4.wav"

  40. }

  41.  

  42. new const g_NpcSoundKnifeStab[] = "weapons/knife_stab.wav";

  43.  

  44. //List of idle animations

  45. new const NPC_IdleAnimations[] = { 0, 1, 2, 3, 11, 12, 18, 21, 39, 63, 65 };

  46.  

  47. //Sprites for blood when our NPC is damaged

  48. new spr_blood_drop, spr_blood_spray

  49.  

  50. //Player cooldown for using our NPC

  51. new Float: g_Cooldown[32];

  52.  

  53. //Boolean to check if we knifed our NPC

  54. new bool: g_Hit[32];

  55.  

  56. public plugin_init()

  57. {

  58.         register_plugin("NPC Plugin", "1.1", "Mazza");

  59.         register_clcmd("say /npc", "ClCmd_NPC");

  60.        

  61.         register_event("HLTV", "Event_NewRound", "a", "1=0", "2=0");

  62.                

  63.         RegisterHam(Ham_TakeDamage, "info_target", "npc_TakeDamage");

  64.         RegisterHam(Ham_Killed, "info_target", "npc_Killed");

  65.         RegisterHam(Ham_Think, "info_target", "npc_Think");

  66.         RegisterHam(Ham_TraceAttack, "info_target", "npc_TraceAttack");

  67.         RegisterHam(Ham_ObjectCaps, "player", "npc_ObjectCaps", 1 );

  68.        

  69.         register_forward(FM_EmitSound, "npc_EmitSound");

  70. }

  71.  

  72. public plugin_precache()

  73. {

  74.         spr_blood_drop = precache_model("sprites/blood.spr")

  75.         spr_blood_spray = precache_model("sprites/bloodspray.spr")

  76.        

  77.         new i;

  78.         for(i = 0 ; i < sizeof g_NpcSoundPain ; i++)

  79.                 precache_sound(g_NpcSoundPain[i]);

  80.         for(i = 0 ; i < sizeof g_NpcSoundDeath ; i++)

  81.                 precache_sound(g_NpcSoundDeath[i]);

  82.  

  83.         precache_model(g_NpcModel)

  84. }

  85.  

  86. public plugin_cfg()

  87. {

  88.         Load_Npc()

  89. }

  90.  

  91. public ClCmd_NPC(id)

  92. {

  93.         //Create a new menu

  94.         new menu = menu_create("NPC: Main Menu", "Menu_Handler");

  95.        

  96.         //Add some items to the newly created menu

  97.         menu_additem(menu, "Create NPC", "1");

  98.         menu_additem(menu, "Delete NPC", "2");

  99.         menu_additem(menu, "Save current NPC locations", "3");

  100.         menu_additem(menu, "Delete all NPC", "4");

  101.        

  102.         //Let the menu have an 'Exit' option

  103.         menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);

  104.        

  105.         //Display our menu

  106.         menu_display(id, menu);

  107. }

  108.  

  109. public Menu_Handler(id, menu, item)

  110. {

  111.         //If user chose to exit menu we will destroy our menu

  112.         if(item == MENU_EXIT)

  113.         {

  114.                 menu_destroy(menu);

  115.                 return PLUGIN_HANDLED;

  116.         }

  117.        

  118.         new info[6], szName[64];

  119.         new access, callback;

  120.        

  121.         menu_item_getinfo(menu, item, access, info, charsmax(info), szName, charsmax(szName), callback);

  122.        

  123.         new key = str_to_num(info);

  124.        

  125.         switch(key)

  126.         {

  127.                 case 1:

  128.                 {

  129.                         //Create our NPC

  130.                         Create_Npc(id);

  131.                 }

  132.                 case 2:

  133.                 {

  134.                         //Remove our NPC by the users aim

  135.                         new iEnt, body, szClassname[32];

  136.                         get_user_aiming(id, iEnt, body);

  137.                        

  138.                         if (is_valid_ent(iEnt))

  139.                         {

  140.                                 entity_get_string(iEnt, EV_SZ_classname, szClassname, charsmax(szClassname));

  141.                                

  142.                                 if (equal(szClassname, g_NpcClassName))

  143.                                 {

  144.                                         remove_entity(iEnt);

  145.                                 }

  146.                                

  147.                         }

  148.                 }

  149.                 case 3:

  150.                 {

  151.                         //Save the current locations of all the NPCs

  152.                         Save_Npc();

  153.                        

  154.                         client_print(id, print_chat, "[AMXX] NPC origin saved succesfully");

  155.                 }

  156.                 case 4:

  157.                 {

  158.                         //Remove all NPCs from the map

  159.                         remove_entity_name(g_NpcClassName);

  160.                        

  161.                         client_print(id, print_chat, "[AMXX] ALL NPC origin removed");

  162.                 }

  163.         }

  164.        

  165.         //Keep the menu displayed when we choose an option

  166.         menu_display(id, menu);

  167.        

  168.         return PLUGIN_HANDLED;

  169. }

  170.  

  171. public npc_TakeDamage(iEnt, inflictor, attacker, Float:damage, bits)

  172. {

  173.         //Make sure we only catch our NPC by checking the classname

  174.         new className[32];

  175.         entity_get_string(iEnt, EV_SZ_classname, className, charsmax(className))

  176.        

  177.         if(!equali(className, g_NpcClassName))

  178.                 return;

  179.                

  180.         //Play a random animation when damanged

  181.         Util_PlayAnimation(iEnt, random_num(13, 17), 1.25);

  182.  

  183.         //Make our NPC say something when it is damaged

  184.         //NOTE: Interestingly... Our NPC mouth (which is a controller) moves!! That saves us some work!!

  185.         emit_sound(iEnt, CHAN_VOICE, g_NpcSoundPain[random(sizeof g_NpcSoundPain)],  VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

  186.        

  187.         g_Hit[attacker] = true;

  188. }

  189.  

  190. public npc_Killed(iEnt)

  191. {

  192.         new className[32];

  193.         entity_get_string(iEnt, EV_SZ_classname, className, charsmax(className))

  194.        

  195.         if(!equali(className, g_NpcClassName))

  196.                 return HAM_IGNORED;

  197.  

  198.         //Player a death animation once our NPC is killed

  199.         Util_PlayAnimation(iEnt, random_num(25, 30))

  200.  

  201.         //Because our NPC may look like it is laying down.

  202.         //The bounding box size is still there and it is impossible to change it so we will make the solid of our NPC to nothing

  203.         entity_set_int(iEnt, EV_INT_solid, SOLID_NOT);

  204.  

  205.         //The voice of the NPC when it is dead

  206.         emit_sound(iEnt, CHAN_VOICE, g_NpcSoundDeath[random(sizeof g_NpcSoundDeath)],  VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

  207.  

  208.         //Our NPC is dead so it shouldn't take any damage and play any animations

  209.         entity_set_float(iEnt, EV_FL_takedamage, 0.0);

  210.         //Our death boolean should now be true!!

  211.         g_NpcDead[iEnt] = true;

  212.                

  213.         //The most important part of this forward!! We have to block the death forward.

  214.         return HAM_SUPERCEDE

  215. }

  216.  

  217. public npc_Think(iEnt)

  218. {

  219.         if(!is_valid_ent(iEnt))

  220.                 return;

  221.        

  222.         static className[32];

  223.         entity_get_string(iEnt, EV_SZ_classname, className, charsmax(className))

  224.        

  225.         if(!equali(className, g_NpcClassName))

  226.                 return;

  227.        

  228.         //We can remove our NPC here if we wanted to but I left this blank as I personally like it when there is a NPC coprse laying around

  229.         if(g_NpcDead[iEnt])

  230.         {

  231.                 return;

  232.         }

  233.                

  234.         //Our NPC just spawned

  235.         if(g_NpcSpawn[iEnt])

  236.         {

  237.                 static Float: mins[3], Float: maxs[3];

  238.                 pev(iEnt, pev_absmin, mins);

  239.                 pev(iEnt, pev_absmax, maxs);

  240.  

  241.                 //Draw a box which is the size of the bounding NPC

  242.                 message_begin(MSG_BROADCAST, SVC_TEMPENTITY)

  243.                 write_byte(TE_BOX)

  244.                 engfunc(EngFunc_WriteCoord, mins[0])

  245.                 engfunc(EngFunc_WriteCoord, mins[1])

  246.                 engfunc(EngFunc_WriteCoord, mins[2])

  247.                 engfunc(EngFunc_WriteCoord, maxs[0])

  248.                 engfunc(EngFunc_WriteCoord, maxs[1])

  249.                 engfunc(EngFunc_WriteCoord, maxs[2])

  250.                 write_short(100)

  251.                 write_byte(random_num(25, 255))

  252.                 write_byte(random_num(25, 255))

  253.                 write_byte(random_num(25, 255))

  254.                 message_end();

  255.                

  256.                 //Our NPC spawn boolean is now set to false

  257.                 g_NpcSpawn[iEnt] = false;

  258.         }

  259.        

  260.         //Choose a random idle animation

  261.         Util_PlayAnimation(iEnt, NPC_IdleAnimations[random(sizeof NPC_IdleAnimations)]);

  262.  

  263.         //Make our NPC think every so often

  264.         entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + random_float(5.0, 10.0));

  265. }

  266.  

  267. public npc_TraceAttack(iEnt, attacker, Float: damage, Float: direction[3], trace, damageBits)

  268. {

  269.         if(!is_valid_ent(iEnt))

  270.                 return;

  271.        

  272.         new className[32];

  273.         entity_get_string(iEnt, EV_SZ_classname, className, charsmax(className))

  274.        

  275.         if(!equali(className, g_NpcClassName))

  276.                 return;

  277.                

  278.         //Retrieve the end of the trace

  279.         new Float: end[3]

  280.         get_tr2(trace, TR_vecEndPos, end);

  281.        

  282.         //This message will draw blood sprites at the end of the trace

  283.         message_begin(MSG_BROADCAST,SVC_TEMPENTITY)

  284.         write_byte(TE_BLOODSPRITE)

  285.         engfunc(EngFunc_WriteCoord, end[0])

  286.         engfunc(EngFunc_WriteCoord, end[1])

  287.         engfunc(EngFunc_WriteCoord, end[2])

  288.         write_short(spr_blood_spray)

  289.         write_short(spr_blood_drop)

  290.         write_byte(247) // color index

  291.         write_byte(random_num(1, 5)) // size

  292.         message_end()

  293. }

  294.  

  295. public npc_ObjectCaps(id)

  296. {

  297.         //Make sure player is alive

  298.         if(!is_user_alive(id))

  299.                 return;

  300.  

  301.         //Check when player presses +USE key

  302.         if(get_user_button(id) & IN_USE)

  303.         {              

  304.                 //Check cooldown of player when using our NPC

  305.                 static Float: gametime ; gametime = get_gametime();

  306.                 if(gametime - 1.0 > g_Cooldown[id])

  307.                 {

  308.                         //Get the classname of whatever ent we are looking at

  309.                         static iTarget, iBody, szAimingEnt[32];

  310.                         get_user_aiming(id, iTarget, iBody, 75);

  311.                         entity_get_string(iTarget, EV_SZ_classname, szAimingEnt, charsmax(szAimingEnt));

  312.                        

  313.                         //Make sure our aim is looking at a NPC

  314.                         if(equali(szAimingEnt, g_NpcClassName))

  315.                         {

  316.                                 //Do more fancy stuff here such as opening a menu

  317.                                 //But for this tutorial I will only display a message to prove it works

  318.                                 client_print(id, print_chat, "Hello");

  319.                         }

  320.                        

  321.                         //Set players cooldown to the current gametime

  322.                         g_Cooldown[id] = gametime;

  323.                 }

  324.         }

  325. }

  326.  

  327. public npc_EmitSound(id, channel, sample[], Float:volume, Float:attn, flag, pitch)

  328. {

  329.         //Make sure player is alive

  330.         if(!is_user_connected(id))

  331.                 return FMRES_SUPERCEDE;

  332.  

  333.         //Catch the current button player is pressing

  334.         new iButton = get_user_button(id);

  335.                                        

  336.         //If the player knifed the NPC

  337.         if(g_Hit[id])

  338.         {      

  339.                 //Catch the string and make sure its a knife

  340.                 if (sample[0] == 'w' && sample[1] == 'e' && sample[8] == 'k' && sample[9] == 'n')

  341.                 {

  342.                         //Catch the file of _hitwall1.wav or _slash1.wav/_slash2.wav

  343.                         if(sample[17] == 's' || sample[17] == 'w')

  344.                         {

  345.                                 //If player is slashing then play the knife hit sound

  346.                                 if(iButton & IN_ATTACK)

  347.                                 {

  348.                                         emit_sound(id, CHAN_WEAPON, g_NpcSoundKnifeHit[random(sizeof g_NpcSoundKnifeHit)], volume, attn, flag, pitch);

  349.                                 }

  350.                                 //If player is tabbing then play the stab sound

  351.                                 else if(iButton & IN_ATTACK2)

  352.                                 {

  353.                                         emit_sound(id,CHAN_WEAPON, g_NpcSoundKnifeStab, volume, attn, flag, pitch);

  354.                                 }

  355.  

  356.                                 //Reset our boolean as player is not hitting NPC anymore

  357.                                 g_Hit[id] = false;

  358.                                

  359.                                 //Block any further sounds to be played

  360.                                 return FMRES_SUPERCEDE

  361.                         }

  362.                 }

  363.         }

  364.        

  365.         return FMRES_IGNORED

  366. }

  367.  

  368. public Event_NewRound()

  369. {

  370.         new iEnt = -1;

  371.        

  372.         //Scan and find all of the NPC classnames

  373.         while( ( iEnt = find_ent_by_class(iEnt, g_NpcClassName) ) )

  374.         {

  375.                 //If we find a NPC which is dead...

  376.                 if(g_NpcDead[iEnt])

  377.                 {

  378.                         //Reset the solid box

  379.                         entity_set_int(iEnt, EV_INT_solid, SOLID_BBOX);

  380.                         //Make our NPC able to take damage again

  381.                         entity_set_float(iEnt, EV_FL_takedamage, 1.0);

  382.                         //Make our NPC instanstly think

  383.                         entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 0.01);

  384.                        

  385.                         //Reset the NPC boolean to false

  386.                         g_NpcDead[iEnt] = false;

  387.                 }      

  388.                

  389.                 //Reset the health of our NPC

  390.                 entity_set_float(iEnt, EV_FL_health, 250.0);

  391.         }

  392. }

  393.  

  394. Create_Npc(id, Float:flOrigin[3]= { 0.0, 0.0, 0.0 }, Float:flAngle[3]= { 0.0, 0.0, 0.0 } )

  395. {

  396.         //Create an entity using type 'info_target'

  397.         new iEnt = create_entity("info_target");

  398.        

  399.         //Set our entity to have a classname so we can filter it out later

  400.         entity_set_string(iEnt, EV_SZ_classname, g_NpcClassName);

  401.                

  402.         //If a player called this function

  403.         if(id)

  404.         {

  405.                 //Retrieve the player's origin

  406.                 entity_get_vector(id, EV_VEC_origin, flOrigin);

  407.                 //Set the origin of the NPC to the current players location

  408.                 entity_set_origin(iEnt, flOrigin);

  409.                 //Increase the Z-Axis by 80 and set our player to that location so they won't be stuck

  410.                 flOrigin[2] += 80.0;

  411.                 entity_set_origin(id, flOrigin);

  412.                

  413.                 //Retrieve the player's  angle

  414.                 entity_get_vector(id, EV_VEC_angles, flAngle);

  415.                 //Make sure the pitch is zeroed out

  416.                 flAngle[0] = 0.0;

  417.                 //Set our NPC angle based on the player's angle

  418.                 entity_set_vector(iEnt, EV_VEC_angles, flAngle);

  419.         }

  420.         //If we are reading from a file

  421.         else

  422.         {

  423.                 //Set the origin and angle based on the values of the parameters

  424.                 entity_set_origin(iEnt, flOrigin);

  425.                 entity_set_vector(iEnt, EV_VEC_angles, flAngle);

  426.         }

  427.  

  428.         //Set our NPC to take damange and how much health it has

  429.         entity_set_float(iEnt, EV_FL_takedamage, 1.0);

  430.         entity_set_float(iEnt, EV_FL_health, 250.0);

  431.  

  432.         //Set a model for our NPC

  433.         entity_set_model(iEnt, g_NpcModel);

  434.         //Set a movetype for our NPC

  435.         entity_set_int(iEnt, EV_INT_movetype, MOVETYPE_PUSHSTEP);

  436.         //Set a solid for our NPC

  437.         entity_set_int(iEnt, EV_INT_solid, SOLID_BBOX);

  438.        

  439.        

  440.         //Create a bounding box for oru NPC

  441.         new Float: mins[3] = {-12.0, -12.0, 0.0 }

  442.         new Float: maxs[3] = { 12.0, 12.0, 75.0 }

  443.  

  444.         entity_set_size(iEnt, mins, maxs);

  445.        

  446.         //Controllers for our NPC. First controller is head. Set it so it looks infront of itself

  447.         entity_set_byte(iEnt,EV_BYTE_controller1,125);

  448.         // entity_set_byte(ent,EV_BYTE_controller2,125);

  449.         // entity_set_byte(ent,EV_BYTE_controller3,125);

  450.         // entity_set_byte(ent,EV_BYTE_controller4,125);

  451.        

  452.         //Drop our NPC to the floor

  453.         drop_to_floor(iEnt);

  454.        

  455.         // set_rendering( ent, kRenderFxDistort, 0, 0, 0, kRenderTransAdd, 127 );

  456.        

  457.         //We just spawned our NPC so it should not be dead

  458.         g_NpcSpawn[iEnt] = true;

  459.         g_NpcDead[iEnt] = false;

  460.        

  461.         //Make it instantly think

  462.         entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 0.01)

  463. }

  464.  

  465. Load_Npc()

  466. {

  467.         //Get the correct filepath and mapname

  468.         new szConfigDir[256], szFile[256], szNpcDir[256];

  469.        

  470.         get_configsdir(szConfigDir, charsmax(szConfigDir));

  471.        

  472.         new szMapName[32];

  473.         get_mapname(szMapName, charsmax(szMapName));

  474.        

  475.         formatex(szNpcDir, charsmax(szNpcDir),"%s/NPC", szConfigDir);

  476.         formatex(szFile, charsmax(szFile),  "%s/%s.cfg", szNpcDir, szMapName);

  477.                

  478.         //If the filepath does not exist then we will make one

  479.         if(!dir_exists(szNpcDir))

  480.         {

  481.                 mkdir(szNpcDir);

  482.         }

  483.        

  484.         //If the map config file does not exist we will make one

  485.         if(!file_exists(szFile))

  486.         {

  487.                 write_file(szFile, "");

  488.         }

  489.        

  490.         //Variables to store when reading our file

  491.         new szFileOrigin[3][32]

  492.         new sOrigin[128], sAngle[128];

  493.         new Float:fOrigin[3], Float:fAngles[3];

  494.         new iLine, iLength, sBuffer[256];

  495.        

  496.         //When we are reading our file...

  497.         while(read_file(szFile, iLine++, sBuffer, charsmax(sBuffer), iLength))

  498.         {

  499.                 //Move to next line if the line is commented

  500.                 if((sBuffer[0]== ';') || !iLength)

  501.                         continue;

  502.                

  503.                 //Split our line so we have origin and angle. The split is the vertical bar character

  504.                 strtok(sBuffer, sOrigin, charsmax(sOrigin), sAngle, charsmax(sAngle), '|', 0);

  505.                                

  506.                 //Store the X, Y and Z axis to our variables made earlier

  507.                 parse(sOrigin, szFileOrigin[0], charsmax(szFileOrigin[]), szFileOrigin[1], charsmax(szFileOrigin[]), szFileOrigin[2], charsmax(szFileOrigin[]));

  508.                

  509.                 fOrigin[0] = str_to_float(szFileOrigin[0]);

  510.                 fOrigin[1] = str_to_float(szFileOrigin[1]);

  511.                 fOrigin[2] = str_to_float(szFileOrigin[2]);

  512.                                

  513.                 //Store the yawn angle

  514.                 fAngles[1] = str_to_float(sAngle[1]);

  515.                

  516.                 //Create our NPC

  517.                 Create_Npc(0, fOrigin, fAngles)

  518.                

  519.                 //Keep reading the file until the end

  520.         }

  521. }

  522.  

  523. Save_Npc()

  524. {

  525.         //Variables

  526.         new szConfigsDir[256], szFile[256], szNpcDir[256];

  527.        

  528.         //Get the configs directory.

  529.         get_configsdir(szConfigsDir, charsmax(szConfigsDir));

  530.        

  531.         //Get the current map name

  532.         new szMapName[32];

  533.         get_mapname(szMapName, charsmax(szMapName));

  534.        

  535.         //Format 'szNpcDir' to ../configs/NPC

  536.         formatex(szNpcDir, charsmax(szNpcDir),"%s/NPC", szConfigsDir);

  537.         //Format 'szFile to ../configs/NPC/mapname.cfg

  538.         formatex(szFile, charsmax(szFile), "%s/%s.cfg", szNpcDir, szMapName);

  539.                

  540.         //If there is already a .cfg for the current map. Delete it

  541.         if(file_exists(szFile))

  542.                 delete_file(szFile);

  543.        

  544.         //Variables

  545.         new iEnt = -1, Float:fEntOrigin[3], Float:fEntAngles[3];

  546.         new sBuffer[256];

  547.        

  548.         //Scan and find all of my custom ents

  549.         while( ( iEnt = find_ent_by_class(iEnt, g_NpcClassName) ) )

  550.         {

  551.                 //Get the entities' origin and angle

  552.                 entity_get_vector(iEnt, EV_VEC_origin, fEntOrigin);

  553.                 entity_get_vector(iEnt, EV_VEC_angles, fEntAngles);

  554.                

  555.                 //Format the line of one custom ent.

  556.                 formatex(sBuffer, charsmax(sBuffer), "%d %d %d | %d", floatround(fEntOrigin[0]), floatround(fEntOrigin[1]), floatround(fEntOrigin[2]), floatround(fEntAngles[1]));

  557.                

  558.                 //Finally write to the mapname.cfg file and move on to the next line

  559.                 write_file(szFile, sBuffer, -1);

  560.                

  561.                 //We are currentlying looping to find all custom ents on the map. If found another ent. Do the above till there is none.

  562.         }

  563.        

  564. }

  565.  

  566. stock Util_PlayAnimation(index, sequence, Float: framerate = 1.0)

  567. {

  568.         entity_set_float(index, EV_FL_animtime, get_gametime());

  569.         entity_set_float(index, EV_FL_framerate,  framerate);

  570.         entity_set_float(index, EV_FL_frame, 0.0);

  571.         entity_set_int(index, EV_INT_sequence, sequence);

  572. }

  573.  

_________________
Idk. Csak ugy funbooo.
Kép


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  [2 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 28 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