Raised This Month: $12 Target: $400
 3% 

Rank Flag Capture


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
yRestrict
BANNED
Join Date: Apr 2019
Old 02-13-2020 , 03:15   Rank Flag Capture
Reply With Quote #1

I tried to make a plugin for my server
showing a rank
Captured Flag
Return Flags
Taken Flag

but not sure can someone help me by getting my code

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <jctf>
#include <fvault>


#define PLUGIN "Rank -- Pega Bandeira"
#define VERSION "2.0"
#define AUTHOR "yRestrict"

// Player Vars
new g_flagcaptured[MAX_PLAYERS 1];
new 
g_flagreturned[MAX_PLAYERS 1];
new 
g_szMotd[1536];

new 
boolg_bPlayerName[32][MAX_PLAYERS 1]

new const 
RANK_BANDEIRAS[] =                 "capb_ranks_bandeiras"
new const g_sPrefix[] = "!t[!FlaG Hunters!t]"

enum _Bkrank_APdata sz_Conta[35], szPoints[128] }




/*-----------0--[ PLUGINS ]-------------*/
public plugin_init()
{
    
// Register Plugin
        
register_plugin(PLUGINVERSIONAUTHOR)

    
// EVEMTS
        
register_event("HLTV""round_start""a""1=0""2=0")
    
    
// PLAYER COMANDS
        
register_clcmd("say /crank""SkillRank")
        
register_clcmd("say /ctop""top10_flags")

}

stock xIsUserNoSxe(id)
{
    
// ID
    
new xGetAuth[64]

    
// ID
    
get_user_authid(idxGetAuthcharsmax(xGetAuth))
    
    
// True
    
if(equal(xGetAuth"VALVE_4:4"9))
        return 
true
    
    
// Return    
    
return false
}

stock skvd_chat_collor(target, const message[], any:...)
{
    static 
buffer[650], iargscount
    argscount 
numargs()

    
// Replace Caracter Special
    
    // Send to everyone
    
if(!target)
    {
        static 
player
        
for (player 1player <= get_maxplayers(); player++)
        {
            
// Not connected
            
if (!is_user_connected(player))
                continue;
            
            
// Remember changed arguments
            
static changed[5], changedcount // [5] = max LANG_PLAYER occurencies
            
changedcount 0
            
            
// Replace LANG_PLAYER with player id
            
for (2argscounti++)
            {
                if (
getarg(i) == LANG_PLAYER)
                {
                    
setarg(i0player)
                    
changed[changedcount] = i
                    changedcount
++
                }
            }
            
            
// Format message for player
            
vformat(buffercharsmax(buffer), message3)
            
replace_all(buffercharsmax(buffer),"!g","^4");// green
            
replace_all(buffercharsmax(buffer),"!n","^1");// normal
            
replace_all(buffercharsmax(buffer),"!y","^1");// normal
            
replace_all(buffercharsmax(buffer),"!t","^3");// team
            
replace_all(buffercharsmax(buffer),"x04","^4");// green
            
replace_all(buffercharsmax(buffer),"x03","^3");// normal
            
replace_all(buffercharsmax(buffer),"x01","^1");// normal
            
            // Send it
            
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _player)
            
write_byte(player)
            
write_string(buffer)
            
message_end()
            
            
// Replace back player id's with LANG_PLAYER
            
for (0changedcounti++)
                
setarg(changed[i], 0LANG_PLAYER)
        }
    }
    
// Send to specific target
    
else
    {        
        if(!
is_user_connected(target))
            return;

        
// Format message for player
        
vformat(buffercharsmax(buffer), message3)
        
replace_all(buffercharsmax(buffer),"!g","^4");// green
        
replace_all(buffercharsmax(buffer),"!n","^1");// normal        
        
replace_all(buffercharsmax(buffer),"!y","^1");// normal
        
replace_all(buffercharsmax(buffer),"!t","^3");// team
        
replace_all(buffercharsmax(buffer),"x04","^4");// green
        
replace_all(buffercharsmax(buffer),"x03","^3");// team
        
replace_all(buffercharsmax(buffer),"x01","^1");// normal

        // Send it
        
message_begin(MSG_ONEget_user_msgid("SayText"), _target)
        
write_byte(target)
        
write_string(buffer)
        
message_end()
    }
}
// Drop primary/secondary weapons

public client_putinserver(id)
{
    
// Nome
    
get_user_name(idg_bPlayerName[id], charsmax(g_bPlayerName[])) 
    
    
// Vars
    
g_flagcaptured[id] = 0;
    
g_flagreturned[id] = 0;


    
// Hud
    
set_task(1.0"team_menu"id)

    
// Save Rank Bandeira
    
if(!xIsUserNoSxe(id))
    {    
        
// ID 
        
new xGetAuth[64], szData[250], Pontos[32], Capturadas[32], Recuperadas[32], Nick[32];

        
// ID
        
get_user_authid(idxGetAuthcharsmax(xGetAuth))

        
// Dados
        
if(fvault_get_data(RANK_BANDEIRASxGetAuthszDatacharsmax(szData)))
        {
            
// Bugs Remove
            
replace_all(Pontoscharsmax(Pontos), "'"""// Pra nao buga o html da motd
            
replace_all(Capturadascharsmax(Capturadas), "'"""// Pra nao buga o html da motd
            
replace_all(Recuperadascharsmax(Recuperadas), "'"""// Pra nao buga o html da motd

            // Points
            
g_flagcaptured[id] = str_to_num(Capturadas)
            
g_flagreturned[id] = str_to_num(Recuperadas)

            
// Parse
            
parse(szDataPontoscharsmax(Pontos), Capturadascharsmax(Capturadas), Recuperadascharsmax(Recuperadas), Nickcharsmax(Nick))
        }
    }
}

public 
jctf_flag(iEventidiFlagTeambool:bAssist)
{
    switch(
iEvent)
    {
        case 
FLAG_RETURNED:
        {
            if(!
bAssist)
            {
                
g_flagreturnedid ]++
            }
        }
        case 
FLAG_CAPTURED:
        {
            if(!
bAssist)
            {
                
g_flagcapturedid ]++
            }
        }
    }
}

public 
client_disconnected(id)
{

    
// Save Rank Bandeira
    
if(!xIsUserNoSxe(id))
    {    
        
// ID 
        
new xGetAuth[64], szData[250], szNick[64]

        
// ID
        
get_user_authid(idxGetAuthcharsmax(xGetAuth))

        
// Formatex
        
formatex(szNickcharsmax(szNick), "%s"g_bPlayerName[id])

        
// Bugs
        
replace_all(szNickcharsmax(szNick), " """// Pra nao buga o html da motd
        
replace_all(szNickcharsmax(szNick), "'"""// Pra nao buga o html da motd

        // Data
        
formatex(szDatacharsmax(szData), "'%d' '%d' '%d' '%s'"g_flagcaptured[id] + g_flagreturned[id], g_flagcaptured[id], g_flagreturned[id], szNick)

        
// Salvar
        
fvault_set_data(RANK_BANDEIRASxGetAuthszData)
    }

    
// RANK
    
g_flagcaptured[id] = 0;
    
g_flagreturned[id] = 0;

}


/*--------------------------------------*/
/*----------[ RANK BANDEIRA ]-----------*/
public top10_flags(id)
{
    
// Len
    
new iLen formatex(g_szMotdcharsmax(g_szMotd),
    
"<body bgcolor=#A4BED6>\
    <table width=100%% cellpadding=2 cellspacing=0 border=0>\
    <tr align=center bgcolor=#52697B>\
    <th width=20%%>Posicao\
    <th width=20%% align=left>Nome\
    <th width=20%%>Bandeiras Capturadas\
    <th width=20%%>Bandeiras Recuperadas"
);

    
// Arrays
    
new Array: aKey ArrayCreate(35)
    new Array: 
aData ArrayCreate(128)
    new Array: 
aAll ArrayCreate(Bkrank_APdata)

    
// Load
    
fvault_load(RANK_BANDEIRASaKeyaData)

    
// Vars
    
new iArraySize ArraySize(aKey), Data[Bkrank_APdata], i;

    
// Countsa
    
for(0iArraySizei++)
    {
        
// String
        
ArrayGetString(aKeyiData[sz_Conta], sizeof Data[sz_Conta] - 1)
        
ArrayGetString(aDataiData[szPoints], sizeof Data[szPoints] - 1)

        
// Data
        
ArrayPushArray(aAllData)
    }

    
// Sort
    
ArraySort(aAll"SortData")

    
// Vars
    
new szName[32], iSize clamp(iArraySize010), jPontos[32], Capturadas[32], Recuperadas[32], Nick[32];
    new 
PCapuradasPRecuperadas;

    
// Itens
    
for(1iSizej++)
    {
        
// Array
        
ArrayGetArray(aAlljData)

        
// Get Data
        
fvault_get_data(RANK_BANDEIRASData[sz_Conta], szNamecharsmax(szName))

        
// Espaços
        
replace_all(szNamecharsmax(szName), "<"" ")
        
replace_all(szNamecharsmax(szName), ">"" "// Pra nao buga o html da motd
        
replace_all(szNamecharsmax(szName), "%"" ")
        
replace_all(szNamecharsmax(szName), " """)

        
// Parse
        
parse(Data[szPoints], Pontoscharsmax(Pontos), Capturadascharsmax(Capturadas), Recuperadascharsmax(Recuperadas), Nickcharsmax(Nick))

        
// Bugs Remove
        
replace_all(Pontoscharsmax(Pontos), "'"""// Pra nao buga o html da motd
        
replace_all(Capturadascharsmax(Capturadas), "'"""// Pra nao buga o html da motd
        
replace_all(Recuperadascharsmax(Recuperadas), "'"""// Pra nao buga o html da motd
        
replace_all(Nickcharsmax(Nick), " """// Pra nao buga o html da motd
        
replace_all(Nickcharsmax(Nick), "'"""// Pra nao buga o html da motd

        // Pontos
        
PCapuradas str_to_num(Capturadas)
        
PRecuperadas str_to_num(Recuperadas)
        
        
// Len
        
iLen += formatex(g_szMotd[iLen], charsmax(g_szMotd) - iLen"<tr align=center>");
        
iLen += formatex(g_szMotd[iLen], charsmax(g_szMotd) - iLen"<td>%d"j);
        
iLen += formatex(g_szMotd[iLen], charsmax(g_szMotd) - iLen"<td align=left>%s"Nick);
        
iLen += formatex(g_szMotd[iLen], charsmax(g_szMotd) - iLen"<td>%d"PCapuradas);
        
iLen += formatex(g_szMotd[iLen], charsmax(g_szMotd) - iLen"<td>%d"PRecuperadas);
    }

    
// Len
    
iLen += formatex(g_szMotd[iLen], charsmax(g_szMotd) - iLen"</body></table>")

    
// Destroy Array
    
ArrayDestroy(aKey)
    
ArrayDestroy(aData)
    
ArrayDestroy(aAll)

    
// Make
    
show_motd(idg_szMotd"[CAPB] Rank de Bandeiras:")


public 
SkillRank(id)
{
    
// Arrays
    
new Array:aKey ArrayCreate(35)
    new Array:
aData ArrayCreate(128)
    new Array:
aAll ArrayCreate(Bkrank_APdata)

    
// Load
    
fvault_load(RANK_BANDEIRASaKeyaData)

    
// Vars
    
new iArraySize ArraySize(aKey), Data[Bkrank_APdata], i

    
// Load
    
for (0iArraySizei++)
    {
        
ArrayGetString(aKeyiData[sz_Conta], sizeof Data[sz_Conta] - 1)
        
ArrayGetString(aDataiData[szPoints], sizeof Data[szPoints] - 1)
        
ArrayPushArray(aAllData)
    }

    
// Sort
    
ArraySort(aAll"SortData")

    
// Vars
    
new szAuthIdFromArray[35], j

    
// Itens
    
for (0iArraySizej++)
    {
        
// String
        
ArrayGetString(aAlljszAuthIdFromArraycharsmax(szAuthIdFromArray))

        
// Conta
        
new xGetAuth[40]; get_user_authid(idxGetAuthcharsmax(xGetAuth))

        
// ID
        
if(equal(szAuthIdFromArrayxGetAuth)) 
            break
    }

    
// Array Destroy
    
ArrayDestroy(aKey)
    
ArrayDestroy(aData)
    
ArrayDestroy(aAll)

    
// Chat
    
skvd_chat_collor(id"!g%s!y %L"g_sPrefixid"RANK_BANDEIRAS"1iArraySizeg_flagcapturedg_flagreturned[id])

    
// Return
    
return PLUGIN_CONTINUE
}
public 
SortData(Array:aArrayiItem1iItem2iData[], iDataSize)
{
    
// Vars
    
new Data1[Bkrank_APdata], Data2[Bkrank_APdata]

    
ArrayGetArray(aArrayiItem1Data1)
    
ArrayGetArray(aArrayiItem2Data2)

    
// Points
    
new szPoints_1[7]
    
parse(Data1[szPoints], szPoints_1charsmax(szPoints_1))

    
// Points
    
new szPoints_2[7]
    
parse(Data2[szPoints], szPoints_2charsmax(szPoints_2))

    
// Count
    
new iCount1 str_to_num(szPoints_1)
    new 
iCount2 str_to_num(szPoints_2)

    
// Return
    
return (iCount1 iCount2) ? -: ((iCount1 iCount2) ? 0)


Last edited by yRestrict; 02-13-2020 at 03:18.
yRestrict is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 02-13-2020 , 08:45   Re: Rank Flag Capture
Reply With Quote #2

Okay so u have that plugin, now what is the problem? What are u not sure of?
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 02-13-2020 , 10:13   Re: Rank Flag Capture
Reply With Quote #3

No steam = No support
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
yRestrict
BANNED
Join Date: Apr 2019
Old 02-13-2020 , 13:20   Re: Rank Flag Capture
Reply With Quote #4

Quote:
Originally Posted by Napoleon_be View Post
Okay so u have that plugin, now what is the problem? What are u not sure of?
he is not working

it compiled right, but it doesn't work within the game

Quote:
Originally Posted by iceeedr View Post
No steam = No support
I didn't understand, because I'm steam
yRestrict is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 02-13-2020 , 14:22   Re: Rank Flag Capture
Reply With Quote #5

You're Steam, your server not.

Code:
stock xIsUserNoSxe(id)
{
    // ID
    new xGetAuth[64]

    // ID
    get_user_authid(id, xGetAuth, charsmax(xGetAuth))
    
    // True
    if(equal(xGetAuth, "VALVE_4:4", 9))
        return true
    
    // Return    
    return false
}
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
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 12:34.


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