[HELP] #DEFINE Question -
tom_jonez - 01.12.2009
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.
Re: [HELP] #DEFINE Question -
Byrner - 02.12.2009
Having a similar problem, any takers ?
Re: [HELP] #DEFINE Question -
niCe - 02.12.2009
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?
Re: [HELP] #DEFINE Question -
tom_jonez - 02.12.2009
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.
Re: [HELP] #DEFINE Question -
Giacomand - 02.12.2009
#DEFINE A format(var,64,"%s",username[playerid]);
?
Re: [HELP] #DEFINE Question -
tom_jonez - 02.12.2009
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);
Re: [HELP] #DEFINE Question -
yezizhu - 02.12.2009
Do you mean
pawn Code:
#define outputusername(%0) \
print(playername[%0])
outputusername(playerid);
?
Re: [HELP] #DEFINE Question -
tom_jonez - 02.12.2009
yeah, i think so...
pawn Code:
#define var(%0,%1) \
Players[%0][%1]
var(playerid,username)
would that work?
Re: [HELP] #DEFINE Question -
Malice - 02.12.2009
Please explain more clearly.
Re: [HELP] #DEFINE Question -
Streetplaya - 02.12.2009
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?