One question for strings... -
DusanInfinity - 25.05.2016
Can we define 1 string on top of the script like this:
new globalstring[2500];
And use it for everything in script?
And is it possible to 2 players receive same message - string, ex:
1. player say /myname, and second say /myages, and both of them receive message for command /myages?(In both command we use this globalstring defined on top of the script)
Re: One question for strings... -
Konstantinos - 25.05.2016
You can, but it is not recommended:
https://sampforum.blast.hk/showthread.php?tid=491035
Re: One question for strings... -
Stinged - 25.05.2016
I remember ****** explaining why you shouldn't do that, just can't find the topic.
EDIT: Again.. Didn't reload the page, sorry.
Re: One question for strings... -
DusanInfinity - 25.05.2016
Thank you, but is it recommended to use global string for strings that are same for all players, like rules?
Re: One question for strings... -
BiosMarcel - 25.05.2016
Yes you can do that , it makes it a lot easier to change such messages but it takes a lil bit more memory since they have an unlimited lifetime , i wouldn't worry about that tho. But if you only need 50 letters only make it as big as you need it to be for 50 letters to fit in and not 2500, ok? ^^
Re: One question for strings... -
Konstantinos - 25.05.2016
That's fine I guess, making it also
const. Another possibility is to use static local as well.
Re: One question for strings... -
DusanInfinity - 25.05.2016
Quote:
Originally Posted by [Bios]Marcel
Yes you can do that , it makes it a lot easier to change such messages but it takes a lil bit more memory since they have an unlimited lifetime , i wouldn't worry about that tho. But if you only need 50 letters only make it as big as you need it to be for 50 letters to fit in and not 2500, ok? ^^
|
Server rules using 2000
Quote:
Originally Posted by Konstantinos
That's fine I guess, making it also const. Another possibility is to use static local as well.
|
Can you give me ex for that const and static local?
Re: One question for strings... -
BiosMarcel - 25.05.2016
Constant:
PHP код:
new const
CONSTANT_NUMBER = 2
static:
PHP код:
static
staticVar = 10;
Re: One question for strings... -
Konstantinos - 25.05.2016
pawn Код:
// global:
new const Rules[] = "... ... ...";
and
pawn Код:
// in a function:
static Rules[] = "... ... ...";
Re: One question for strings... -
DusanInfinity - 25.05.2016
Wait wait wait, if we have this rules:
(DM)Deathmatching:
Deathmatching means that you kill someone without a valid IC reason.
How to avoid Deathmatching: Have a good reason if you want to attack someone. Also RP with the person first or it will be KoS(explained below)
(MG)Metagaming:
Metagaming is using the information gained OOCly to influence an IC Situation
How to avoid metagaming: Don't use "lol","rofl","lmao" or any other internet shortcuts in IC Chat. (Normal Chat). To use those; type /b [text] and write them. Also if you'd like to talk in other Languages, other than English, Feel free to talk in /b.
And in global, i need to write:
Код:
new const Rules[] = "(DM)Deathmatching- Deathmatching means that you kill someone without a valid IC reason.
(MG)Metagaming: - Metagaming is using the information gained OOCly to influence an IC Situation"
or how?