How to write something in a VAR?
#1

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
Reply
#2

SendClientMessage(playerid, COLOR, "Hello");
Reply
#3

You need to add the number of cells for characters

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

Well you can define it to like:

pawn Code:
#define F_TEXT "Hello"

SendClientMessage(playerid,COLOR_RED,F_TEXT);
Reply
#5

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)