Strings - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Strings (
/showthread.php?tid=520332)
Strings -
Bek_Loking - 18.06.2014
Hi! I'm somewhat new at scripting and I do not know very much. I know nice sort of things in dialogs and commands but the thing I don't understand almost at all is strings.
There are some ID's of strings, aren't there? like string[254] etc etc. Can someone explain how strings work and what are they used for?
Re: Strings -
Konstantinos - 18.06.2014
The number in the square brackets is the size of the string. With 254, it can hold up to 253 characters + NULL.
For more read:
https://sampwiki.blast.hk/wiki/Scripting_Basics#Strings
https://sampforum.blast.hk/showthread.php?tid=284112
Re: Strings -
Rittik - 18.06.2014
Strings are sequence of characters in a
sentence/word. For example:
Hello My Name is Rittik -is an example of
String.Each letter used in this sentence is know as characters.
letters from 'A-Z' , '0-9', and some special characters like '.' , ',', '*' etc. -is an example of
Character.
Re: Strings -
Bek_Loking - 18.06.2014
Holy moly in a dolly ****** replied
Re: Strings -
Chillstep - 18.06.2014
Strings work like this:
Say that you want to make a DIALOG that says Welcome back to the server (Playername).
What you're going to do is:
Код:
new string[128], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "Welcome back to the server, %s", name);
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "Server Name", str, "Login", "Cancel");
Make sure you always use [128] as your string because using [256] or any long length is just waste of memory.