[Ajuda] Macros
#1

Criei um outro tуpico e achei esse cуdigo lб:

Код:
#define Teleport(%0,%1,%2,%3,%4)  SetPlayerPos(%0,%1,%2,%3);\
                                  SetPlayerFacingAngle(%0,%4)
Achei um tutorial de macros mais nгo funcionou comigo, o cуdigo acima funcionou perfeitamente, mas queria saber, Pq o SetPlayerPos tem ponto e vнrgula e o SetPlayerFacingAngle nгo? Pq aquela barra(\) depois do SetPlayerPos()??
Reply
#2

Aqui:
pawn Код:
#define Teleporte(%0,%1,%2,%3,%4);  SetPlayerPos(%0,%1,%2,%3), SetPlayerFacingAngle(%0,%4);
o \ й para vocк continuar o cуdigo na outra linha !

pawn Код:
#define Teleporte(%0,%1,%2,%3,%4);  \
                                        SetPlayerPos(%0,%1,%2,%3), SetPlayerFacingAngle(%0,%4);
e й a mesma coisa que:

pawn Код:
stock Teleporte(playerid, X, Y, Z, Interior)
{
    SetPlayerPos(playerid, X, Y, Z), SetPlayerFacingAngle(playerid, Interior);
}
mais com define й mais otimizado
Reply
#3

Mais e os pontos e vнrgulas?
Reply
#4

Quote:
Originally Posted by AndrePls
Посмотреть сообщение
Mais e os pontos e vнrgulas?
Olha um exemplo.
pawn Код:
SetPlayerPos(playerid,x,y,z);
SetPlayerFacingAngle(playerid,a);

// й o mesmo que:
SetPlayerPos(playerid,x,y,z),SetPlayerFacingAngle(playerid,a);
Reply
#5

Quote:
Originally Posted by tonisantolia
Посмотреть сообщение
Olha um exemplo.
pawn Код:
SetPlayerPos(playerid,x,y,z);
SetPlayerFacingAngle(playerid,a);

// й o mesmo que:
SetPlayerPos(playerid,x,y,z),SetPlayerFacingAngle(playerid,a);
Mais no macro sу o SetPlayerPos tem ponto e vнrgula, o SetPlayerFacingAngle nгo =/
Reply
#6

Quote:
Originally Posted by AndrePls
Посмотреть сообщение
Mais no macro sу o SetPlayerPos tem ponto e vнrgula, o SetPlayerFacingAngle nгo =/
Como assim? eu e o jonathan demos exemplos bem claros

@Edit
SetPlayerFacingAngle tem ponto e virgula sim.
https://sampwiki.blast.hk/wiki/Function:...yerFacingAngle
Reply
#7

Quote:
Originally Posted by tonisantolia
Посмотреть сообщение
Como assim? eu e o jonathan demos exemplos bem claros
Код:
#define SETAR POSICAO DO PLAYER();\
           OUTRA FUNCAO()
A primeira funзгo tem ponto e virgula no final, jб a segunda nгo =/
Reply
#8

pawn Код:
Teleporte(playerid, corx, cory, corz, angulo);
Tentou usar isto ?
Reply
#9

Agora funcionou certinho
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)