#include <a_samp>
new Portao;
forward ClosePortao(playerid);
public OnGameModeInit()
{
Portao = CreateObject(970, 1, 2, 3, 0, 0, 0);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/portao", cmdtext, true, 10) == 0)
{
if(IsPlayerInRangeOfPoint(playerid,7.0, 1, 2, 3))
{
SendClientMessage(playerid, -1, "Portão Aberto, irá Fechar em 5 Segundos");
MoveObject(Portao, 1, 2, 2, 1.0, 0.0, 0.0, 0.0);
SetTimer("ClosePortao", 5000, false);
}
return 1;
}
return 0;
}
public ClosePortao(playerid)
{
MoveObject(Portao, 1, 2, 3, 1.0, 0.0, 0.0, 0.0);
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if ((newkeys==KEY_JUMP))
{
OnPlayerCommandText(playerid,"/portao");
}
return 1;
}