PDA

View Full Version : Multiple functions in one line (is it possible?)


Sellize
13/03/2015, 09:56 AM
I did this
new IP[16]; GetPlayerIp(playerid, IP, sizeof(IP));
and it returned no errors when I compiled.

Does this mean it's possible to use multiple functions in one line?

shourya12
13/03/2015, 10:08 AM
i guess so..

Pottus
13/03/2015, 10:13 AM
Technically your entire script is just one line.

Kaliber
13/03/2015, 10:14 AM
Does this mean it's possible to use multiple functions in one line?

Sure, you can do even this:

new x;
if(!x) print("hi"),print("hi again");

Sellize
13/03/2015, 10:21 AM
Alright, learned something new then :D

Thanks!

Golf
13/03/2015, 10:42 AM
or i have antoher thing

#define \
SayText(%0,%1,%2);\
SendClientMessage(%0,%1,%2);\
SendClientMessage(%0,%1,%2);\
SendClientMessage(%0,%1,%2);

SayText(playerid,color,text);


#define \
MultipleOption(%0,%1,%2,%3,%4);\
SendClientMessage(%0,-1,%1);\
GivePLayerWeapon(%0,%2,%3);\
SetPlayerSkin(%0,%4);

MultipleOption(playerid ,text ,weapon-id ,AMMO ,Skin-ID);

^^

Sellize
13/03/2015, 11:08 AM
That is a terrible way to write macros! You might want to read my pre-processor tutorial.

Honestly I have no idea what you are talking about, could you elaborate?
I took a look at that tutorial and don't see how it is relevant to this thread

Sellize
13/03/2015, 11:17 AM
I was talking to Golf, the only person who posted a macro!


Oh, alright :)

For the orignal thread. Why did you make a thread asking if you could do something you already tried and had compile? That's basically, "hi, I've done this thing and it worked, does it work?"

Just to confirm, I guess.

Vince
13/03/2015, 01:26 PM
Prone to errors, though. If you do something like this:


if(expresssion)
foo(); bar();


Then bar() is unconditional.