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

Solved set_user_flags & get_user_flags


Post New Thread Reply   
 
Thread Tools Display Modes
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 08-28-2018 , 21:12   Re: set_user_flags & get_user_flags
Reply With Quote #11

Still not "giving" the flag to the player.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <csstats>
#include <csx>
#include <hamsandwich>
#include <cromchat>

new PLUGIN [] = "Top Flags"
new VERSION [] = "0.1"
new AUTHOR [] = ""

new VarRank

new bool:isTop[33]

public 
plugin_init()
{
        
register_pluginPLUGINVERSIONAUTHOR )
        
VarRank register_cvar("amx_topranks""10")
        
RegisterHamHam_Spawn"player""CheckPlayerRank"1)
}

public 
client_putinserver(id)
{
    
isTop[id] = false
}

public 
CheckPlayerRank(id)
{    
        new 
flags read_flags("bceilktu")

        new 
stats[8], bodyhits[8]
        new 
iRank;
        
iRank get_user_stats(idstatsbodyhits)

        if(
<= iRank <= get_pcvar_num(VarRank))
        {
            if(!
isTop[id])
            {
            
set_user_flags(idflags)
                
isTop[id] = true
                CC_SendMatched
(idRED,"^x04[AMXX]^x01 Voce esta no TOP10 e ganhou beneficios de VIP")
            }
                return  
PLUGIN_HANDLED
        
}
        else
        {
            
remove_user_flags(idflags)
            
isTop[id] = false
            CC_SendMatched
(idRED,"^x04[AMXX]^x01 Voce saiu do TOP10 e perdeu os beneficios de VIP")
        }
       return 
PLUGIN_CONTINUE
}

public 
client_infochanged(id)
{
        new 
player_name[32], newName[32]
        
get_user_name(idplayer_name31)
        
get_user_info(id"name"newName31)
        if (!
equali(newNameplayer_name))
               
set_task(1.0"CheckPlayerRank"id)


Last edited by iceeedr; 08-28-2018 at 21:48.
iceeedr is offline
Send a message via Skype™ to iceeedr
raizo11
BANNED
Join Date: Dec 2013
Location: https://t.me/pump_upp
Old 08-29-2018 , 03:33   Re: set_user_flags & get_user_flags
Reply With Quote #12

Code:
#include <amxmodx>
#include <amxmisc>
#include <csstats>
#include <csx>
#include <hamsandwich>
#include <cromchat>

new PLUGIN [] = "Top Flags"
new VERSION [] = "0.1"
new AUTHOR [] = ""

new VarRank

new bool:isTop[33]

public plugin_init()
{
        register_plugin( PLUGIN, VERSION, AUTHOR )
        VarRank = register_cvar("amx_topranks", "10")
        RegisterHam( Ham_Spawn, "player", "CheckPlayerRank", 1)
}

public client_putinserver(id)
{
    isTop[id] = false
}

public CheckPlayerRank(id)
{    
        new stats[8], bodyhits[8]
        new iRank;
        iRank = get_user_stats(id, stats, bodyhits)

        if(1 <= iRank <= get_pcvar_num(VarRank))
        {
            if(!isTop[id])
            {
            set_user_flags(id, read_flags("bceilktu"))
                isTop[id] = true
                CC_SendMatched(id, RED,"^x04[AMXX]^x01 Voce esta no TOP10 e ganhou beneficios de VIP")
            }
                return  PLUGIN_HANDLED
        }
        else
        {
            set_user_flags(id, read_flags("z"))
            isTop[id] = false
            CC_SendMatched(id, RED,"^x04[AMXX]^x01 Voce saiu do TOP10 e perdeu os beneficios de VIP")
        }
       return PLUGIN_CONTINUE
}

public client_infochanged(id)
{
        new player_name[32], newName[32]
        get_user_name(id, player_name, 31)
        get_user_info(id, "name", newName, 31)
        if (!equali(newName, player_name))
               set_task(1.0, "CheckPlayerRank", id)
}
raizo11 is offline
Send a message via ICQ to raizo11 Send a message via AIM to raizo11 Send a message via MSN to raizo11 Send a message via Yahoo to raizo11 Send a message via Skype™ to raizo11
Natsheh
Veteran Member
Join Date: Sep 2012
Old 08-29-2018 , 03:56   Re: set_user_flags & get_user_flags
Reply With Quote #13

Try doing some debugging into your code. And post back the results.

Razio i dont see any point from your improvement.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 08-29-2018 at 03:58.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 08-29-2018 , 07:01   Re: set_user_flags & get_user_flags
Reply With Quote #14

Quote:
Originally Posted by Natsheh View Post
Try doing some debugging into your code. And post back the results.

Razio i dont see any point from your improvement.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <csstats>
#include <csx>
#include <cromchat>

#define LOG "log.log"

new PLUGIN [] = "Top Flags"
new VERSION [] = "0.1"
new AUTHOR [] = ""

new VarRank

new bool:isTop[33], bool:isAdmin[33]

public 
plugin_init()
{
        
register_pluginPLUGINVERSIONAUTHOR )
        
VarRank register_cvar("amx_topranks""15")
        
set_task(60.0"CheckPlayerRank", .flags "b")
}

public 
client_putinserver(id)
{
    if(
is_user_admin(id))
        
isAdmin[id] = true
    
    isTop
[id] = false

    set_task
(4.0"CheckPlayerRank",id)

    
log_to_file(LOG"My entrance flags are %d"get_user_flags(id) )
    
}

public 
CheckPlayerRank(id)
{       
        if(
isAdmin[id])
            return 
PLUGIN_HANDLED
            
           
new flags read_flags("bceilktu")

        new 
stats[8], bodyhits[8], name[MAX_NAME_LENGTH]
        new 
iRank;
        
iRank get_user_stats(idstatsbodyhits)
        
get_user_name(idnamecharsmax(name))

        if(
<= iRank <= get_pcvar_num(VarRank))
        {
            if(!
isTop[id])
            {
            
set_user_flags(idflags)
                
isTop[id] = true
                CC_SendMatched
(idRED,"^x04[AMXX]^x03 Voce esta no TOP15 e ganhou o^x04 chat VIP.")
                
CC_SendMatched(0RED,"^x04[AMXX]^x03 %s esta no TOP15 e ganhou o^x04 chat VIP."name)
                
log_to_file(LOG"My flags are now %d"get_user_flags(id) )
            }
        }
        else
        {
            if(
isTop[id])
            {
                
set_user_flags(id, -1)
                
set_user_flags(idADMIN_USER)
                
isTop[id] = false
                CC_SendMatched
(idRED,"^x04[AMXX]^x03 Voce saiu do TOP15 e perdeu o^x04 chat VIP.")
                
CC_SendMatched(0RED,"^x04[AMXX]^x03 %s saiu do TOP15 e ganhou o^x04 chat VIP."name)
        }
        }
       return 
PLUGIN_CONTINUE
}

public 
client_infochanged(id)
{
           new 
player_name[32], newName[32]
        
get_user_name(idplayer_name31)
        
get_user_info(id"name"newName31)
        if (!
equali(newNameplayer_name))
               
set_task(1.0"CheckPlayerRank"id)

PHP Code:
L 08/29/2018 07:53:44Log file started (file "cstrike\addons\amxmodx\logs\log.log") (game "cstrike") (amx "1.8.3-dev+5154")

L 08/29/2018 08:00:20My entrance flags are 33554432
L 08
/29/2018 08:00:24My flags are now 35130646 
How do I "read" these flags?

Last edited by iceeedr; 08-29-2018 at 07:01.
iceeedr is offline
Send a message via Skype™ to iceeedr
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 08-29-2018 , 07:07   Re: set_user_flags & get_user_flags
Reply With Quote #15

Quote:
Originally Posted by iceeedr View Post
How do I "read" these flags?

PHP Code:
get_flags(flags,output[],len); 
__________________
edon1337 is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 08-29-2018 , 10:03   Re: set_user_flags & get_user_flags
Reply With Quote #16

It seems to be working properly now..I leave the code here and I will put the prefix solved until there is some problem ... If you have any changes to be made in the code feel free to indicate to me that the improvement, thank you.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <csstats>
#include <csx>
#include <cromchat>

#define LOG "log.log"

new PLUGIN [] = "Top Flags"
new VERSION [] = "0.1"
new AUTHOR [] = "iceeedR"

new VarRank

new bool:isTop[33], bool:isAdmin[33]

public 
plugin_init()
{
        
register_pluginPLUGINVERSIONAUTHOR )
        
VarRank register_cvar("amx_topranks""15")
        
set_task(60.0"CheckPlayerRank", .flags "b")
}

public 
client_putinserver(id)
{
    if(
is_user_admin(id))
        
isAdmin[id] = true
    
    isTop
[id] = false

    set_task
(4.0"CheckPlayerRank",id)
    
    if(!
is_user_bot(id))
    {
        new 
flags get_user_flags(id), sflags[MAX_NAME_LENGTH]
        
get_flags(flagssflagscharsmax(sflags))

        
log_to_file(LOG"My entrance flags are %s"sflags)
    }
    
}

public 
CheckPlayerRank(id)
{       
        if(
isAdmin[id])
            return 
PLUGIN_HANDLED
            
           
new flags read_flags("bceilktu")

        new 
stats[8], bodyhits[8], name[MAX_NAME_LENGTH]
        new 
iRank;
        
iRank get_user_stats(idstatsbodyhits)
        
get_user_name(idnamecharsmax(name))

        if(
<= iRank <= get_pcvar_num(VarRank))
        {
            if(!
isTop[id])
            {
                
remove_user_flags(idADMIN_USER)
            
set_user_flags(idflags)
                
isTop[id] = true
                CC_SendMatched
(idRED,"^x04[FOURKILLS]^x03 Voce esta no TOP15 e ganhou o^x04 chat VIP.")
                
CC_SendMatched(0RED,"^x04[FOURKILLS]^x03 %s esta no TOP15 e ganhou o^x04 chat VIP."name)

                new 
xflags get_user_flags(id), sflags[MAX_NAME_LENGTH]
            
get_flags(xflagssflagscharsmax(sflags))
                
log_to_file(LOG"My flags are now %s"sflags)
            }
        }
        else
        {
            if(
isTop[id])
            {
                
set_user_flags(idADMIN_USER)
                
isTop[id] = false
                CC_SendMatched
(idRED,"^x04[FOURKILLS]^x03 Voce saiu do TOP15 e perdeu o^x04 chat VIP.")
                
CC_SendMatched(0RED,"^x04[FOURKILLS]^x03 %s saiu do TOP15 e ganhou o^x04 chat VIP."name)
        }
        }
       return 
PLUGIN_CONTINUE
}

public 
client_infochanged(id)
{
           new 
player_name[32], newName[32]
        
get_user_name(idplayer_name31)
        
get_user_info(id"name"newName31)
        if (!
equali(newNameplayer_name))
               
set_task(1.0"CheckPlayerRank"id)

PHP Code:
L 08/29/2018 10:57:06My entrance flags are z
L 08
/29/2018 10:57:07My flags are now bceikltu 
iceeedr is offline
Send a message via Skype™ to iceeedr
Reply



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 10:44.


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