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

string replace


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Alexunder
Member
Join Date: Jun 2018
Old 07-17-2018 , 17:47   string replace
Reply With Quote #1

hi guys
my script :
Code:
public OnPluginStart()
{
RegConsoleCmd("test", testCmd);
}

public Action:testCmd(client, args)
{
    PrintToChat(client, "The weather is cool today");
}
i want to change "cool" to "hot" , i need search word in the variable

can you help me ?
Alexunder is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 07-17-2018 , 18:08   Re: string replace
Reply With Quote #2

Lets start by properly indenting your code and using the new syntax.

Code:
public void OnPluginStart()
{
	RegConsoleCmd("test", testCmd);
}

public Action testCmd(int client, int args)
{
	PrintToChat(client, "The weather is cool today");
}
Here is the info you need.

http://www.sourcemod.net/new-api/string/ReplaceString
__________________
Neuro Toxin is offline
Alexunder
Member
Join Date: Jun 2018
Old 07-18-2018 , 01:45   Re: string replace
Reply With Quote #3

Quote:
Originally Posted by Neuro Toxin View Post
Lets start by properly indenting your code and using the new syntax.

Code:
public void OnPluginStart()
{
	RegConsoleCmd("test", testCmd);
}

public Action testCmd(int client, int args)
{
	PrintToChat(client, "The weather is cool today");
}
Here is the info you need.

http://www.sourcemod.net/new-api/string/ReplaceString
thx man , this is my script :
Code:
public Action:thetimeCmd(client, args)
{
    decl String:ctime[64];
    FormatTime(ctime, 64, NULL_STRING);
    PrintToChat(client, "\x01 \x04[SM]\x01 Time : \x04 %s", ctime);
}
Result : [SM] Time : 2018/07/18 11:11

i want to exchange "07" to "09" ok ?
i don't have problem for set time zone , i just want replace (fun) .

can you help me ?
Alexunder is offline
LenHard
Senior Member
Join Date: Jan 2016
Old 07-18-2018 , 04:39   Re: string replace
Reply With Quote #4

Quote:
Originally Posted by Alexunder View Post
thx man , this is my script :
Code:
public Action:thetimeCmd(client, args)
{
    decl String:ctime[64];
    FormatTime(ctime, 64, NULL_STRING);
    PrintToChat(client, "\x01 \x04[SM]\x01 Time : \x04 %s", ctime);
}
Result : [SM] Time : 2018/07/18 11:11

i want to exchange "07" to "09" ok ?
i don't have problem for set time zone , i just want replace (fun) .

can you help me ?
PHP Code:
public Action Cmd_Time(int clientint args)
{
    if (
client <= MaxClients && IsClientInGame(client))
    {
        
char[] sTime = new char[64];
        
FormatTime(sTime64NULL_STRING);
        
ReplaceString(sTime64"/07/""/09/");
        
PrintToChat(client" \x04[SM]\x01 Time: \x04%s"sTime);
    }
    return 
Plugin_Handled;

__________________
LenHard is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 07-18-2018 , 07:26   Re: string replace
Reply With Quote #5

I'd use unixtime_sourcemod.inc
mug1wara 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 18:36.


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