Raised This Month: $ Target: $400
 0% 

Say & Print problem.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 06-21-2012 , 11:49   Say & Print problem.
Reply With Quote #1

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <colorchat>

#define VERSION "1.0.0"
#define TOTALGROUPS 7
#define MaxPlayers 32

new MAXPLAYERSSayText

bool
:is_valid_msg(const arg[]) {
    if( 
arg[0] == '@' || !strlen(arg)) { 
        return 
false
    
}
    return 
true
}

enum _:iGroups {
    
NONE,
    
BEGINNERS,
    
AMATURES,
    
SEMIPROS,
    
PROFESSIONALS,
    
MASTERS,
    
GODS
}

new const 
szGroups[TOTALGROUPS][MaxPlayers 1] = {
    
"None",
    
"Beginners",
    
"Amatures",
    
"Semi-pros",
    
"Professionals",
    
"Masters",
    
"Gods"
}

new const 
szDescription[TOTALGROUPS][] = {
    
"[Groups]^1 You don't need to earn any kills to join this group!",
    
"[Groups]^1 Earn^3 25^1 kills to join this group!",
    
"[Groups]^1 Earn^3 50^1 kills to join this group!",
    
"[Groups]^1 Earn^3 100^1 kills to join this group!",
    
"[Groups]^1 Earn^3 200^1 kills to join this group!",
    
"[Groups]^1 Earn^3 400^1 kills to join this group!",
    
"[Groups]^1 Earn^3 750^1 kills to join this group!"
}

new const 
szKillsNeeded[TOTALGROUPS] = {
    
0,
    
25,
    
50,
    
100,
    
200,
    
400,
    
750
}

new 
szCurrentGroup[MaxPlayers 1]
new 
szKills[MaxPlayers 1]

public 
plugin_init() {
    
register_plugin("Groups Joiner"VERSION"NapoleoN#")
    
    
// Commands
    
register_clcmd("say /groups""MenuGroups")
    
register_clcmd("say_team /groups""MenuGroups")
    
register_clcmd("say /setkills""SetKills")
    
    
register_clcmd("say""HandleSay")
    
    
// MaxPlayers & Message
    
SayText get_user_msgid("SayText")
    
MAXPLAYERS get_maxplayers()
    
register_message(SayText"MsgDuplicate")
    
    
// Events
    
register_event("DeathMsg""eDeath""a")
}

public 
eDeath() {
    if(
read_data(1) != read_data(2) || cs_get_user_team(read_data(1)) != cs_get_user_team(read_data(2))) {
        
szKills[read_data(1)]++
    }
}

public 
MsgDuplicate(id) {
    return 
PLUGIN_HANDLED
}

public 
HandleSay(id) {
    new 
arg[192], szName[MaxPlayers 1]; get_user_name(idszNamecharsmax(szName))
    
read_args(argcharsmax(arg))
    
remove_quotes(arg)
    
    if(
szCurrentGroup[id] != NONE) {
        if(
is_valid_msg(arg)) {
            (
is_user_alive(id) ? format(argcharsmax(arg), "^4[%s]^3 %s: ^1%s"szCurrentGroup[id], szNamearg) : format(argcharsmax(arg), "^4[%s]^3 *DEAD* %s: ^1%s"szCurrentGroup[id], szNamearg))
        }
    }
    else {
        (
is_user_alive(id) ? format(argcharsmax(arg), "^3%s:^1 %s"szNamearg) : format(argcharsmax(arg), "^3*DEAD* %s:^1 %s"szNamearg))
    }
    
    for(new 
1<= MAXPLAYERSi++) {
        if(!
is_user_connected(i)) {
            continue
        }
        if(
is_user_alive(id) && is_user_alive(i) || !is_user_alive(id) && !is_user_alive(i)) {
            
message_begin(MSG_ONESayText, {000}, i)
            
write_byte(id)
            
write_string(arg)
            
message_end()
        }
    }
    return 
PLUGIN_CONTINUE;
}

public 
MenuGroups(id) {
    new 
szTemp[500 char], Key[10]
    
    
formatex(szTempcharsmax(szTemp), "Groups Menu ^nCurrent Group:\r %s^n\wTotal Kills:\r %i"szCurrentGroup[id], szKills[id])
    new 
menu menu_create(szTemp"GroupsMenuHandler")
    
    for(new 
iiGroupsi++) {
        
formatex(szTempcharsmax(szTemp), "%s"szGroups[i])
        
num_to_str(iKeycharsmax(Key))
        
menu_additem(menuszTempKey)
    }
    
menu_display(idmenu)
}

public 
GroupsMenuHandler(idmenuitem) {
    if(
item == MENU_EXIT) {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
        
    if(
szKills[id] >= szKillsNeeded[item]) {
        
szCurrentGroup[id] = szGroups[item][id]
        
ColorChat(idGREEN"[Groups]^1 Congratulations! You joined the group^3 ^%s^1!"szGroups[item][id])
    }
    else if(
szKills[id] < szKillsNeeded[item]) {
        
ColorChat(idGREEN"[Groups]^1 You do not have enough kills to join this group!")
        
ColorChat(idGREEN"%s"szDescription[item][id])
    }
}
        
public 
SetKills(id) {
    
szKills[id] = 750

I don't know what i'm doing wrong.. But every time i join a server it prints out "Congratulations! You joined the group Beginners" for example. But the B of beginners is missing so it prints eginners. I have that with every single thing.

Also, when i talk in chat, it only displays 1 letter of the whole word...
Someone please help?
__________________

Last edited by Napoleon_be; 06-21-2012 at 12:49.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
 



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 06:06.


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