Raised This Month: $ Target: $400
 0% 

Native: set_speak PROBLEM... [SOLVED]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bello
BANNED
Join Date: Jun 2010
Old 06-15-2010 , 00:33   Native: set_speak PROBLEM... [SOLVED]
Reply With Quote #1

Hi friends i have this code:

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>

new const plugin_author[] = "Bello"
new const plugin_name[] = "MUTE PLAYER"
new const plugin_version[] = "1.0"

#define MUTED 2

new const Muted[MUTED][] = {
    
"[no comm]",
    
" [no comm]"
}

new Array:
Muteados
new Direccion[46]

new 
bool:MsgMutedChat

public plugin_init() {
    
register_plugin(plugin_nameplugin_versionplugin_author)
    
register_concmd(".mute""cmdMute"ADMIN_RCON"<name>")
    
register_concmd(".unmute""cmdUnmute"ADMIN_RCON"<name>")
    
    new 
sConfig[32]
    
get_configsdir(sConfigsizeof(sConfig)-1)
    
formatex(Direccionsizeof(Direccion)-1"%s/mute.ini"sConfig)

    
register_clcmd("say","handle_say")
    
register_clcmd("say_team","handle_say")

    
register_message(get_user_msgid("SayText"), "MessageNameChange")

    
Muteados ArrayCreate(321)
    
    
Cargar_ini()
}

public 
client_putinserver(id) {
    if(!
file_exists(Direccion)) return
    
    new 
ID[28], sName[32]
    
get_user_authid(idIDsizeof(ID)-1)
    
get_user_name(idsNamesizeof(sName)-1)
    
    new 
lines file_size(Direccion,1)
    new 
file[1024], len
    
    
for(new i=0i<=linesi++) {
        
read_file(Direccionfile1023len)
        
        if(
equal(IDfile)) {
            
set_speak(id1)
            
            if(!(
contain(sNameMuted[0]) != -1)) {
                
add(sNamesizeof(sName)-1Muted[1])
                
set_user_info(id"name"sName)
                
MsgMutedChat true
                
break
            }
        }
    }
}

public 
cmdMute(idlevelcid) {
    if(!
cmd_access(idlevelcid2)) return 1
    
    
new Argv[32]
    
read_argv(1Argvsizeof(Argv)-1)
    
    new 
player cmd_target(idArgv3)
    
    new 
ID[28], sName[32]
    
get_user_authid(playerIDsizeof(ID)-1)
    
get_user_name(playersNamesizeof(sName)-1)
    
    new 
lines file_size(Direccion,1)
    new 
file[1024], len
    
    
for(new i=0i<=linesi++) {
        
read_file(Direccionfile1023len)
        
        if(
equal(IDfile)) {
            
console_print(id"El SteamID: %s, ya esta en la lista"ID)
            return 
1
        
}
    }

    
MsgMutedChat true
    set_speak
(player1)    

    new 
NAME[32]
    
get_user_name(playerNAMEsizeof(NAME)-1)
    
client_print(0print_chat"[ESVE Pug] %s ha sido muteado."NAME)
    
    
write_file(DireccionID)
    
console_print(id"Usuario muteado: %s^nSe ha agregado el SteamID: %s"sNameID)
    
    if(!(
contain(sNameMuted[0]) != -1)) {
        
add(sNamesizeof(sName)-1Muted[1])
        
set_user_info(player"name"sName)
    }
    return 
1
}

public 
cmdUnmute(idlevelcid) {
    if(!
cmd_access(idlevelcid2)) return 
    
    
new Argv[32]
    
read_argv(1Argvsizeof(Argv)-1)
    
    new 
player cmd_target(idArgv3)
    
    new 
ID[28], sName[32]
    
get_user_authid(playerIDsizeof(ID)-1)
    
get_user_name(playersNamesizeof(sName)-1)

    
MsgMutedChat true

    
new NAME[32]
    
get_user_name(playerNAMEsizeof(NAME)-1)
    
client_print(0print_chat"[ESVE Pug] %s ha sido desmuteado."NAME)
    
    new 
lines file_size(Direccion1)
    new 
file[1024], len
    
    
for(new i=0i<=linesi++) {
        
read_file(Direccionfile1023len)
        
        if(
equal(IDfile)) {
            
set_speak(player0)
            
write_file(Direccion""i)
            
console_print(id"Cliente: %s ha sido desmuteado^nSteamID: %s, ha sido removido"sNameID)
            
            if(
contain(sNameMuted[0]) != -1) {
                
replace_all(sNamesizeof(sName)-1Muted[1], "")
                
set_user_info(player"name"sName)
                break
            }
        }
    }
    return 
1
}    
    
public 
Cargar_ini() {
    if(!
file_exists(Direccion)) return
    
    new 
linea[128], file fopen(Direccion"rt")
        
    while(
file && !feof(file)) {
        
fgets(filelinea127)
        
replace(linea127"^n""")
            
        if((
linea[0] == '/' && linea[1] == '/') || linea[0] == ';' || strlen(linea) < 1) continue
        
ArrayPushString(Muteadoslinea)
    }

    if(
filefclose(file)
}

public 
handle_say(id) {
    new 
ID[28]
    
get_user_authid(idIDsizeof(ID)-1)
    
    new 
lines file_size(Direccion1)
    new 
file[1024], len
    
    
for(new i=0i<=linesi++) {
        
read_file(Direccionfile1023len)
        
        if(
equal(IDfile)) {
            
client_print(idprint_chat"")
            return 
PLUGIN_HANDLED_MAIN
            
}
    }
    return 
PLUGIN_CONTINUE
}

public 
client_infochanged(id) {
    static 
sName[32], NewName[32], ID[28]
    
get_user_name(idsNamesizeof(sName)-1)
    
get_user_info(id"name"NewNamesizeof(NewName)-1)
    
get_user_authid(idIDsizeof(ID)-1)
    
    if(!
equali(sNameNewName)) {
        new 
lines file_size(Direccion,1)
        new 
file[1024], len
    
        
for(new i=0i<=linesi++) {
            
read_file(Direccionfile1023len)
        
            if(
equal(IDfile)) {
                
set_speak(id1)
            
                if(!(
contain(NewNameMuted[0]) != -1)) {
                    
add(NewNamesizeof(sName)-1Muted[1])
                    
set_user_info(id"name"NewName)
                    break
                }
            }
        }
    }
}

public 
MessageNameChange(msg_idmsg_destreceiver) {
    if(
MsgMutedChat) {
        new 
szInfo[64]
        
get_msg_arg_string(2szInfo63)

        if(!
equali(szInfo"#Cstrike_Name_Change")) return 0

        MsgMutedChat 
false
        
return 1
    
}
    return 
0

The problem is this:

Code:
L 06/14/2010 - 23:57:39: Start of error session.
L 06/14/2010 - 23:57:39: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20100614.log")
L 06/14/2010 - 23:57:39: [ENGINE] Invalid player 1
L 06/14/2010 - 23:57:39: [AMXX] Displaying debug trace (plugin "yap_mute.amxx")
L 06/14/2010 - 23:57:39: [AMXX] Run time error 10: native error (native "set_speak")
L 06/14/2010 - 23:57:39: [AMXX]    [0] yap_mute.sma::client_infochanged (line 198)
I have not able to fix this problem, as could fix it?
Bello is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 06-15-2010 , 01:00   Re: CODE PROBLEM...
Reply With Quote #2

mMM, i am not sure, but try with this:

PHP Code:
if(is_user_connected(id) )
    
set_speak(id1
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
Bello
BANNED
Join Date: Jun 2010
Old 06-16-2010 , 20:20   Re: CODE PROBLEM...
Reply With Quote #3

No, the problem this is in infochanged...

PHP Code:
public client_infochanged(id) {
    static 
sName[32], NewName[32], ID[28]
    
get_user_name(idsNamesizeof(sName)-1)
    
get_user_info(id"name"NewNamesizeof(NewName)-1)
    
get_user_authid(idIDsizeof(ID)-1)
    
    if(!
equali(sNameNewName)) {
        new 
lines file_size(Direccion,1)
        new 
file[1024], len
    
        
for(new i=0i<=linesi++) {
            
read_file(Direccionfile1023len)
        
            if(
equal(IDfile)) {
                
set_speak(id1)
            
                if(!(
contain(NewNameMuted[0]) != -1)) {
                    
add(NewNamesizeof(sName)-1Muted[1])
                    
set_user_info(id"name"NewName)
                    break
                }
            }
        }
    }

Code:
L 06/14/2010 - 23:57:39: Start of error session.
L 06/14/2010 - 23:57:39: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20100614.log")
L 06/14/2010 - 23:57:39: [ENGINE] Invalid player 1
L 06/14/2010 - 23:57:39: [AMXX] Displaying debug trace (plugin "yap_mute.amxx")
L 06/14/2010 - 23:57:39: [AMXX] Run time error 10: native error (native "set_speak")
L 06/14/2010 - 23:57:39: [AMXX]    [0] yap_mute.sma::client_infochanged (line 198)
who can help with this
Bello is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-16-2010 , 22:42   Re: CODE PROBLEM...
Reply With Quote #4

The suggestion is a good one, you should check if the user is connected before doing anything in infochanged.

Show the code that you tried because I'm pretty sure that you did it wrong (if you did anything at all other that ASSUME).
__________________
fysiks is offline
Bello
BANNED
Join Date: Jun 2010
Old 06-16-2010 , 23:04   Re: CODE PROBLEM...
Reply With Quote #5

The code is that this in the post #1, The client_info_changed is used only when the user changes its name is muted.

I can't use this:

PHP Code:
if(is_user_connected(id) )
    
set_speak(id1
Since that part of the code is scheduled in client_putinserver...

As i can solve the problem that this in infochanged?

P.S: The other part of the code works to the perfection
Bello is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-17-2010 , 00:18   Re: CODE PROBLEM...
Reply With Quote #6

Quote:
Originally Posted by Bello View Post
The code is that this in the post #1, The client_info_changed is used only when the user changes its name is muted.

I can't use this:

PHP Code:
if(is_user_connected(id) )
    
set_speak(id1
Since that part of the code is scheduled in client_putinserver...

As i can solve the problem that this in infochanged?

P.S: The other part of the code works to the perfection
Ok, seriously, just do what he said. client_infochanged it called before the person is actually connected!
__________________
fysiks is offline
Bello
BANNED
Join Date: Jun 2010
Old 06-17-2010 , 00:29   Re: Native: set_speak PROBLEM...
Reply With Quote #7

Ok then what place as said alucard?
Bello is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-17-2010 , 00:35   Re: Native: set_speak PROBLEM...
Reply With Quote #8

Quote:
Originally Posted by Bello View Post
Ok then what place as said alucard?
Wow, this is sad. You can either do what he said or do this:

PHP Code:
public client_infochanged(id)
{
    if( 
is_user_connected(id) )
    {
        static 
sName[32], NewName[32], ID[28]
        
get_user_name(idsNamesizeof(sName)-1)
        
get_user_info(id"name"NewNamesizeof(NewName)-1)
        
get_user_authid(idIDsizeof(ID)-1)
        
        if(!
equali(sNameNewName))
        {
            new 
lines file_size(Direccion,1)
            new 
file[1024], len
        
            
for(new i=0i<=linesi++)
            {
                
read_file(Direccionfile1023len)
            
                if(
equal(IDfile))
                {
                    
set_speak(id1)
                
                    if(!(
contain(NewNameMuted[0]) != -1))
                    {
                        
add(NewNamesizeof(sName)-1Muted[1])
                        
set_user_info(id"name"NewName)
                        break
                    }
                }
            }
        }
    }

Mine is more efficient.
__________________
fysiks is offline
Bello
BANNED
Join Date: Jun 2010
Old 06-17-2010 , 00:59   Re: Native: set_speak PROBLEM... [SOLVED]
Reply With Quote #9

thanks fysiks You can revise this post?

https://forums.alliedmods.net/showth...81#post1210981
Bello is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 06-17-2010 , 01:35   Re: Native: set_speak PROBLEM... [SOLVED]
Reply With Quote #10

Quote:
Originally Posted by Bello View Post
thanks fysiks You can revise this post?

https://forums.alliedmods.net/showth...81#post1210981
Has anyone else noticed yet, or is it just me?
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Reply



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


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