AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Poss. change to fake? (https://forums.alliedmods.net/showthread.php?t=88462)

One 03-25-2009 06:14

Poss. change to fake?
 
i need the CustomFlashlight plugin in fakemeta. is this possible ?

PHP Code:

 #include <amxmodx>
 #include <engine>

 #define TASK_CHARGE 100

 
new flashlight[33];
 new 
flashbattery[33] = { 100, ... };

 public 
plugin_init() {
    
register_plugin("CustomFlashlight","0.11","Avalanche");
    
register_event("Flashlight","event_flashlight","b");
    
register_cvar("flashlight_custom","1");
    
register_cvar("flashlight_r","100");
    
register_cvar("flashlight_g","100");
    
register_cvar("flashlight_b","100");
    
register_cvar("flashlight_drain","1.0");
    
register_cvar("flashlight_charge","0.5");
    
register_cvar("flashlight_radius","9");
    
register_cvar("flashlight_decay","60");
    
register_event("DeathMsg","event_deathmsg","a");
 }

 public 
client_putinserver(id) {
    
flashbattery[id] = 100;
 }

 public 
client_disconnect(id) {
    
remove_task(TASK_CHARGE+id);
 }

 public 
event_deathmsg() {
    new 
victim read_data(2);
    
flashbattery[victim] = 100;
    
flashlight[victim] = 0;
 }

 public 
event_flashlight(id) {
    if(!
get_cvar_num("flashlight_custom")) {
        return;
    }

    if(
flashlight[id]) {
        
flashlight[id] = 0;
    }
    else {
        if(
flashbattery[id] > 0) {
            
flashlight[id] = 1;
        }
    }

    if(!
task_exists(TASK_CHARGE+id)) {
        new 
parms[1];
        
parms[0] = id;
        
set_task((flashlight[id]) ? get_cvar_float("flashlight_drain") : get_cvar_float("flashlight_charge"),"charge",TASK_CHARGE+id,parms,1);
    }

    
message_begin(MSG_ONE,get_user_msgid("Flashlight"),{0,0,0},id);
    
write_byte(flashlight[id]);
    
write_byte(flashbattery[id]);
    
message_end();

    
entity_set_int(id,EV_INT_effects,entity_get_int(id,EV_INT_effects) & ~EF_DIMLIGHT);
 }

 public 
charge(parms[]) {
    if(!
get_cvar_num("flashlight_custom")) {
        return;
    }

    new 
id parms[0];

    if(
flashlight[id]) {
        
flashbattery[id] -= 1;
    }
    else {
        
flashbattery[id] += 1;
    }

    
message_begin(MSG_ONE,get_user_msgid("FlashBat"),{0,0,0},id);
    
write_byte(flashbattery[id]);
    
message_end();

    if(
flashbattery[id] <= 0) {
        
flashbattery[id] = 0;
        
flashlight[id] = 0;

        
message_begin(MSG_ONE,get_user_msgid("Flashlight"),{0,0,0},id);
        
write_byte(flashlight[id]);
        
write_byte(flashbattery[id]);
        
message_end();

        
// don't return so we can charge it back up to full
    
}
    else if(
flashbattery[id] >= 100) {
        
flashbattery[id] = 100;
        return; 
// return because we don't need to charge anymore
    
}

    
set_task((flashlight[id]) ? get_cvar_float("flashlight_drain") : get_cvar_float("flashlight_charge"),"charge",TASK_CHARGE+id,parms,1);
 }

 public 
client_PreThink(id) {
    if(!
get_cvar_num("flashlight_custom")) {
        return;
    }

    if(
flashlight[id] && flashbattery[id]) {
        new 
origin[3];
        
get_user_origin(id,origin,3);
        
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
        
write_byte(27); // TE_DLIGHT
        
write_coord(origin[0]); // X
        
write_coord(origin[1]); // Y
        
write_coord(origin[2]); // Z
        
write_byte(get_cvar_num("flashlight_radius")); // radius
        
write_byte(get_cvar_num("flashlight_r")); // R
        
write_byte(get_cvar_num("flashlight_g")); // G
        
write_byte(get_cvar_num("flashlight_b")); // B
        
write_byte(1); // life
        
write_byte(get_cvar_num("flashlight_decay")); // decay rate
        
message_end();
    }
 } 


Arkshine 03-25-2009 07:01

Re: Poss. change to fake?
 
Use this plugin : http://forums.alliedmods.net/showthread.php?p=633031

One 03-25-2009 08:16

Re: Poss. change to fake?
 
TY, but XS???? :-( dont wanna use :cry: & a new file? i mean ma plugin use already 2 cfg files. idk how can i add the colors file in ma cfgs :(

Arkshine 03-25-2009 10:39

Re: Poss. change to fake?
 
What are you talking about ? XS is just useful stocks. See by yourself. It's not a module.

One 03-25-2009 11:05

Re: Poss. change to fake?
 
Quote:

Originally Posted by arkshine (Post 788726)
What are you talking about ? XS is just useful stocks. See by yourself. It's not a module.

ma bad.what can i do for the colors.ini?

Arkshine 03-25-2009 11:08

Re: Poss. change to fake?
 
I don't understand what you want.

One 03-25-2009 11:22

Re: Poss. change to fake?
 
Quote:

Originally Posted by arkshine (Post 788743)
I don't understand what you want.

idont wanna use the colors.ini !! in ma plugin i have already 2 config files. dont like to release ma plugin with 3 config files.

Arkshine 03-25-2009 11:36

Re: Poss. change to fake?
 
Whoa. Use your brain. :down:

flashlight_colors.ini is used only to get random color ; if you don't want this feature, don't use it...

xPaw 03-25-2009 11:49

Re: Poss. change to fake?
 
Quote:

dont like to release ma plugin with 3 config files.
if you have just a bit brain, you can do all settings in one config file.

One 03-25-2009 12:20

Re: Poss. change to fake?
 
EDIT: 4get it :)


All times are GMT -4. The time now is 08:59.

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