[HELP] #DEFINE Question
#1

How would i define 1 word as a variable?

ex:
Code:
new var[64];
format(var,64,"%s",username[playerid]); //in this case, R4nk3d
#define a "var"
So when I type print(var) it prints R4nk3d.
Reply
#2

Having a similar problem, any takers ?
Reply
#3

Quote:
Originally Posted by R4nk3d
How would i define 1 word as a variable?

ex:
Code:
new var[64];
format(var,64,"%s",username[playerid]); //in this case, R4nk3d
#define a "var"
So when I type print(var) it prints R4nk3d.
Code:
new var[64];
format(var,64,"%s",username[playerid]); //in this case, R4nk3d
print(var);
It already prints R4nk3d, doesn't it?
Reply
#4

i need to use it like this:
Code:
new var[64];
format(var,64,"%s",username[playerid]); //in this case, R4nk3d
#define a var
format(a,sizeof(a),"%s",field);
so i can put in say... Players[playerid][username] as the var string. define "a" as the var string. and then write a into pawno so the code reads, format(Players[playerid][username],sizeof(Players[playerid][username]),"%s",field); and not format(a,sizeof(a),"%s",field);

Get what I'm saying? It's hard for me to explain i think.
Reply
#5

#DEFINE A format(var,64,"%s",username[playerid]);

?
Reply
#6

no that wont work because itll output:

format(format(var,64,"%s",Players[playerid][username]),sizeof(format(var,64,"%s",Players[playerid][username])),"%s",field);
Reply
#7

Do you mean
pawn Code:
#define outputusername(%0) \
  print(playername[%0])

outputusername(playerid);
?
Reply
#8

yeah, i think so...
pawn Code:
#define var(%0,%1) \
  Players[%0][%1]

var(playerid,username)
would that work?
Reply
#9

Please explain more clearly.
Reply
#10

Quote:
Originally Posted by R4nk3d
yeah, i think so...
pawn Code:
#define var(%0,%1) \
  Players[%0][%1]

var(playerid,username)
would that work?
Try it?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)