AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Replacing problem (https://forums.alliedmods.net/showthread.php?t=26142)

SlimDog 03-27-2006 15:00

Replacing problem
 
Let's say i have

Code:
get_user_name(krcid,veikejas,32)

So veikejas = players name.

Now I'm geeting a line from .ini file wich may have <nick> text in it. I want that text <nick> would be replaced with veikejas.

I tried
Code:
replace(message, 130, "<nick>", veikejas)

But it still won't replace anything... I thought it could be bad that "<nick>" is in commas so i deleted them and leaved

Code:
replace(message, 130, <nick>, veikejas)

But then i get compile errors...

If someone could help... HELP! :D

BadAim 03-27-2006 16:12

man if you want to chnage the name of your players just use
AMX_NICK "the current name" "the name u want"

Hawk552 03-27-2006 16:58

Umm, not quite sure what your question is. You format strings like this:

Code:
new szName[33] get_user_name(id,szName,32) replace(szMyStr,127,"<name>",szName)

Also, you cannot pass direct data to act like a string. The compiler has no way of knowing whether you expect a variable / command or a string. So this would work:

Code:
 replace(message, 130, "<nick>", veikejas)

But this would not:
Code:
 replace(message, 130, <nick>, veikejas)

As per your question though, are you sure the inputted section has brackets ( < and > ) around it?

BadAim 03-27-2006 17:22

lol listen to him hes a beta tester and im a noob

Xanimos 03-27-2006 17:35

Quote:

Originally Posted by CoKsUcKer
lol listen to him hes a beta tester and im a noob

Just because someone is a beta tester doesn't mean that they know a lot about scripting. However Hawk does know about scripting.

SlimDog 03-27-2006 23:39

Quote:

Originally Posted by Hawk552
Umm, not quite sure what your question is. You format strings like this:

Code:
new szName[33] get_user_name(id,szName,32) replace(szMyStr,127,"<name>",szName)

Also, you cannot pass direct data to act like a string. The compiler has no way of knowing whether you expect a variable / command or a string. So this would work:

Code:
 replace(message, 130, "<nick>", veikejas)

But this would not:
Code:
 replace(message, 130, <nick>, veikejas)

As per your question though, are you sure the inputted section has brackets ( < and > ) around it?

Yes I'm sure.. Thanks for help... I'll try replace <nick> with constant setted with that nick or remove < > from replacement.


All times are GMT -4. The time now is 16:29.

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