Raised This Month: $ Target: $400
 0% 

msg fix


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
omgdpcwtf
Member
Join Date: Apr 2011
Old 11-17-2014 , 06:57   msg fix
Reply With Quote #1

Hi, please I need a little fix, message which I had wrote will not show.

Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>
#include <fun>
#include <cstrike>
#include <engine>

new gidPlayer[33]

public plugin_init() {
    register_plugin("PM", "1.0", "AMXMODX");
    
    
    register_clcmd("say /mp", "cmdtest")
    register_clcmd("PM",     "player")
}

public cmdtest(id)
{
    new menu = menu_create("For Who?", "choose")
    
    new player2, players[ 32 ], num, name[32]
    get_players( players, num, "a" )
    for ( new i = 0; i < num; i++ )
    {
        player2 = players[i]
        get_user_name(player2, name, charsmax(name))
        menu_additem(menu, name, "", 0)
    }
    menu_display(id, menu, 0)
}

public choose(id, menu, item)
{
    if( item == MENU_EXIT )
    {
        menu_destroy(menu)
        return PLUGIN_HANDLED
    }
    
    new Data[6], Name[64]
    new Access, Callback
    menu_item_getinfo(menu, item, Access, Data,5, Name, 63, Callback)
    
    new player2 = str_to_num(Data)
 
    gidPlayer[id] = player2
    client_cmd(id, "messagemode PM")
    
    menu_destroy(menu)
    return PLUGIN_HANDLED
}

public player(id)
{
    new say[300]
    read_args(say, charsmax(say))
        
    remove_quotes(say)
        
    if(!is_str_num(say) || equal(say, ""))
        return PLUGIN_HANDLED
        
    msgpm(id, say)    
    
    return PLUGIN_CONTINUE
}

msgpm(id, say[]) {
    new amount = str_to_num(say)
    new victim = gidPlayer[id]
    
    new vname[32], vname2[32]
    get_user_name(victim, vname, 31)
    get_user_name(id, vname2, 31)
        
    client_print(id , print_chat, "[PM] for player %s: %s", vname, amount);
    client_print(victim, print_chat, "[PM] from player %s: %s", vname2, amount)    

    
}
omgdpcwtf is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 11-17-2014 , 07:38   Re: msg fix
Reply With Quote #2

amount is an integer, so change the last %s to %d in both strings.
__________________
hleV is offline
omgdpcwtf
Member
Join Date: Apr 2011
Old 11-17-2014 , 07:44   Re: msg fix
Reply With Quote #3

I changed and it works! But works only for number...how transfer it to text?
omgdpcwtf is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 11-17-2014 , 08:09   Re: msg fix
Reply With Quote #4

Transfer what to text? If you mean how to convert the Integer to a String, use num_to_str
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Eagle07
Veteran Member
Join Date: May 2014
Location: Morocco :D
Old 11-17-2014 , 08:17   Re: msg fix
Reply With Quote #5

Your can try this it's working ^^

https://forums.alliedmods.net/showpo...4&postcount=19
__________________
Eagle07 is offline
omgdpcwtf
Member
Join Date: Apr 2011
Old 11-17-2014 , 08:26   Re: msg fix
Reply With Quote #6

thank you all, it works
omgdpcwtf 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 17:43.


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