SA-MP Forums Archive
How to write something in a VAR? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to write something in a VAR? (/showthread.php?tid=151256)



How to write something in a VAR? - Ihsan_Cingisiz - 29.05.2010

Hello,
How can i use, new text = "Hello" <--- I don't know how i can do this.

Quote:

#include <a_samp>

I think it must here,
new text = "Hello" or Hello, i want to put a text in it.

main()

Quote:

public OnGameModeInit()
{
SendClientMessage(playerid, COLOR_RED, text);
return 1;
}

How can i do this, i'm really confused, i thought this is the same
as C++, but .. I'm very confused. So i want to put a text in
new text;
Thanks


Re: How to write something in a VAR? - IcyBlight - 29.05.2010

SendClientMessage(playerid, COLOR, "Hello");


Re: How to write something in a VAR? - MadeMan - 29.05.2010

You need to add the number of cells for characters

pawn Code:
new text[32] = "Hello";



Re: How to write something in a VAR? - Julian2574 - 29.05.2010

Well you can define it to like:

pawn Code:
#define F_TEXT "Hello"

SendClientMessage(playerid,COLOR_RED,F_TEXT);



Re: How to write something in a VAR? - Calgon - 29.05.2010

Or, simply:

pawn Code:
SendClientMessage(playerid, color, "Message here.");
However, if you need to use a variable in a string, then you'll need to create a string and format it:

pawn Code:
new String[6], lol = 6; // New variables are integers by default, you need to set a cell size.
format(String, sizeof(String), "hello%d", lol ); // lol is an integer with the value of 6. The message will be "hello6"
SendClientMessage(playerid, color, string); // Sending the string.