AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   explotion dont works ( dont appear) (https://forums.alliedmods.net/showthread.php?t=243225)

Porta0123 07-01-2014 12:06

explotion dont works ( dont appear)
 
hi, i was making one class for my server but when i go to test it, the cass appear but the weapons explotion no :/

code:
Code:
#include <amxmodx> #include <amxmisc> #include <hamsandwich> #include <engine> #include <fakemeta> #include <CodMod> #include <sockets> #include <CStrike> #include <ColorChat> #include <fun> #define VERSION "1.0" #define AUTHOR "Porta0123" new const nazwaH[] = "Balas explosiva[PREMIUM]"; //nombre new const opisH[] = "Tus balas explotan(1/5)"; //descripcción new const bronieH = 1<<CSW_M4A1 new const zdrowieH = 20; //vida new const kondycjaH = 10; //condición new const inteligencjaH = 10; //inteligencia new const wytrzymaloscH = 10; //fuerza new sprite_explode new bool:ma_explosive[33] = false public plugin_precache() {     sprite_explode = precache_model("sprites/zerogxplode.spr") } public plugin_init() {     register_plugin(nazwaH, VERSION, AUTHOR)     cod_register_class(nazwaH, opisH, bronieH, zdrowieH, kondycjaH, inteligencjaH, wytrzymaloscH)     RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_m4a1", "fw_primer_atake", 1) } public cod_class_enabled(id) {     if(get_user_flags(id) & ADMIN_LEVEL_H)     {         ma_explosive[id] = true         client_print_color(id, BLUE, "%s by Porta0123",nazwaH)     }     else     {         ma_explosive[id] = false         client_print_color(id,RED, "no puedes usar esta clase")     } }  public fw_primer_atake(atack)   {         if(is_user_connected(atack) && ma_explosive[atack] == true)     {                       new origin_nuevo[3]         get_user_origin(atack, origin_nuevo, 3)                                   message_begin(MSG_BROADCAST, SVC_TEMPENTITY, origin_nuevo)         write_byte(TE_EXPLOSION)                     write_coord(origin_nuevo [0])         write_coord(origin_nuevo [1])         write_coord(origin_nuevo [2])         write_short(sprite_explode)                   write_byte(90)                     write_byte(0)                     write_byte(0)         message_end()         }   }

i search in my server /logs/ but i cant found it and in server console too...

Porta0123 07-01-2014 14:59

Re: explotion dont works ( dont appear)
 
fixed :)

the solution if you have the same problem :)

Code:
new id = pev(atack, pev_owner)

and then
Code:
    if(is_user_connected(id) && ma_explosive[id] == true)     {                       new origin_nuevo[3]         get_user_origin(id, origin_nuevo, 3)                                   message_begin(MSG_BROADCAST, SVC_TEMPENTITY, origin_nuevo)         write_byte(TE_EXPLOSION)                     write_coord(origin_nuevo [0])         write_coord(origin_nuevo [1])         write_coord(origin_nuevo [2])         write_short(sprite_explode)                   write_byte(90)                     write_byte(0)                     write_byte(0)         message_end()         }   }

meTaLiCroSS 07-02-2014 02:42

Re: explotion dont works ( dont appear)
 
The first param on any Ham forward will be the entity that you passed at the 2nd argument on the callback declaration

PHP Code:

RegisterHam(Ham_Weapon_PrimaryAttack"weapon_m4a1""fw_primer_atake"1

In this case it would be a "weapon_m4a1" entity (CM4A1 Class). This at the most times would be player, but not all.


All times are GMT -4. The time now is 21:10.

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