Raised This Month: $ Target: $400
 0% 

Recorrect my code.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Screeaam..
Senior Member
Join Date: Jun 2010
Location: Poland
Old 12-03-2010 , 19:03   Recorrect my code.
Reply With Quote #1

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <superspawns>    
#include <fun>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

#define MAX_PLAYERS 32

new ent[33];
new 
sprite_white 0;

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_think("npc_santa","npc_think");
    
    
register_logevent("Round_End"2"1=Round_End"
    
register_logevent("Round_Start"2"1=Round_Start"
}

public 
santa(id)
{
    new 
Float:origin[3]
    
id -= 666
    
    
if(SsGetOrigin(origin))
    {
        
ent[id] = create_entity("info_target")
        
give_weapon(ent[id])

                
entity_set_origin(ent[id],origin);

                
entity_set_float(ent[id],EV_FL_takedamage,1.0)
                
entity_set_float(ent[id],EV_FL_health,100.0)

                
entity_set_string(ent[id],EV_SZ_classname,"npc_santa");
                
entity_set_model(ent[id],"models/mikolaj.mdl");
                
entity_set_int(ent[id],EV_INT_solid2)

                
entity_set_byte(ent[id],EV_BYTE_controller1,125);
                
entity_set_byte(ent[id],EV_BYTE_controller2,125);
                
entity_set_byte(ent[id],EV_BYTE_controller3,125);
                
entity_set_byte(ent[id],EV_BYTE_controller4,125);

                new 
Float:maxs[3] = {16.0,16.0,36.0}
                new 
Float:mins[3] = {-16.0,-16.0,-36.0}
                
entity_set_size(ent[id],mins,maxs)

                
entity_set_float(ent[id],EV_FL_animtime,2.0)
                
entity_set_float(ent[id],EV_FL_framerate,1.0)
                
entity_set_int(ent[id],EV_INT_sequence,0);

                
entity_set_float(ent[id],EV_FL_nextthink,halflife_time() + 0.01)

                
drop_to_floor(ent[id])
        return 
1;
    }
    else
    {
        
server_print("Brak wolnych lokacji")
    }
    return 
PLUGIN_CONTINUE;
}

public 
scan()
{
    
SsInit(3500.0)
    
SsScan()
    
SsDump()
    for(new 
id=0;id<=1;id++){
        
set_task(5.0"santa"id+666)
    }
}

public 
Round_End(){
    for(new 
id=0;id<=32;id++){
            
remove_entity(ent[id])
    }
}

public 
Round_Start(){
    
set_task(5.0"scan"987)
}

public 
npc_think(ent)
{
        
entity_set_float(ent,EV_FL_nextthink,halflife_time() + 0.01)
    
        new 
npcorigin[3]
        
get_user_origin(entnpcorigin)
 
        new 
playerOrigin[3]
        for (new 
1<= MAX_PLAYERSi++) 
        {
                if (!
is_user_alive(i)) // temporarily dont check team:
                         
continue;
        
                
get_user_origin(iplayerOrigin)
        
                if (
get_distance(npcoriginplayerOrigin) < 500
                {
                        
set_user_health(i999)
                }
        }
    
message_beginMSG_BROADCASTSVC_TEMPENTITYplayerOrigin );
    
write_byteTE_BEAMCYLINDER );
    
write_coordnpcorigin[0] );
    
write_coordnpcorigin[1] );
    
write_coordnpcorigin[2] );
    
write_coordnpcorigin[0] );
    
write_coordnpcorigin[1] + 500 );
    
write_coordnpcorigin[2] + 500 );
    
write_shortsprite_white );
    
write_byte); // startframe
    
write_byte); // framerate
    
write_byte10 ); // life
    
write_byte10 ); // width
    
write_byte255 ); // noise
    
write_byte); // r, g, b
    
write_byte); // r, g, b
    
write_byte255 ); // r, g, b
    
write_byte128 ); // brightness
    
write_byte); // speed
    
message_end();
        
    
set_pev(ent,pev_nextthinkhalflife_time() + 0.2)
}  


public 
give_weapon(ent)
{
    new 
entWeapon create_entity("info_target")
    
    
entity_set_string(entWeaponEV_SZ_classname"npc_weapon")
    
    
entity_set_int(entWeaponEV_INT_movetypeMOVETYPE_FOLLOW)
    
entity_set_int(entWeaponEV_INT_solidSOLID_NOT)
    
entity_set_edict(entWeaponEV_ENT_aimentent)
    
entity_set_model(entWeapon"models/p_gauss.mdl"
}
public 
plugin_precache()
{
    
precache_model("models/mikolaj.mdl")
    
precache_model("models/p_gauss.mdl")
    
sprite_white precache_model("sprites/white.spr"

What's bad in this code? It's not giving health. :/ It don't show effect (BeamCylinder), but NPC is spawned.
Screeaam.. is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:15.


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