SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   Help Archive (https://forum.sa-mp.com/forumdisplay.php?f=89)
-   -   How to write something in a VAR? (https://forum.sa-mp.com/showthread.php?t=151256)

Ihsan_Cingisiz 29/05/2010 08:02 PM

How to write something in a VAR?
 
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

IcyBlight 29/05/2010 08:07 PM

Re: How to write something in a VAR?
 
SendClientMessage(playerid, COLOR, "Hello");

MadeMan 29/05/2010 08:21 PM

Re: How to write something in a VAR?
 
You need to add the number of cells for characters

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

Julian2574 29/05/2010 08:23 PM

Re: How to write something in a VAR?
 
Well you can define it to like:

pawn Code:
#define F_TEXT "Hello"

SendClientMessage(playerid,COLOR_RED,F_TEXT);

Calgon 29/05/2010 08:24 PM

Re: How to write something in a VAR?
 
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.


All times are GMT. The time now is 09:44 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.