Raised This Month: $ Target: $400
 0% 

saytext and /spec problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
naven
Veteran Member
Join Date: Jun 2008
Location: Poland, Cieszyn
Old 01-09-2013 , 03:54   saytext and /spec problem
Reply With Quote #1

Here is my code
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"


new points[33];

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /rank","check")
    
register_message(get_user_msgid("SayText"),"handleSayText");

}

public 
handleSayText(msgId,msgDest,msgEnt)
{
    new 
id get_msg_arg_int(1);
    if(!
is_user_connected(id))      return PLUGIN_CONTINUE;
    new 
szTmp[256],szTmp2[256];
    
get_msg_arg_string(2,szTmpcharsmaxszTmp ) )
        
    
points[id] = 10;
    new 
szPrefix[64]
    
format(szPrefix63"^x04(%i)",points[id])
    
//new szPrefix[64] = "^x04[VIP]";
        
    
if(!equal(szTmp,"#Cstrike_Chat_All"))
    {        
        
add(szTmp2,charsmax(szTmp2),szPrefix);
        
add(szTmp2,charsmax(szTmp2)," ");
        
add(szTmp2,charsmax(szTmp2),szTmp);//msg
        
    
}
    else if(
equal(szTmp,"#Cstrike_Chat_AllSpec"))// || ( equal(szTmp, "#Cstrike_Chat_Spec") ) )
    
{
        
add(szTmp2,charsmax(szTmp2),szPrefix);
        
add(szTmp2,charsmax(szTmp2),"^x03 %s1^x01: %s2");        
    }
        
add(szTmp2,charsmax(szTmp2),szPrefix);
        
add(szTmp2,charsmax(szTmp2),"^x03 %s1^x01: %s2");
    }
        
    
set_msg_arg_string(2,szTmp2);
        
     
    return 
PLUGIN_CONTINUE;

On my server everyone can see every message from every player. This code works fine, unless I go spectator, then when someone alive is writing, tag won't show up and vice versa. I've tried many things and couldn't get it to work, how do I fix this?

Also I've got another problem.
I've found this code http://forums.alliedmods.net/showpos...61&postcount=7
It was working fine but I've discovered that going spec sometimes blocks the player that I am spectating, it's like I spawn inside spectated player and he can't move. After player is blocked this way it says enemy: playername like he was aiming at me.

Here is the code i'm using right now
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <fun>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /spec","setSpectate")

}

public 
setSpectateid 
{

    if(
get_cvar_num("surf_allow_spectate") == 1)
    {
        if( !
is_user_alive(id) ) 
        {
            
cs_set_user_team(idCS_TEAM_CTCS_CT_GIGN);
            
dllfunc(DLLFunc_Spawnid);
            return 
PLUGIN_HANDLED;
        }
        else if( 
is_user_alive(id) ) 
        {         
            
strip_user_weapons(id
            
set_pev(idpev_deadflagDEAD_DEAD
        } 
        
engclient_cmd(id"jointeam" "6"//connormcleod
    
}
    else
    {
        
client_print(idprint_chat"%L",LANG_PLAYER,"NO_USE")
    }
    return 
PLUGIN_HANDLED;

__________________
naven.com.pl
"At the end of the day, there are always going to be mental disorders and people who cause violence for no other reason than the fact that they're fucked up and lost. And all we can do is try to learn from it." Corey Taylor.
naven is offline
Old 01-10-2013, 09:13
naven
This message has been deleted by YamiKaitou. Reason: wait 14 days before you bump
naven
Veteran Member
Join Date: Jun 2008
Location: Poland, Cieszyn
Old 01-24-2013 , 10:11   Re: saytext and /spec problem
Reply With Quote #2

Any ideas? I need to solve this spectator thing. What i want is when player says /spec he is automatically watching another player in first person view and not free look.
__________________
naven.com.pl
"At the end of the day, there are always going to be mental disorders and people who cause violence for no other reason than the fact that they're fucked up and lost. And all we can do is try to learn from it." Corey Taylor.
naven is offline
AngeIII
Senior Member
Join Date: Sep 2007
Location: Latvia
Old 01-24-2013 , 13:24   Re: saytext and /spec problem
Reply With Quote #3

didn't see "check" function btw.

also:
add(szTmp2,charsmax(szTmp2),"^x03 %s1^x01: %s2");
}
add(szTmp2,charsmax(szTmp2),szPrefix);
add(szTmp2,charsmax(szTmp2),"^x03 %s1^x01: %s2");
incorrect formatting
("%s %s %s",strin_1,strin_2...)


__________________
skype: pavle_ivanof
-=ThQ=-
PRIVATE SUPPORT = PAID SUPPORT
AngeIII is offline
Send a message via Skype™ to AngeIII
naven
Veteran Member
Join Date: Jun 2008
Location: Poland, Cieszyn
Old 01-27-2013 , 08:38   Re: saytext and /spec problem
Reply With Quote #4

Quote:
Originally Posted by AngeIII View Post
didn't see "check" function btw.
Oh, well, I forgot to remove it.

What's wrong about this formatting? I do not understand what you mean. It's working, but I need that to work along with modified admin listen(removed admin access- everyone can see everything).
__________________
naven.com.pl
"At the end of the day, there are always going to be mental disorders and people who cause violence for no other reason than the fact that they're fucked up and lost. And all we can do is try to learn from it." Corey Taylor.
naven is offline
AngeIII
Senior Member
Join Date: Sep 2007
Location: Latvia
Old 01-27-2013 , 13:48   Re: saytext and /spec problem
Reply With Quote #5

you should write variables..
you write %s1,%s2.. but it's wrong.
for string always: %s
and any of them you should define in variables section.

and also ADD procedure doesn't include formatting.

you should use format/formatex() before.

examle:
PHP Code:
format(str,charsmax(str),"Some value to add %s first variable, %s second",first_variable,second_variable);
add(szTmp2,charsmax(szTmp2),str); 
__________________
skype: pavle_ivanof
-=ThQ=-
PRIVATE SUPPORT = PAID SUPPORT
AngeIII is offline
Send a message via Skype™ to AngeIII
naven
Veteran Member
Join Date: Jun 2008
Location: Poland, Cieszyn
Old 01-27-2013 , 14:28   Re: saytext and /spec problem
Reply With Quote #6

Anyway, I have solved the problem just now. I modified this plugin http://forums.alliedmods.net/showthread.php?t=183491 instead, seems to be working fine. Thank you for your help.

Can you see anything wrong with /spec code?
__________________
naven.com.pl
"At the end of the day, there are always going to be mental disorders and people who cause violence for no other reason than the fact that they're fucked up and lost. And all we can do is try to learn from it." Corey Taylor.
naven 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 13:43.


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