AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Help] How to make *.ini on plugins. (https://forums.alliedmods.net/showthread.php?t=85535)

ilham92-cc-sakura 02-12-2009 07:18

[Help] How to make *.ini on plugins.
 
I wan to upgrade it. make *.ini for sound path file
This plugins get unapproved

thanks for helping me.

PHP Code:

/*
    English help by: [ANiME|ADMiN][5hp-Evolution]
    Created by: [ANiME|ADMiN][Ilham Sakura] aka ilham92-cc-sakura
    Scripting Help: SnoW (Damage Event)
    Scripting Help: Tuty (Stock)
*/
#include <amxmodx>
#include <fakemeta>
#include <csx>

#define SND1 "player/player_listen.wav"
#define SND2 "player/breathe1noloop.wav"
#define fm_create_entity(%1) engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, %1))

new amx_pcvar_0;

public 
plugin_init()
{
    
register_plugin("HE Player Damage Snd""1.0","ilham92-cc-sakura");
    
amx_pcvar_0 register_cvar("he_hit_respawn","1");
}
public 
plugin_precache()
{
    
precache_sound(SND1);
    
precache_sound(SND2);
}
public 
client_damage(attacker,victim,damage,wpnindex,hitplace,TA)
{
    if(
get_pcvar_num(amx_pcvar_0) != && wpnindex != CSW_HEGRENADE)
        return 
PLUGIN_HANDLED;
    
    new 
sound1[129];
    
copy(sound1,128,SND1);

    if(
contain(sound1,".wav"))
    {
        
replace(sound1,128,".wav","");
        
client_cmd(victim"spk %s",sound1);
    }

    new 
sound2[131];
    
copy(sound2,130,SND2);

    if(
contain(sound2,".wav"))
    {
        
replace(sound1,130,".wav","");
        
client_cmd(victim"spk %s",sound2);
    }

    new 
pl_name[32];
    
get_user_name(victim,pl_name31);
    
    
client_cmd(victim"say ^"Damn itHE Grenade Hit Me!^"");
    
client_print(0print_chat"[Grenade]: At who trow grenade. %s! it is time for a payback",pl_name);
    
    if(
get_user_team(victim) == 1)
    {
        
fm_give_item(victim"weapon_knife");
        
fm_give_item(victim"weapon_mp5navy");
        
fm_give_item(victim"item_kevlar");
        
fm_give_item(victim"ammo_9mm");
        
fm_give_item(victim"ammo_9mm");
        
fm_give_item(victim"ammo_9mm");
        
fm_give_item(victim"ammo_9mm");
    }
    if(!
is_user_alive(victim))
    {
        
set_task(0.6,"respawnagain",victim);
        
client_print(0print_chat"[Grenade]: HE kill %s and respwan.",pl_name);
        
client_cmd(victim"say ^"I will get you for my revenge!^"");
    }
    return 
PLUGIN_CONTINUE;
}
public 
respawnagain(victim)
{
    
fm_cs_user_spawn(victim);
}
stock fm_cs_user_spawn(index)
{
    
set_pev(indexpev_deadflagDEAD_RESPAWNABLE);
    
dllfunc(DLLFunc_Spawnindex);
    
set_pev(indexpev_iuser10);

    return 
1;
}
stock fm_give_item(index, const item[])
{
    if (!
equal(item"weapon_"7) && !equal(item"ammo_"5) && !equal(item"item_"5) && !equal(item"tf_weapon_"10))
        return 
0;

    new 
ent fm_create_entity(item);

    if (!
pev_valid(ent))
        return 
0;

    new 
Float:origin[3];
    
pev(indexpev_originorigin);
    
set_pev(entpev_originorigin);
    
set_pev(entpev_spawnflagspev(entpev_spawnflags) | SF_NORESPAWN);
    
dllfunc(DLLFunc_Spawnent);

    new 
save pev(entpev_solid);
    
dllfunc(DLLFunc_Touchentindex);

    if (
pev(entpev_solid) != save)
        return 
ent;

    
engfunc(EngFunc_RemoveEntityent);
    return -
1;



Dr.G 02-12-2009 09:04

Re: How to make *.ini on plugins.
 
i would look how its done in the sank sounds plugin if i were you...

ilham92-cc-sakura 02-12-2009 09:11

Re: How to make *.ini on plugins.
 
ok... is ok... working... no error found...

YamiKaitou 02-12-2009 09:48

Re: How to make *.ini on plugins.
 
Quote:

Originally Posted by ilham92-cc-sakura (Post 760329)
I wan to upgrade it. make *.ini for sound path file

Bad idea. Just use a define for the sound path. Unless you are going to use the ini file for other stuff, I wouldn't recommend using it.

ilham92-cc-sakura 02-12-2009 10:46

Re: How to make *.ini on plugins.
 
i know... i have try many times to change. i have use some one code, but can't load/play

i need help. change code to able use *.ini files
thx

fysiks 02-12-2009 15:28

Re: How to make *.ini on plugins.
 
Maybe use a cvar for the sound file path string?

ilham92-cc-sakura 02-14-2009 11:28

Re: How to make *.ini on plugins.
 
Quote:

Originally Posted by fysiks (Post 760576)
Maybe use a cvar for the sound file path string?

How? i noob to script. show example...

ilham92-cc-sakura 02-18-2009 02:14

Re: How to make *.ini on plugins.
 
I still don't know to make *.ini file on plugins.
I need your help. i have try many times. still not work

PHP Code:

new amx_pcvar_0;

public 
plugin_init()
{
    
register_plugin("HE Player Damage Snd""1.0","ilham92-cc-sakura");
    
amx_pcvar_0 register_cvar("he_hit_respawn","1");
}
public 
plugin_precache ()
{
g_snd01 ArrayCreateMAX_FILE_LENGTH );
g_snd02 ArrayCreateMAX_FILE_LENGTH );
loading_file();
}
public 
client_damage(attacker,victim,damage,wpnindex,hitplace,TA)
{
    if(
get_pcvar_num(amx_pcvar_0) != && wpnindex != CSW_HEGRENADE)
        return 
PLUGIN_HANDLED;
    
    new 
sound1[129];
    
copy(sound1,128,SND1);

    if(
contain(sound1,".wav"))
    {
        
replace(sound1,128,".wav","");
        
client_cmd(victim"spk %s",sound1);
    }

    new 
sound2[131];
    
copy(sound2,130,SND2);

    if(
contain(sound2,".wav"))
    {
        
replace(sound1,130,".wav","");
        
client_cmd(victim"spk %s",sound2);
    } 

help...

ilham92-cc-sakura 02-18-2009 09:50

Re: [Help] How to make *.ini on plugins.
 
I find this script on round sound...

PHP Code:

public plugin_precache()
{
#if !defined old_amxx
g_lstSoundCT ArrayCreateMAX_FILE_LENGTH );
g_lstSoundT  ArrayCreateMAX_FILE_LENGTH );
#endif

loading_file();


this work on my plugins? or need some to modified?

YamiKaitou 02-18-2009 11:20

Re: How to make *.ini on plugins.
 
Quote:

Originally Posted by YamiKaitou (Post 760392)
Bad idea. Just use a define for the sound path. Unless you are going to use the ini file for other stuff, I wouldn't recommend using it.


Also, don't double post. If you really need this, I suggest searching. There are other plugins out there that do this already, one example is CSDM, but I am not sure how it does it as I have never needed it.


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

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