Valew Pela Ajuda Gente =)
Thanks for the trouble
if (strcmp("/portao", cmdtext, true, 10) == 0)
if(strfind(PlayerName(playerid), "jogador1", false) != -1 || strfind(PlayerName(playerid), "jogador2", false) != -1 || strfind(PlayerName(playerid), "jogador3", false) != -1)
VerificarPortao();
return 1;
}
#define FILTERSCRIPT
#include <a_samp>
new Portao;
public OnFilterScriptInit()
{
SetTimer("VerificarPortao", 1000, true);
Portao = CreateObject(980, -1530.2000, 481.6600, 8.9200, 0.00, 0.00, 0.00);
return 1;
}
forward VerificarPortao();
public VerificarPortao()
{
new name[MAX_PLAYER_NAME+1];
new Float:X, Float:Y, Float:Z;
for(new i = 0; i < MAX_PLAYERS; i++)
{
GetPlayerPos(i, X, Y, Z);
if(PlayerNoRaio(10, -1530.2000, 481.6600, 8.9200, i))
{
GetPlayerName(i, name, sizeof(name));
if(strcmp(name,"Jogador1",true)==0 || strcmp(name,"Jogador2",true)==0 || strcmp(name,"Jogador3",true)==0)// modificacao feita aki
{
MoveObject(Portao, -1520.2000, 481.6600, 8.9200, 8);
SetTimer("FecharPortao", 8000, true);
}
}
}
return 1;
}
forward FecharPortao();
public FecharPortao()
{
MoveObject(Portao, -1530.2000, 481.6600, 8.9200, 8);
}
stock PlayerNoRaio(Float:range, Float:x2, Float:y2, Float:z2, playerid)
{
new Float:X2, Float:Y2, Float:Z2;
GetPlayerPos(playerid, X2, Y2, Z2);
X2 -= x2, Y2 -= y2, Z2 -= z2;
return ((X2 * X2) + (Y2 * Y2) + (Z2 * Z2)) < (range * range);
}
public VerificarPortao()
{
new nome[MAX_PLAYER_NAME], Float:X, Float:Y, Float:Z;
for(new i = 0; i < MAX_PLAYERS; i++)
{
GetPlayerPos(i, X, Y, Z);
GetPlayerName(i, nome, sizeof(nome));
if(PlayerNoRaio(10, -1530.2000, 481.6600, 8.9200, i))
{
if(!strcmp(nome, "jogador1", true) || !strcmp(nome, "jogador2", true) || !strcmp(nome, "jogador3", true))
{
MoveObject(Portao, -1520.2000, 481.6600, 8.9200, 8);
SetTimer("FecharPortao", 8000, true);
}
}
}
return 1;
}
public OnPlayerUpdade(playerid){
if(IsPlayerInRangeOfPoint(playerid, 10, -1530.2000, 481.6600, 8.9200))
{
MoveObject(Portao, -1520.2000, 481.6600, 8.9200, 8);
SetTimer("FecharPortao", 8000, true);
}
return 1;
}
PHP код:
|