|
Armazene os ids em uma matriz e mova-os com um loop contendo o MoveObject
|

#include a_samp
#include zcmd
//[Include hLoop By MrHardy]
#define hLoop_Bot(%1) for (new %1 = 0; %1 < MAX_PLAYERS; %1++) if(IsPlayerConnected(%1) && IsPlayerNPC(%1))
#define hLoop_Admin(%1,%2) for (new %1 = 0; %1 < MAX_PLAYERS; %1++) if(IsPlayerConnected(%1) && %2)
#define hLoop_Player(%1) for (new %1 = 0; %1 < MAX_PLAYERS; %1++) if(IsPlayerConnected(%1))
#define hLoop_Vehicle(%1) for (new %1 = 0; %1 < MAX_VEHICLES; %1++)
#define hLoop_Multiple(%1,%2) for (new %2; %2 < %1; %2++)
#define hLoop_Function(%1,%2) \
hLoop_Multiple(%1,%2)
#define MAX_PORTOES 5
#define POSICAO_Z_PORTAO 5.0 //Aqui vocк define altitude que vocк quer que se mova o portгo
new Portoes[MAX_PORTOES];
public OnGameModeInit()
{
Portoes[0] = //CreateObject(.....
Portoes[1] = //CreateObject(.....
Portoes[2] = //CreateObject(.....
Portoes[3] = //CreateObject(.....
Portoes[4] = //CreateObject(.....
return true;
}
CMD:movertudo(playerid, params[])
{
hLoop_Function(MAX_PORTOES, i)
{
new Float:X, Float:Y, Float:Z;
GetObjectPos(Portoes[i], X, Y, Z);
MoveObject(Portoes[i], X, Y, Z + POSICAO_Z_PORTAO);
}
return true;
}
|
Mr hardy, fiz dessa forma e nгo deu certo :S
Eles descem ao invйs de subir.... todos errados.. |
|
Ele desce ao invйs de subir... ja tentei trocar o "+" por "-" mas continua descendo...
E alem de descer errado ele vai uma pequena distancia para o eixo x ou y, nao sem bem qual o eixo, mas ele vai um pouco para o lado.. Achei estranho atй :S |
#include a_samp
#include zcmd
//[Include hLoop By MrHardy]
#define hLoop_Bot(%1) for (new %1 = 0; %1 < MAX_PLAYERS; %1++) if(IsPlayerConnected(%1) && IsPlayerNPC(%1))
#define hLoop_Admin(%1,%2) for (new %1 = 0; %1 < MAX_PLAYERS; %1++) if(IsPlayerConnected(%1) && %2)
#define hLoop_Player(%1) for (new %1 = 0; %1 < MAX_PLAYERS; %1++) if(IsPlayerConnected(%1))
#define hLoop_Vehicle(%1) for (new %1 = 0; %1 < MAX_VEHICLES; %1++)
#define hLoop_Multiple(%1,%2) for (new %2; %2 < %1; %2++)
#define hLoop_Function(%1,%2) \
hLoop_Multiple(%1,%2)
#define MAX_PORTOES 5
#define POSICAO_Z_PORTAO 5.0 //Aqui vocк define altitude que vocк quer que se mova o portгo
#define VELOCIDADE_PORTAO 5.0 //Aqui vocк define a velocidade б ser usada
new Portoes[MAX_PORTOES];
public OnGameModeInit()
{
Portoes[0] = //CreateObject(.....
Portoes[1] = //CreateObject(.....
Portoes[2] = //CreateObject(.....
Portoes[3] = //CreateObject(.....
Portoes[4] = //CreateObject(.....
return true;
}
CMD:movertudo(playerid, params[])
{
hLoop_Function(MAX_PORTOES, i)
{
new Float:X, Float:Y, Float:Z;
new Float:RotX,Float:RotY,Float:RotZ;
GetObjectPos(Portoes[i], X, Y, Z);
GetObjectRot(Portoes[i], RotX, RotY, RotZ);
MoveObject(Portoes[i], X, Y, Z + POSICAO_Z_PORTAO, VELOCIDADE_PORTAO, RotX, RotY, RotZ);
SetObjectRot(Portoes[i], RotX, RotY, RotZ );
}
return true;
}
CMD:ab(playerid, params[])
{
if(PlayerInfo[playerid][Level] < 1)return SendClientMessage(playerid,fail,LEVELF);
MoveObject(PortaoAB[0],731.13629150,-2236.15087891,10.724605560303,2.0);
MoveObject(PortaoAB[1],723.35278320,-2233.18115234,10.724605560303,2.0);
MoveObject(PortaoAB[2],719.14697266,-2231.37744141,10.724605560303,2.0);
SendClientMessage(playerid,amarelo,"PORTAO ABERTO");
return 1;
}
CMD:fb(playerid, params[])
{
if(PlayerInfo[playerid][Level] < 1)return SendClientMessage(playerid,fail,LEVELF);
MoveObject(PortaoAB[0],731.13629150,-2236.15087891,4.22460508,2.0);
MoveObject(PortaoAB[1],723.35278320,-2233.18115234,4.22460508,2.0);
MoveObject(PortaoAB[2],719.14697266,-2231.37744141,4.22460508,2.0);
SendClientMessage(playerid,amarelo,"PORTAO FECHADO");
return 1;
}
for(new d; d < tantoportoes; ++d)
{
moveobject(varportao[d]...
}
|
Olha como fisso no meu 3 portoes;
pawn Code:
use um loop; ex: pawn Code:
|
#include a_samp
#include zcmd
//[Include hLoop By MrHardy]
#define hLoop_Bot(%1) for (new %1 = 0; %1 < MAX_PLAYERS; %1++) if(IsPlayerConnected(%1) && IsPlayerNPC(%1))
#define hLoop_Admin(%1,%2) for (new %1 = 0; %1 < MAX_PLAYERS; %1++) if(IsPlayerConnected(%1) && %2)
#define hLoop_Player(%1) for (new %1 = 0; %1 < MAX_PLAYERS; %1++) if(IsPlayerConnected(%1))
#define hLoop_Vehicle(%1) for (new %1 = 0; %1 < MAX_VEHICLES; %1++)
#define hLoop_Multiple(%1,%2) for (new %2; %2 < %1; %2++)
#define hLoop_Function(%1,%2) \
hLoop_Multiple(%1,%2)
#define MAX_PORTOES 5
#define POSICAO_Z_PORTAO 5.0 //Aqui vocк define altitude que vocк quer que se mova o portгo
#define VELOCIDADE_PORTAO 5.0 //Aqui vocк define a velocidade б ser usada
new Portoes[MAX_PORTOES];
public OnGameModeInit()
{
Portoes[0] = //CreateObject(.....
Portoes[1] = //CreateObject(.....
Portoes[2] = //CreateObject(.....
Portoes[3] = //CreateObject(.....
Portoes[4] = //CreateObject(.....
return true;
}
CMD:movertudo(playerid, params[])
{
hLoop_Function(MAX_PORTOES, i)
{
new Float:X, Float:Y, Float:Z;
new Float:RotX,Float:RotY,Float:RotZ;
new Float:CalculoZ;
CalculoZ = Z + POSICAO_Z_PORTAO;
GetObjectPos(Portoes[i], X, Y, Z);
GetObjectRot(Portoes[i], RotX, RotY, RotZ);
MoveObject(Portoes[i], X, Y, CalculoZ, VELOCIDADE_PORTAO);
SetObjectRot(Portoes[i], RotX, RotY, RotZ );
}
return true;
}