AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Rank message fail :/ (https://forums.alliedmods.net/showthread.php?t=214569)

Jhob94 04-28-2013 18:04

Rank message fail :/
 
Hi
I tried use this:
PHP Code:

#include <amxmodx>
#include <csx>

#define MESSAGE_PREFIX "AMXX"

public plugin_init() {
    
register_plugin("Client Connect Rank""0.0.1""Jhob94")
}

public 
client_putinserver(id)
{
    new 
iStats[8], Rankname[32]
    
    
Rank get_user_stats(idiStatsiStats)
    
get_user_name(id,name,31)
    
    if(!
is_user_bot(id))
    {
        if(
Rank <= 15)
            
client_print(0print_chat"[%s] %s joined the server. Be careful his rank is %d !"MESSAGE_PREFIXnameRank)
    
        else
            
client_print(0print_chat"[%s] %s joined the server. His rank is %d ."MESSAGE_PREFIXnameRank)
    }


It works, but have some fail... It always says that rank is 0 :3
Someone knows why?

MousePad 04-28-2013 18:34

Re: Rank message fail :/
 
Did you try reading this when the player spawns? Or maybe you could try to get it a couple seconds after client_putinserver.

Jhob94 04-28-2013 19:05

Re: Rank message fail :/
 
I dont want on spawn.
Btw maybe the problem is because on client_putinserver, it didnt set rank yet. Hum i go try set an task

tonykaram1993 04-28-2013 19:28

Re: Rank message fail :/
 
Try replacing the following:

PHP Code:

client_putinserverid 

:arrow:

PHP Code:

client_authorizedid 


Jhob94 04-28-2013 19:42

Re: Rank message fail :/
 
If iam not wrong, putinserver is after authorized(not sure). Btw i tried both, not worked.
Now is working, i did made a event for team join, the only problem is that display more then one message for the same player :/

MousePad 04-28-2013 19:50

Re: Rank message fail :/
 
Can you paste your final code here?

YamiKaitou 04-28-2013 19:57

Re: Rank message fail :/
 
Quote:

Originally Posted by Jhob94 (Post 1941846)
If iam not wrong, putinserver is after authorized(not sure).

Not always the case, just most of the time

Jhob94 04-28-2013 20:04

Re: Rank message fail :/
 
Quote:

Originally Posted by MousePad (Post 1941851)
Can you paste your final code here?

PHP Code:

#include <amxmodx>
#include <csx>

#define MESSAGE_PREFIX "AMXX"

public plugin_init() {
    
register_plugin("Client Connect Rank""0.0.1""Jhob94")
    
    
register_event("TeamInfo""Join_Team""b")
}
public 
Join_Team(id
{
    new 
iStats[8], Rankname[32]
    
Rank get_user_stats(idiStatsiStats)
    
get_user_name(id,name,31)
    
    if(!
is_user_bot(id))
    {
        if(
Rank <= 15)
            
client_print(0print_chat"[%s] %s joined the server. Be careful his rank is %d !"MESSAGE_PREFIXnameRank)
            
        else
            
client_print(0print_chat"[%s] %s joined the server. His rank is %d ."MESSAGE_PREFIXnameRank)
    }



MousePad 04-28-2013 20:13

Re: Rank message fail :/
 
As far as I know, that join team will be called when the player is connected the first time as a spectator before choosing a team. If you want a dirty fix without checking if the team is T or CT, you can create a bool array of player count, make the index false at client connect and check if the index is false before displaying the message. Then you can display the message and set the index to true.

Actually forget my dirty suggestion. This should have all the info you need:
https://forums.alliedmods.net/showpo...25&postcount=3

zi443r 04-29-2013 04:38

Re: Rank message fail :/
 
try
PHP Code:

#include <csstats> 



All times are GMT -4. The time now is 10:53.

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