Raised This Month: $ Target: $400
 0% 

[CSGO] Replace String dosen't work...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
cristian20042
AlliedModders Donor
Join Date: Jun 2016
Location: Romania
Old 01-08-2017 , 09:06   [CSGO] Replace String dosen't work...
Reply With Quote #1

Hello ! The replacestring dosen't work... here is my string :

PHP Code:
public Action:SayHook(client, const String:command[], args)  
{    
    new 
String:text[192];  
    
GetCmdArgString(textsizeof(text));  

    new 
startidx 0;  
    if (
text[0] == '"'){  
        
startidx 1;  

        new 
len strlen(text);  
        if (
text[len-1] == '"') {  
            
text[len-1] = '\0';  
        }  
    }  

    if(
StrContains(text[startidx], "sound"false)!=-1){  
        
EmitSoundToAllAny("misc/soundtest.mp3");
        
ReplaceString(textsizeof(text), "sound""SOUND"false);
    }

I tried with the default of case sensitive true but it dosen't work.. HELP !

Last edited by cristian20042; 01-08-2017 at 09:07.
cristian20042 is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 01-08-2017 , 09:50   Re: [CSGO] Replace String dosen't work...
Reply With Quote #2

You aren't doing anything with text after calling ReplaceString...
__________________
asherkin is offline
cristian20042
AlliedModders Donor
Join Date: Jun 2016
Location: Romania
Old 01-08-2017 , 10:02   Re: [CSGO] Replace String dosen't work...
Reply With Quote #3

Quote:
Originally Posted by asherkin View Post
You aren't doing anything with text after calling ReplaceString...
How i don't do anything ? please explain me detalied....

EDIT : What i want exatly to do it's to edit the word sound in the message of chat...

Last edited by cristian20042; 01-08-2017 at 10:26.
cristian20042 is offline
hadesownage
AlliedModders Donor
Join Date: Jun 2013
Location: Romania, Iași
Old 01-08-2017 , 23:27   Re: [CSGO] Replace String dosen't work...
Reply With Quote #4

If you want to print the text after you replace it, you need to print it again and to disable the current massage (Plugin_Handled)
hadesownage is offline
Send a message via Yahoo to hadesownage Send a message via Skype™ to hadesownage
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 01-09-2017 , 11:17   Re: [CSGO] Replace String dosen't work...
Reply With Quote #5

Why do you still insist on using RegConsoleCmd / AddCommandListener ???

Why don't you just use [Any] Chat-Processor or Simple Chat Processor (Redux) for this kind of stuff?
__________________
Plugins: TeamGames
Includes: Menu stocks, ColorVariables, DownloadTableConfig

> No help through PM, make a topic.
KissLick 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:58.


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