SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 01/12/2009, 08:53 PM   #1
tom_jonez
Huge Clucker
 
Join Date: Dec 2007
Posts: 219
Reputation: 0
Default [HELP] #DEFINE Question

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.
tom_jonez is offline  
Old 02/12/2009, 12:56 AM   #2
Byrner
Big Clucker
 
Join Date: Sep 2007
Posts: 133
Reputation: 2
Default Re: [HELP] #DEFINE Question

Having a similar problem, any takers ?
__________________
Pretty cool SA-MP server host https://evolution-host.com/GameOffers/?game=samp
Also providing VPS Hosting: https://evolution-host.com/vps-hosting.php
Byrner is offline  
Old 02/12/2009, 01:50 AM   #3
niCe
Huge Clucker
 
niCe's Avatar
 
Join Date: Mar 2008
Location: CZ
Posts: 391
Reputation: 428
Default Re: [HELP] #DEFINE Question

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?
__________________
[ENG] s2.gta-multiplayer.cz:7777 WTLS 2 (Singleplayer Features)
[ENG] s3.gta-multiplayer.cz:7777 WTLS 3 (Singleplayer Features)

- Pool, basketball, golf, Poker Texas Holdem, races and other minigames
- Video game QUB3D
- Roulette, blackjack, slots, video poker and horse-betting
- Stock market BAWSAQ
- Organizations and offices
- Missions from Big Smoke, Sweet, Zero, Cesar or Woozie!
- Gang wars
- More than 30 jobs (police, paramedic, firefighter, burglar, pimp, valet, pizza-boy and more)
- Gyms, strip clubs, clothes shops, hidden packages, oysters, spray tags, horseshoes and more
Watch the TRAILER
Servers are hosted at Evolution Host
niCe is offline  
Old 02/12/2009, 02:02 AM   #4
tom_jonez
Huge Clucker
 
Join Date: Dec 2007
Posts: 219
Reputation: 0
Default Re: [HELP] #DEFINE Question

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.
tom_jonez is offline  
Old 02/12/2009, 03:03 AM   #5
Giacomand
Big Clucker
 
Giacomand's Avatar
 
Join Date: Dec 2007
Posts: 93
Reputation: 0
Default Re: [HELP] #DEFINE Question

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

?
Giacomand is offline  
Old 02/12/2009, 03:11 AM   #6
tom_jonez
Huge Clucker
 
Join Date: Dec 2007
Posts: 219
Reputation: 0
Default Re: [HELP] #DEFINE Question

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);
tom_jonez is offline  
Old 02/12/2009, 03:40 AM   #7
yezizhu
Gangsta
 
yezizhu's Avatar
 
Join Date: Nov 2007
Location: Shenzhen,China
Posts: 640
Reputation: 2
Default Re: [HELP] #DEFINE Question

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

outputusername(playerid);
?
yezizhu is offline  
Old 02/12/2009, 07:42 PM   #8
tom_jonez
Huge Clucker
 
Join Date: Dec 2007
Posts: 219
Reputation: 0
Default Re: [HELP] #DEFINE Question

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

var(playerid,username)
would that work?
tom_jonez is offline  
Old 02/12/2009, 08:25 PM   #9
Malice
Big Clucker
 
Join Date: Jul 2007
Posts: 105
Reputation: 0
Default Re: [HELP] #DEFINE Question

Please explain more clearly.
Malice is offline  
Old 02/12/2009, 08:32 PM   #10
Streetplaya
Gangsta
 
Join Date: Nov 2007
Posts: 603
Reputation: 1
Default Re: [HELP] #DEFINE Question

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?
Streetplaya is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
gl_property define question Jochemd Help Archive 0 29/04/2010 03:17 PM
format and #define question toby` Help Archive 4 12/03/2010 12:42 PM
How do i define this?? HELP Arsham7 Help Archive 5 11/03/2010 07:31 PM
Using Colon instead of Paren. to define params in #define Daren_Jacobson Help Archive 1 05/11/2009 11:48 PM
[Solved] Using a #define in a #define Extremo Help Archive 6 16/10/2009 10:25 AM


All times are GMT. The time now is 12:38 PM.


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