Is it possible..
#1

.. to create a formatted variable (new).

I want to write something like
pawn Код:
format(pName,128,"%s",ReturnName(playerid));
new pName;
and compiler should understand it as
pawn Код:
new Firstname_Lastname;
Reply
#2

I'm not sure, maybe it's possible using preprocessor, but I'm still not sure...
Anyway, in these kind of cases it's always a good option to use arrays and enums.
Reply
#3

new PFirstName[MAX_PLAYER_NAME];
new PLastName[MAX_PLAYER_NAME];
new name[MAX_PLAYER_NAME];

format(name,sizeof(name),"%s_%s",PFirstName,PLastN ame);

SetPlayerName(playerid,name);


Make your changes depending on your saving sys !
Reply
#4

Quote:
Originally Posted by RaFsTar[PT
]
new PFirstName[MAX_PLAYER_NAME];
new PLastName[MAX_PLAYER_NAME];
new name[MAX_PLAYER_NAME];

format(name,sizeof(name),"%s_%s",PFirstName,PLastN ame);

SetPlayerName(playerid,name);


Make your changes depending on your saving sys !
You probably don't get the point of this.
I don't want to do Firstname_Lastname, it's just example.
Reply
#5

Quote:
Originally Posted by Luka™
Quote:
Originally Posted by RaFsTar[PT
]
new PFirstName[MAX_PLAYER_NAME];
new PLastName[MAX_PLAYER_NAME];
new name[MAX_PLAYER_NAME];

format(name,sizeof(name),"%s_%s",PFirstName,PLastN ame);

SetPlayerName(playerid,name);


Make your changes depending on your saving sys !
You probably don't get the point of this.
I don't want to do Firstname_Lastname, it's just example.
Nobody got the "point" you want ..
Reply
#6

Quote:
Originally Posted by RaFsTar[PT
]
Quote:
Originally Posted by Luka™
Quote:
Originally Posted by RaFsTar[PT
]
new PFirstName[MAX_PLAYER_NAME];
new PLastName[MAX_PLAYER_NAME];
new name[MAX_PLAYER_NAME];

format(name,sizeof(name),"%s_%s",PFirstName,PLastN ame);

SetPlayerName(playerid,name);


Make your changes depending on your saving sys !
You probably don't get the point of this.
I don't want to do Firstname_Lastname, it's just example.
Nobody got the "point" you want ..
Really, Zamaroth answer in 3 minutes... I think he get the point..
But you probably don't know what means formatted, variable, and other shit
Don't be too smart
Reply
#7

new pName gets replaced and will be seen as new realplayername what is so hard to understand by that?

Sorry, but I'm not experienced in this, just wanted to post the thing above.
Reply
#8

Quote:
pawn Код:
format(pName,128,"%s",ReturnName(playerid));
new pName;
You can't do this because pName is not an array.
Reply
#9

Quote:
Originally Posted by KnooL
new pName gets replaced and will be seen as new realplayername what is so hard to understand by that?

Sorry, but I'm not experienced in this, just wanted to post the thing above.
Yeah, true. pName is just example, I was asking if is possible to create a formatted variable (so it should work like a macro).

EDIT: MenaceX, I know it isn't possible by doing
pawn Код:
format(pName,128,"%s",ReturnName(playerid));
new pName;
But I'm asking if there is any way to do it.
Reply
#10

It isn't because variable is just readable reference to memory location where data is. You can get variable as value or as reference.
Reply
#11

Quote:
Originally Posted by JoeBullet
It isn't because variable is just readable reference to memory location where data is. You can get variable as value or as reference.
Okay, thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)