AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Client_print linux issue? (https://forums.alliedmods.net/showthread.php?t=47560)

raa 11-20-2006 20:30

Client_print linux issue?
 
Why does this code return the correct "kills" in a win32 cs server;
(You are a Private with 114 kills)

but in a linux cs server it returns;
(You are a Private with rF0 kills)

Code:

#include <amxmodx>
#include <amxmisc>
#include <csstats>

#define RANK_CIVILIAN 0
#define RANK_PRIVATE 1
#define RANK_MARSHALL 2

#define MAXRANKS 3

new PlayerRank[33]

new const RANKS[MAXRANKS][] =
{
        "Civilian",
        "Private",
        "Marshall"
}

public plugin_init()
        {
        register_plugin("Rank Display", "1.0", "")
        register_clcmd("say /myrank","showrank");
}

public showrank(id)   
        { 
        if(!is_user_connected(id))
                return 0
       
        new stats[8]
        new kills[8]
        get_user_stats(id, stats, kills)       
       
        new name[33]
        get_user_name(id, name, 32)
       
        if(stats[0] < 1)
                {
                PlayerRank[id] = RANK_CIVILIAN
        }
        if(stats[0] >= 1 && stats[0] <= 3)
                {
                PlayerRank[id] = RANK_PRIVATE
        }
        if(stats[0] >= 3)
                {
                PlayerRank[id] = RANK_MARSHALL
        }
        client_print(id,print_chat, "You are a %s with %s kills", RANKS[PlayerRank[id]], stats[0]);
       
        return 0
}

Thanks for any help you can give.

XxAvalanchexX 11-20-2006 21:16

Re: Client_print linux issue?
 
Change your second %s to %i.

%s is for strings, %i is for integers, %f is for floats, and %d is either for miscellaenous, or possibly it auto-detects which type to use. I've never really figured that out.

EDIT: I asked Suzuka, and she confirms what yang said, which is that %d works only for integers, ie an alternative to %i (or vice-versa).

raa 11-20-2006 21:31

Re: Client_print linux issue?
 
thank you very much.. I could'nt find that info in the documentation/forums..

jim_yang 11-20-2006 22:25

Re: Client_print linux issue?
 
%d is also for integars.


All times are GMT -4. The time now is 06:48.

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