Raised This Month: $399 Target: $400
 99%   Almost there!

Request fix plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Alexande
Member
Join Date: Feb 2020
Old 02-15-2020 , 15:49   Request fix plugin
Reply With Quote #1

Hi guys , can you fix this plugin please
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <fun>
#include <cstrike>
#include <hamsandwich>

#define PLUGIN "VIP Benefits"
#define VERSION "0.8"

enum eData {
    
Name[32],
    
Flags,
    
SpawnHP,
    
SpawnAP,
    
MoneyKill,
    
HpKill
    
ApKill,
    
Jumps
}

new 
g_iJumpsNum[33], g_iMaxJumps[33];
new 
bool:g_bIsJumping[33];

new 
bool:g_bHaveBenefits[33];
new 
g_iBenefitsNum 0;
new Array:
g_aBenefits;
public 
plugin_init()
{
    
register_plugin(PLUGINVERSION"FaTzZu" );
    
    
g_aBenefits ArrayCreate(eData);
    
    
RegisterHam(Ham_Spawn"player""HamPlayerSpawn"1);
    
RegisterHam(Ham_Player_Jump"player""hamPlayerJump"0)
    
    
register_event("DeathMsg""evDeathMsg""a");
    
    
register_clcmd("say /vips""cmdShowBenefits");
    
register_clcmd("say /beneficii""cmdShowRankBenefits");
}
/* Plugin cfg */
public plugin_cfg()
{
    new 
szLineData[128], szName[32], szFlags[32], szSpawnHP[8], szSpawnAP[8], szMoneyPerKill[8], szHpPerKill[8], szApPerKill[8], szJumpsNum[8];
    new 
aData[eData]
    new 
szConfigsDir[128];
    
get_configsdir(szConfigsDircharsmax(szConfigsDir));
    
add(szConfigsDircharsmax(szConfigsDir), "/benefits.ini");
    
    if(!
file_exists(szConfigsDir))
    {
        
write_file(szConfigsDir";Numele flagului        Flagul            HP Spawn    AP Spawn    Money per kill        HP per Kill    Armor per Kill        Numar sarituri (1 = No multijump)");
        
write_file(szConfigsDir";Exemplu:");
        
write_file(szConfigsDir";^"VIP Diamond^"        ^"bcdefghijkt^"        ^"125^"        ^"150^"        ^"2000^"        ^"25^"        ^"50^"            ^"2^"");
    }
    
    new 
fopen(szConfigsDir"rt");
    if(!
f)
        return;
    
    while(!
feof(f))
    {
        
fgets(fszLineDatacharsmax(szLineData));
        
        if(
szLineData[0] == ';' || !szLineData[0]) 
            continue;
        
        
parse(szLineDataszNamecharsmax(szName), szFlagscharsmax(szFlags), szSpawnHPcharsmax(szSpawnHP), szSpawnAPcharsmax(szSpawnAP), szMoneyPerKillcharsmax(szMoneyPerKill), szHpPerKillcharsmax(szHpPerKill), szApPerKillcharsmax(szApPerKill), szJumpsNumcharsmax(szJumpsNum));
        
        
copy(aData[Name], charsmax(aData[Name]), szName);
        
aData[Flags] = read_flags(szFlags);
        
aData[SpawnHP] = str_to_num(szSpawnHP);
        
aData[SpawnAP] = str_to_num(szSpawnAP);
        
aData[MoneyKill] = str_to_num(szMoneyPerKill);
        
aData[HpKill] = str_to_num(szHpPerKill);
        
aData[ApKill] = str_to_num(szApPerKill);
        
        if(!
str_to_num(szJumpsNum))
            
aData[Jumps] = 1;
        else
            
aData[Jumps] = str_to_num(szJumpsNum);
        
        
ArrayPushArray(g_aBenefitsaData);
        
g_iBenefitsNum++;
    }
}
/* When client join to server */
public client_putinserver(id)
{
    new 
aData[eData];
    
    
g_bHaveBenefits[id] = false;
    
g_bIsJumping[id] = false;
    
g_iJumpsNum[id] = 0;
    
g_iMaxJumps[id] = 1
    
    for (new 
ig_iBenefitsNumi++)
    {
        
ArrayGetArray(g_aBenefitsiaData)
        
        if(
get_user_flags(id) == aData[Flags])
        {
            
g_bHaveBenefits[id] = true;
            
g_iMaxJumps[id] = aData[Jumps];
            break;
        }
    }    
}
/* Player Spawn ( Hamsandwich ) */
public HamPlayerSpawn(id)
{
    if(!
is_user_alive(id) || !g_bHaveBenefits[id])
        return;
    
    new 
aData[eData];
    
    for (new 
ig_iBenefitsNumi++)
    {
        
ArrayGetArray(g_aBenefitsiaData);
        
        if(
get_user_flags(id) == aData[Flags])
        {
            if(
aData[SpawnHP] > 0)
                
set_user_health(idaData[SpawnHP]);
            
            if(
aData[SpawnAP] > 0)
                
set_user_armor(idaData[SpawnAP]);
            
            break;
        }
    }
}
/* Event Death */
public evDeathMsg( )
{
    new 
iKiller read_data(1);
    new 
iVictim read_data(2);
    
    if(
iKiller == iVictim || !is_user_alive(iKiller) || !g_bHaveBenefits[iKiller])
        return;
    
    new 
aData[eData];
    
    for (new 
ig_iBenefitsNumi++)
    {
        
ArrayGetArray(g_aBenefitsiaData);
        
        if(
get_user_flags(iKiller) == aData[Flags])
        {
            
cs_set_user_money(iKillercs_get_user_money(iKiller) + aData[MoneyKill]);
            
set_user_health(iKillerget_user_health(iKiller) + aData[HpKill]);
            
set_user_armor(iKillerget_user_armor(iKiller) + aData[ApKill]);
            
            break;
        }
    }
}
/* Multijump - H.RED.ZONE Code */
public hamPlayerJump(id)
{
    if(!
is_user_alive(id)) 
    {
        return 
HAM_HANDLED;
    }
    
    if( 
pevidpev_flags ) & FL_WATERJUMP || pev(idpev_waterlevel) >= || !(get_pdata_int(id246) & IN_JUMP) )
    {
        return 
HAM_IGNORED
    
}
    
    if(
pevidpev_flags ) & FL_ONGROUND
    {
        
g_iJumpsNumid ] = 0;
        return 
HAM_IGNORED
    
}
    
    if( 
get_pdata_float(id251) < 500 && ++g_iJumpsNum[id] < g_iMaxJumps[id] ) 
    {
        new 
Float:fVelocity];
        
pevidpev_velocityfVelocity );
        
fVelocity] = 268.328157;
        
set_pevidpev_velocityfVelocity );
        
        return 
HAM_HANDLED
    
}
    
    return 
HAM_IGNORED    
}
/* Show Benefits Ranks */
public cmdShowRankBenefits(id)
{
    new 
menuszText[40], aData[eData];
    
menu menu_create("\w[ \yFurien Benefits \w] \rVIP's Ranks""benefitsMenuHandler");
    
    for (new 
ig_iBenefitsNumi++)
    {
        
ArrayGetArray(g_aBenefitsiaData);
        
        
formatex(szTextcharsmax(szText), "\y%s %s"aData[Name], get_user_flags(id) == aData[Flags] ? "\r*" "");
        
menu_additem(menuszText);
    }
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
}
public 
benefitsMenuHandler(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    
showDetailsMenu(iditem);
    
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;    
}
/* Show Benefits Ranks Details  */
public showDetailsMenu(iditem)
{
    new 
menuszText[64], aData[eData];
    
ArrayGetArray(g_aBenefitsitemaData);
    
    
formatex(szTextcharsmax(szText), "\w[ \yFurien Benefits \w] \r%s"aData[Name]);
    
menu menu_create(szText"detailsMenuHandler");
    
    
formatex(szTextcharsmax(szText), "\yHP Spawn: \r%d"aData[SpawnHP]);
    
menu_additem(menuszText);
    
    
formatex(szTextcharsmax(szText), "\yAP Spawn: \r%d"aData[SpawnAP]);
    
menu_additem(menuszText);
    
    
formatex(szTextcharsmax(szText), "\yMoney per kill: \r%d \r$"aData[MoneyKill]);
    
menu_additem(menuszText);
    
    
formatex(szTextcharsmax(szText), "\yHP per kill: \r%d"aData[HpKill]);
    
menu_additem(menuszText);
    
    
formatex(szTextcharsmax(szText), "\yAP per kill: \r%d"aData[ApKill]);
    
menu_additem(menuszText);
    
    if(
aData[Jumps] > 1)
        
formatex(szTextcharsmax(szText), "\yMultijump: \rx%d"aData[Jumps]);
    else
        
formatex(szTextcharsmax(szText), "\yMultijump: \dNO");
    
menu_additem(menuszText);    
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
}
public 
detailsMenuHandler(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
cmdShowRankBenefits(id)
        return 
PLUGIN_HANDLED;
    }
    
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;    
}
/* Show users with benefits */
public cmdShowBenefits(id)
{
    new 
iPlayers[32], iNumszMessage[128], contor;
    
get_players(iPlayersiNum);
    
    
formatex(szMessagecharsmax(szMessage), "!nBenefits ON: ");
    for(new 
i;i<iNum;i++)
    {
        new 
iPlayers;
        if(
g_bHaveBenefits[x]) 
        {
            new 
szName[32], szMsg[128];
            
get_user_name(xszNamecharsmax(szName));
            
formatex(szMsgcharsmax(szMsg), "!g%s!n,"szName);
            
add(szMessagecharsmax(szMessage), szMsg);
            
contor++;
        }
    }
    if(
contor)
    {
        
szMessage[strlen(szMessage)-1] = '.';
        
ColorChat(idszMessage);
    }
    else 
ColorChat(id"Nu sunt jucatori !gON !ncu !gbeneficii !npe server.");
}
/* Colorchat Stock */
stock ColorChat(const id,const input[], any:...) 
{
    new 
iNum 1iPlayers[32];
    static 
szMessage[191];
    
vformat(szMessagecharsmax(szMessage),input3);
    
    
replace_all(szMessagecharsmax(szMessage), "!g""^4");
    
replace_all(szMessagecharsmax(szMessage), "!n""^1");
    
replace_all(szMessagecharsmax(szMessage), "!t""^3");
    
    if(
idiPlayers[0] = id
    
else get_players(iPlayersiNum"ch");
    
    for(new 
0iNumi++) 
    {
        if(
is_user_connected(iPlayers)) 
        {
            
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _iPlayers);
            
write_byte(iPlayers);
            
write_string(szMessage);
            
message_end();
        }
    }
}
/* Plugin END */
public plugin_end()
{
    
ArrayDestroy(g_aBenefits);

When I am trying to compile it I get these errors

PHP Code:
/tmp/textmEFobe.sma(219) : error 033: array must be indexed (variable "-unknown-")
/
tmp/textmEFobe.sma(252) : error 035argument type mismatch (argument 1)

2 Errors.
Could not locate output file /home/groups/amxmodx/public_html/websc3/textmEFobe.amx (compile failed). 
Alexande is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 02-15-2020 , 17:38   Re: Request fix plugin
Reply With Quote #2

Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <fun>
#include <cstrike>
#include <hamsandwich>

#define PLUGIN "VIP Benefits"
#define VERSION "0.8"

enum eData {
    Name[32],
    Flags,
    SpawnHP,
    SpawnAP,
    MoneyKill,
    HpKill, 
    ApKill,
    Jumps
}

new g_iJumpsNum[33], g_iMaxJumps[33];
new bool:g_bIsJumping[33];

new bool:g_bHaveBenefits[33];
new g_iBenefitsNum = 0;
new Array:g_aBenefits;
public plugin_init()
{
    register_plugin(PLUGIN, VERSION, "FaTzZu" );
    
    g_aBenefits = ArrayCreate(eData);
    
    RegisterHam(Ham_Spawn, "player", "HamPlayerSpawn", 1);
    RegisterHam(Ham_Player_Jump, "player", "hamPlayerJump", 0)
    
    register_event("DeathMsg", "evDeathMsg", "a");
    
    register_clcmd("say /vips", "cmdShowBenefits");
    register_clcmd("say /beneficii", "cmdShowRankBenefits");
}
/* Plugin cfg */
public plugin_cfg()
{
    new szLineData[128], szName[32], szFlags[32], szSpawnHP[8], szSpawnAP[8], szMoneyPerKill[8], szHpPerKill[8], szApPerKill[8], szJumpsNum[8];
    new aData[eData]
    new szConfigsDir[128];
    get_configsdir(szConfigsDir, charsmax(szConfigsDir));
    add(szConfigsDir, charsmax(szConfigsDir), "/benefits.ini");
    
    if(!file_exists(szConfigsDir))
    {
        write_file(szConfigsDir, ";Numele flagului        Flagul            HP Spawn    AP Spawn    Money per kill        HP per Kill    Armor per Kill        Numar sarituri (1 = No multijump)");
        write_file(szConfigsDir, ";Exemplu:");
        write_file(szConfigsDir, ";^"VIP Diamond^"        ^"bcdefghijkt^"        ^"125^"        ^"150^"        ^"2000^"        ^"25^"        ^"50^"            ^"2^"");
    }
    
    new f = fopen(szConfigsDir, "rt");
    if(!f)
        return;
    
    while(!feof(f))
    {
        fgets(f, szLineData, charsmax(szLineData));
        
        if(szLineData[0] == ';' || !szLineData[0]) 
            continue;
        
        parse(szLineData, szName, charsmax(szName), szFlags, charsmax(szFlags), szSpawnHP, charsmax(szSpawnHP), szSpawnAP, charsmax(szSpawnAP), szMoneyPerKill, charsmax(szMoneyPerKill), szHpPerKill, charsmax(szHpPerKill), szApPerKill, charsmax(szApPerKill), szJumpsNum, charsmax(szJumpsNum));
        
        copy(aData[Name], charsmax(aData[Name]), szName);
        aData[Flags] = read_flags(szFlags);
        aData[SpawnHP] = str_to_num(szSpawnHP);
        aData[SpawnAP] = str_to_num(szSpawnAP);
        aData[MoneyKill] = str_to_num(szMoneyPerKill);
        aData[HpKill] = str_to_num(szHpPerKill);
        aData[ApKill] = str_to_num(szApPerKill);
        
        if(!str_to_num(szJumpsNum))
            aData[Jumps] = 1;
        else
            aData[Jumps] = str_to_num(szJumpsNum);
        
        ArrayPushArray(g_aBenefits, aData);
        g_iBenefitsNum++;
    }
}
/* When client join to server */
public client_putinserver(id)
{
    new aData[eData];
    
    g_bHaveBenefits[id] = false;
    g_bIsJumping[id] = false;
    g_iJumpsNum[id] = 0;
    g_iMaxJumps[id] = 1; 
    
    for (new i; i < g_iBenefitsNum; i++)
    {
        ArrayGetArray(g_aBenefits, i, aData)
        
        if(get_user_flags(id) == aData[Flags])
        {
            g_bHaveBenefits[id] = true;
            g_iMaxJumps[id] = aData[Jumps];
            break;
        }
    }    
}
/* Player Spawn ( Hamsandwich ) */
public HamPlayerSpawn(id)
{
    if(!is_user_alive(id) || !g_bHaveBenefits[id])
        return;
    
    new aData[eData];
    
    for (new i; i < g_iBenefitsNum; i++)
    {
        ArrayGetArray(g_aBenefits, i, aData);
        
        if(get_user_flags(id) == aData[Flags])
        {
            if(aData[SpawnHP] > 0)
                set_user_health(id, aData[SpawnHP]);
            
            if(aData[SpawnAP] > 0)
                set_user_armor(id, aData[SpawnAP]);
            
            break;
        }
    }
}
/* Event Death */
public evDeathMsg( )
{
    new iKiller = read_data(1);
    new iVictim = read_data(2);
    
    if(iKiller == iVictim || !is_user_alive(iKiller) || !g_bHaveBenefits[iKiller])
        return;
    
    new aData[eData];
    
    for (new i; i < g_iBenefitsNum; i++)
    {
        ArrayGetArray(g_aBenefits, i, aData);
        
        if(get_user_flags(iKiller) == aData[Flags])
        {
            cs_set_user_money(iKiller, cs_get_user_money(iKiller) + aData[MoneyKill]);
            set_user_health(iKiller, get_user_health(iKiller) + aData[HpKill]);
            set_user_armor(iKiller, get_user_armor(iKiller) + aData[ApKill]);
            
            break;
        }
    }
}
/* Multijump - H.RED.ZONE Code */
public hamPlayerJump(id)
{
    if(!is_user_alive(id)) 
    {
        return HAM_HANDLED;
    }
    
    if( pev( id, pev_flags ) & FL_WATERJUMP || pev(id, pev_waterlevel) >= 2 || !(get_pdata_int(id, 246) & IN_JUMP) )
    {
        return HAM_IGNORED
    }
    
    if(pev( id, pev_flags ) & FL_ONGROUND) 
    {
        g_iJumpsNum[ id ] = 0;
        return HAM_IGNORED
    }
    
    if( get_pdata_float(id, 251) < 500 && ++g_iJumpsNum[id] < g_iMaxJumps[id] ) 
    {
        new Float:fVelocity[ 3 ];
        pev( id, pev_velocity, fVelocity );
        fVelocity[ 2 ] = 268.328157;
        set_pev( id, pev_velocity, fVelocity );
        
        return HAM_HANDLED
    }
    
    return HAM_IGNORED    
}
/* Show Benefits Ranks */
public cmdShowRankBenefits(id)
{
    new menu, szText[40], aData[eData];
    menu = menu_create("\w[ \yFurien Benefits \w] \rVIP's Ranks", "benefitsMenuHandler");
    
    for (new i; i < g_iBenefitsNum; i++)
    {
        ArrayGetArray(g_aBenefits, i, aData);
        
        formatex(szText, charsmax(szText), "\y%s %s", aData[Name], get_user_flags(id) == aData[Flags] ? "\r*" : "");
        menu_additem(menu, szText);
    }
    
    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
    menu_display(id, menu, 0);
}
public benefitsMenuHandler(id, menu, item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
    
    showDetailsMenu(id, item);
    
    menu_destroy(menu);
    return PLUGIN_HANDLED;    
}
/* Show Benefits Ranks Details  */
public showDetailsMenu(id, item)
{
    new menu, szText[64], aData[eData];
    ArrayGetArray(g_aBenefits, item, aData);
    
    formatex(szText, charsmax(szText), "\w[ \yFurien Benefits \w] \r%s", aData[Name]);
    menu = menu_create(szText, "detailsMenuHandler");
    
    formatex(szText, charsmax(szText), "\yHP Spawn: \r%d", aData[SpawnHP]);
    menu_additem(menu, szText);
    
    formatex(szText, charsmax(szText), "\yAP Spawn: \r%d", aData[SpawnAP]);
    menu_additem(menu, szText);
    
    formatex(szText, charsmax(szText), "\yMoney per kill: \r%d \r$", aData[MoneyKill]);
    menu_additem(menu, szText);
    
    formatex(szText, charsmax(szText), "\yHP per kill: \r%d", aData[HpKill]);
    menu_additem(menu, szText);
    
    formatex(szText, charsmax(szText), "\yAP per kill: \r%d", aData[ApKill]);
    menu_additem(menu, szText);
    
    if(aData[Jumps] > 1)
        formatex(szText, charsmax(szText), "\yMultijump: \rx%d", aData[Jumps]);
    else
        formatex(szText, charsmax(szText), "\yMultijump: \dNO");
    menu_additem(menu, szText);    
    
    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
    menu_display(id, menu, 0);
}
public detailsMenuHandler(id, menu, item)
{
    if(item == MENU_EXIT)
    {
        cmdShowRankBenefits(id)
        return PLUGIN_HANDLED;
    }
    
    menu_destroy(menu);
    return PLUGIN_HANDLED;    
}
/* Show users with benefits */
public cmdShowBenefits(id)
{
    new iPlayers[32], iNum, szMessage[128], contor;
    get_players(iPlayers, iNum);
    
    formatex(szMessage, charsmax(szMessage), "!nBenefits ON: ");
    for(new i;i<iNum;i++)
    {
        new x = iPlayers[i];
        if(g_bHaveBenefits[x]) 
        {
            new szName[32], szMsg[128];
            get_user_name(x, szName, charsmax(szName));
            formatex(szMsg, charsmax(szMsg), "!g%s!n,", szName);
            add(szMessage, charsmax(szMessage), szMsg);
            contor++;
        }
    }
    if(contor)
    {
        szMessage[strlen(szMessage)-1] = '.';
        ColorChat(id, szMessage);
    }
    else ColorChat(id, "Nu sunt jucatori !gON !ncu !gbeneficii !npe server.");
}
/* Colorchat Stock */
stock ColorChat(const id,const input[], any:...) 
{
    new iNum = 1, iPlayers[32];
    static szMessage[191];
    vformat(szMessage, charsmax(szMessage),input, 3);
    
    replace_all(szMessage, charsmax(szMessage), "!g", "^4");
    replace_all(szMessage, charsmax(szMessage), "!n", "^1");
    replace_all(szMessage, charsmax(szMessage), "!t", "^3");
    
    if(id) iPlayers[0] = id
    else get_players(iPlayers, iNum, "ch");
    
    for(new i = 0; i < iNum; i++) 
    {
        if(is_user_connected(iPlayers[i])) 
        {
            message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, iPlayers[i]);
            write_byte(iPlayers[i]);
            write_string(szMessage);
            message_end();
        }
    }
}
/* Plugin END */
public plugin_end()
{
    ArrayDestroy(g_aBenefits);
}
__________________
iceeedr is offline
Send a message via Skype™ to iceeedr
Alexande
Member
Join Date: Feb 2020
Old 02-16-2020 , 07:27   Re: Request fix plugin
Reply With Quote #3

Thank you
Alexande is offline
Reply


Thread Tools
Display Modes

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 18:06.


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