Raised This Month: $ Target: $400
 0% 

"Failed to auto generate config"


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
LithuanianJack
Senior Member
Join Date: Nov 2013
Location: Vilnius, Lithuania
Old 03-22-2019 , 03:29   "Failed to auto generate config"
Reply With Quote #1

Hello. Plugin can't create auto config, but "configs" directory has all permissions (777). What I have to do?

PHP Code:
L 03/22/2019 01:34:32Failed to auto generate config for DeathGift.amxxmake sure the directory has write permission
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta>
#include <engine>
#include <awDeathGift>

#if !defined client_print_color
    #include <colorchat>
#endif

#define PDATA_SAFE 2

new const MODEL_PATH[] = "models/awDeathGift/gift.mdl";
new const 
TAKE_SOUND[] = "awDeathGift/take.wav";
#define SOUND_VOL 0.8
new const CHAT_PREFIX[] = "DeathGift";
#define FLY_SPEED 5.0
#define ROTATE_SPEED 5.0
#define THINK_DELAY 1.0

enum fwds{
    
fTouchPre,
    
fTouchPost,
    
fCreatePre,
    
fCreatePost
}

enum cvars{
    
cDropRarity,
    
cLifeTime,
    
cMoneyMin,
    
cMoneyMax
}

enum minMax{
    
mMin,
    
mMax
}

new const 
Float:fMaxs[3] = {10.010.030.0};
new const 
Float:fMins[3] = {-1.0, -10.0, -30.0};

new 
pFwds[fwds];

new 
Float:dropRarity;
new 
giftLifeTime;
new 
giftMoney[minMax];

new const 
PLUG_VER[] = "1.2.1";
new const 
PLUG_NAME[] = "DeathGift";

public 
plugin_init(){
    
register_dictionary("awDeathGift.txt");
    
cfgExec();
    
RegisterHam(Ham_Killed"player""pDeath"false);
    
register_think("gift""giftThink");
    
register_touch("gift""player""giftTouch");
    
pFwds[fTouchPre] = CreateMultiForward("awDgFwdTouchPre"ET_CONTINUEFP_CELLFP_CELL);
    
pFwds[fTouchPost] = CreateMultiForward("awDgFwdTouchPost"ET_CONTINUEFP_CELLFP_CELL);
    
pFwds[fCreatePre] = CreateMultiForward("awDgFwdCreatePre"ET_CONTINUE);
    
pFwds[fCreatePost] = CreateMultiForward("awDgFwdCreatePost"ET_CONTINUEFP_CELL);
    
server_print("[%s v%s] loaded."PLUG_NAMEPLUG_VER);
}

cfgExec(){
    new 
pCvars[cvars], cvarDesc[128];
    
formatex(cvarDesccharsmax(cvarDesc), "%L"LANG_SERVER"CVAR_DROP_RARITY");
    
pCvars[cDropRarity] = create_cvar("awDgDropRarity""0.1"FCVAR_NONEcvarDesc);
    
formatex(cvarDesccharsmax(cvarDesc), "%L"LANG_SERVER"CVAR_LIFE_TIME");
    
pCvars[cLifeTime] = create_cvar("awDgLifeTime""15"FCVAR_NONEcvarDesc);
    
formatex(cvarDesccharsmax(cvarDesc), "%L"LANG_SERVER"CVAR_MONEY_MIN");
    
pCvars[cMoneyMin] = create_cvar("awDgMoneyMin""500"FCVAR_NONEcvarDesc);
    
formatex(cvarDesccharsmax(cvarDesc), "%L"LANG_SERVER"CVAR_MONEY_MAX");
    
pCvars[cMoneyMax] = create_cvar("awDgMoneyMax""5000"FCVAR_NONEcvarDesc);
    
    
bind_pcvar_float(pCvars[cDropRarity], dropRarity);
    
bind_pcvar_num(pCvars[cLifeTime], giftLifeTime);
    
bind_pcvar_num(pCvars[cMoneyMin], giftMoney[mMin]);
    
bind_pcvar_num(pCvars[cMoneyMax], giftMoney[mMax]);
    
    
AutoExecConfig(true"Main""DeathGift");
}

public 
plugin_natives(){
    
register_native("awDgSendGiftMsg""_awDgSendGiftMsg");
}

public 
plugin_precache(){
    
register_plugin(PLUG_NAMEPLUG_VER"ArKaNeMaN");
    
    if(
file_exists(MODEL_PATH)) precache_model(MODEL_PATH);
    else{
        
server_print("[%s v%s] [Error] [Model file not found (%s)] [Plugin stopped]"PLUG_NAMEPLUG_VERMODEL_PATH);
        
set_fail_state("[Model file not found (%s)]"MODEL_PATH);
    }
    
    static 
sndFullPath[PLATFORM_MAX_PATH]; formatex(sndFullPathcharsmax(sndFullPath), "sound/%s"TAKE_SOUND);
    if(
file_exists(sndFullPath)) precache_sound(TAKE_SOUND);
    else{
        
server_print("[%s v%s] [Error] [Take sound file not found (%s)] [Plugin stopped]"PLUG_NAMEPLUG_VERTAKE_SOUND);
        
set_fail_state("[Take sound file not found (%s)]"TAKE_SOUND);
    }
}

public 
giftTouch(entid){
    
emit_sound(entCHAN_VOICETAKE_SOUNDSOUND_VOLATTN_NORM0PITCH_NORM);
    
giftDelete(ent);
    
//server_print("[%s v%s] [Debug] [giftTouch] [%n]", PLUG_NAME, PLUG_VER, id);
    
static retExecuteForward(pFwds[fTouchPre], retident);
    if(
ret == AW_DG_CONT){
        
//server_print("[%s v%s] [Debug] [giftTouch] [%n] [Fwd]", PLUG_NAME, PLUG_VER, id);
        
static newMoneynewMoney random_num(giftMoney[mMin], giftMoney[mMax]);
        
cs_set_user_money(idcs_get_user_money(id)+newMoney);
        
client_print_color(idprint_team_default"^4[^3%s^4] ^3%L ^4%d$^3."CHAT_PREFIXLANG_PLAYER"GIFT_TAKE"newMoney);
        
ExecuteForward(pFwds[fTouchPost], retident);
    }
}

public 
pDeath(victimattackercorpse){
    
//server_print("[%s v%s] [Debug] [pDeath] [%n]", PLUG_NAME, PLUG_VER, victim);
    
if(dropRandom()){
        
//server_print("[%s v%s] [Debug] [pDeath] [%n] [Drop]", PLUG_NAME, PLUG_VER, victim);
        
giftCreate(victim);
    }
}

public 
giftDelete(ent){
    
//server_print("[%s v%s] [Debug] [giftDelete]", PLUG_NAME, PLUG_VER);
    
if(giftLifeTime && task_exists(ent)) remove_task(ent);
    if(
entremove_entity(ent);
}

public 
giftCreate(id){
    
//server_print("[%s v%s] [Debug] [giftCreate] [%n]", PLUG_NAME, PLUG_VER, id);
    
static retExecuteForward(pFwds[fCreatePre], ret);
    if(
ret == AW_DG_CONT){
        
//server_print("[%s v%s] [Debug] [giftCreate] [%n] [Fwd]", PLUG_NAME, PLUG_VER, id);
        
static a;
        if(!
aengfunc(EngFunc_AllocString"info_target");
        static 
entent engfunc(EngFunc_CreateNamedEntitya);
        if(
pev_valid(ent)){
            
//server_print("[%s v%s] [Debug] [giftCreate] [%n] [Fwd] [Create] [%d]", PLUG_NAME, PLUG_VER, id, ent);
            
set_pev(entpev_classname"gift");
            
            static 
Float:f[3]; pev(idpev_originf); f[2] -= 30.0;
            
set_pev(entpev_originf);
            
            
engfunc(EngFunc_SetModelentMODEL_PATH);
            
            
dllfunc(DLLFunc_Spawn,ent);
            
            
set_pev(entpev_nextthinkget_gametime()+THINK_DELAY);
            
            
set_pev(entpev_movetypeMOVETYPE_NOCLIP);
            
            static 
Float:vecAvelocity[3]; vecAvelocity[1] = ROTATE_SPEED 10.0;
            
set_pev(entpev_avelocityvecAvelocity);
            
            static 
Float:vecVelocity[3]; vecVelocity[2] = FLY_SPEED;

            
set_pev(entpev_velocityvecVelocity);
            
set_pev(entpev_maxspeedFLY_SPEED);
            
            
set_pev(entpev_solidSOLID_TRIGGER);
            
engfunc(EngFunc_SetSizeentfMinsfMaxs);
            
            if(
giftLifeTimeset_task(float(giftLifeTime), "giftDelete"ent);
            
            
ExecuteForward(pFwds[fCreatePost], retent);
            
//server_print("[%s v%s] [Debug] [giftCreate] [%n] [Fwd] [Created] [%d]", PLUG_NAME, PLUG_VER, id, ent);
        
}
    }
}

public 
giftThink(ent){
    if(
pev_valid(ent) != PDATA_SAFE) return;
    
    
set_pev(entpev_nextthinkget_gametime()+THINK_DELAY);
    
    static 
Float:vecVelocity[3], Float:fFlyUp;
    
pev(entpev_maxspeedfFlyUp);
    
vecVelocity[2] = fFlyUp;

    
set_pev(entpev_velocityvecVelocity);
    
set_pev(entpev_maxspeed, -fFlyUp);
    
    
//server_print("[%s v%s] [Debug] [giftThink] [%d]", PLUG_NAME, PLUG_VER, ent);
    
    
return;
}

bool:dropRandom(){
    
//server_print("[%s v%s] [Debug] [dropRandom]", PLUG_NAME, PLUG_VER);
    
if(random_num(1floatround(1.0/dropRarity)) == 1) return true;
    return 
false;
}

public 
_awDgSendGiftMsg(pluginIdparams){
    static 
idid get_param(1);
    static 
str[64]; get_string(2strcharsmax(str));
    if(
equal(str"")) client_print_color(idprint_team_default"^4[^3%s^4] ^3%L."CHAT_PREFIXLANG_PLAYER"GIFT_TAKE_EMPTY");
    else 
client_print_color(idprint_team_default"^4[^3%s^4] ^3%L ^4%s^3."CHAT_PREFIXLANG_PLAYER"GIFT_TAKE"str);

Attached Files
File Type: sma Get Plugin or Get Source (DeathGift.sma - 475 views - 6.6 KB)
LithuanianJack 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 22:12.


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