Raised This Month: $51 Target: $400
 12% 

Getting part of a StatusText?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 08-26-2007 , 00:12   Getting part of a StatusText?
Reply With Quote #1

What I'm trying to do is use StatusText to report what class a spy has disguised into. I have been using this very inefficient piece of code:

Code:
register_event("StatusText", "CLASS_SCOUT", "b", "2&#Spy_disguised Blue #Scout")
Is there a way to hook the message by ignoring the team's name, and only reading what class comes after it?
M249-M4A1 is offline
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 08-26-2007 , 12:33   Re: Getting part of a StatusText?
Reply With Quote #2

Here is just an example of getting what class a player disguised to.

PHP Code:
public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_event("StatusText""hook_StatusText""b""2&Spy_disguised");
}

public 
hook_StatusText(id)
{
    new 
arg2[64];
    
read_data(2arg263);
    
    if(
containi(arg2"Scout") != -1)
    {
        
// Disguised as Scout
    
}
    else if(
containi(arg2"Sniper") != -1)
    {
        
// Disguised as Sniper
    
}
    else if(
containi(arg2"Soldier") != -1)
    {
        
// Disguised as Soldier
    
}
    else if(
containi(arg2"Demoman") != -1)
    {
        
// Disguised as Demoman
    
}
    else if(
containi(arg2"Medic") != -1)
    {
        
// Disguised as Medic
    
}
    else if(
containi(arg2"HWGuy") != -1)
    {
        
// Disguised as HWGuy
    
}
    else if(
containi(arg2"Pyro") != -1)
    {
        
// Disguised as Pyro
    
}
    else if(
containi(arg2"Spy") != -1)
    {
        
// Disguised as Spy
    
}
    else if(
containi(arg2"Engineer") != -1)
    {
        
// Disguised as Engineer
    
}

hlstriker is offline
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 08-26-2007 , 17:39   Re: Getting part of a StatusText?
Reply With Quote #3

Thank you so much striker! I tried that same method first, but I never did the != -1 part! +Karma for your help!
M249-M4A1 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 20:52.


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