AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   ScoreAttrib (https://forums.alliedmods.net/showthread.php?t=88405)

CyberMaN 03-24-2009 10:34

ScoreAttrib
 
Hello there,

My name is James, and I am new at amxmodx coding. Now, I would like to ask a question. I am working to get a small thing running, show VIP in the scoreboard. I linked myself to:

http://www.amxmodx.org/funcwiki.php?go=func&id=202

And to someone's code containing:
PHP Code:

stock cs_set_user_scoreattrib(id,attrib=0)
{
    
message_begin(2,get_user_msgid("ScoreAttrib"),{0,0,0},0);
    
write_byte(id);
    
write_byte(attrib);
    
message_end();


with a comment of (1<<2) means VIP.

Well, I can't get it to work out, I've tried using about 5 other plugins to see if their side worked, but I just can't see it on the scoreboard. And everything works wonderfully on the server, no problems with the plugins loading.

Thanks in advance for any help offered,
James.

Bugsy 03-24-2009 11:01

Re: ScoreAttrib
 
The code was written by ConnorMcLeod, slightly edited.

http://forums.alliedmods.net/showthread.php?t=80069

According to the below thread, if you are a terrorist and VIP, you cannot see the VIP next to your name but others can. If you are a CT then you and others can see it.

http://forums.alliedmods.net/showthread.php?t=70840

Below I made it apply VIP to myself just to show how you can do it. You will need to modify it to apply on particular players.

PHP Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Rank1 -> VIP"
#define AUTHOR "ConnorMcLeod"
#define VERSION "0.0.2"

#define SCOREATTRIB_VIP            (1<<2)

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_message(get_user_msgid("ScoreAttrib"), "Message_ScoreAttrib")
}

public 
Message_ScoreAttrib(osef2talifeosef3talifeosef4talife)
{
    new 
id get_msg_arg_int(1)

    if( 
id == get_user_index("bugsy") && !get_msg_arg_int(2) )
    {
            
set_msg_arg_int(2ARG_BYTESCOREATTRIB_VIP)
    }



CyberMaN 03-24-2009 11:18

Re: ScoreAttrib
 
Thank you very very much, Bugsy. Short and neat, just the way it should be.

Everything in order to get me started is in there, thanks again.

+1 Karma for the quick reply and the correct solution, and please feel free to PM me if there is anything I can do for you.

Regards,
James.

P.S: To verify/debate everything said about how it works, here's the deal:

CT -> You can see VIP, CT's can see VIP, T's can't see VIP, Spectators can see VIP.
T -> You can't see VIP, others CAN'T(!) see VIP.

I'll try to see if I can change it, good luck to me.

Bugsy 03-24-2009 21:38

Re: ScoreAttrib
 
1 Attachment(s)
I just found this in my files, it has a fm_cs_set_user_vip() function among other useful function. It will be a bit easier to set on a player than using what I posted above.


All times are GMT -4. The time now is 09:01.

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