Raised This Month: $ Target: $400
 0% 

Say command doesn't work (again...)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kotinha
Senior Member
Join Date: Jun 2009
Location: Alentejo, Portugal :)
Old 03-19-2011 , 08:30   Say command doesn't work (again...)
Reply With Quote #1

When I compile my code it doesn't give any errors, but if I say something in my server it doesn't print the message that it is supposed to print.

The other functions work normally, or at least I think they do ...

The code (unfinished, obviously...):
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <nvault>

#define PLUGIN "rank tags"
#define VERSION "1.0"
#define AUTHOR "thony"

new PlayerExp[33], PlayerLevel[33]
new 
g_vault
new ranktag_toggle
new iTag
new const LEVELS[4] = {
    
100,
    
200,
    
400,
    
800
}
new const 
TAGS[][32] = {
    
"Noob",
    
"Camper",
    
"Player",
    
"Master"
}
public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
// Open Vault
    
g_vault nvault_open("ranktags")
    
// Register events
    
register_event("DeathMsg""player_death""a")
    
register_event("client_connect""when_connect""a")
    
register_concmd("say""cmd_say");
    
// Register cvars
    
ranktag_toggleregister_cvar("ranktag_toggle""1")
}
public 
cmd_say(id)
{
    
// Get what player said and blocks message (not... yet)
    
static text2[200];
    
read_args(text2199);
    
remove_quotes(text2);
    
client_print(idprint_chat"You said %s"text2)
}
public 
when_connect(id
{
    if(
get_pcvar_num(ranktag_toggle)==1
    {
        
load_data(id)
    }
}
public 
player_death(id)
{
    
// If victim exp is different of 0 remove 1 exp point
    
PlayerExp[id]+=100
    
if (PlayerExp[id]!=0)
        
PlayerExp[id] -= 1;
    
// Get killer, if headshot, weapon
    
new killer read_data(1)
    new 
is_headshot read_data(3)
    new 
weapon read_data(4)
    
// Give exp to killer
    
if(is_headshot)
        
PlayerExp[killer] += 4
    
    
else if(weapon == CSW_KNIFE)
        
PlayerExp[killer] += 6
    
    
else
        
PlayerExp[killer] += 2
}
public 
load_data(id)
{
    
// Get player steamID
    
new steamid[35]
    
get_user_authid(id,steamid,34)
    
// Create variables to get data
    
new vaultkey[64], vaultdata[256]
    
// Put in right format to get data
    
format(vaultkey,63,"%s-ranktag",steamid
    
format(vaultdata,255,"%i#%i#",PlayerExp[id],PlayerLevel[id]) 
    
// Get player data
    
nvault_get(g_vault,vaultkey,vaultdata,255
    
replace_all(vaultdata255"#"" ")
    
// Create necessary variables...
    
new playerexp[32], playerlevel[32
    
// Separate strings and convert to num
    
parse(vaultdataplayerexp31playerlevel31
    
PlayerExp[id] = str_to_num(playerexp
    
PlayerLevel[id] = str_to_num(playerlevel)
    return 
PLUGIN_CONTINUE
    
    
// Player Exp and Player Level is right to go!
}
public 
get_tag(exp)
{
    for(new 
0i<=3i++)
    {
        if(
LEVELS[i]>=exp)
        {
            
iTag=i
            
break;
        }
    }
    return 
TAGS[iTag];

__________________
"If God exists, I hope he has a good excuse." - Woody Allen
kotinha is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-19-2011 , 09:22   Re: Say command doesn't work (again...)
Reply With Quote #2

PHP Code:
register_event("client_connect""when_connect""a"
WTF is this ?

Give up now when it is still early enough.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
schmurgel1983
Veteran Member
Join Date: Aug 2006
Location: Germany
Old 03-19-2011 , 11:07   Re: Say command doesn't work (again...)
Reply With Quote #3

all possible register_event hooks don't see client_connect
client_connect is a forward from amxmodx.inc
alsoooooo
Code:
public client_connect(client)
{
   // code here
}


__________________

Working on:
nothing
schmurgel1983 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-19-2011 , 11:10   Re: Say command doesn't work (again...)
Reply With Quote #4

Also look on how to register event with proper flags.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
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 14:36.


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