new portao;
// OnGameModeInt
SetTimer("PortaoAuto", 1000, true);
portao = CreateObject(modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ, Float:DrawDistance);
// fim da gm
forward PortaoAuto();
public PortaoAuto()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoint(i,10.0, X, Y, Y))
{
MoveObject(portao, X, Y, Z, 2.5);
}
}
return 1;
}
ai vc coloca uma funзгo de settimer dentro do lugar q ta abrindo pra ele fechar automatico depois de 5 segundos
|
C:\Users\Yago\Desktop\Guerra\filterscripts\portao.pwn(17) : error 001: expected token: ")", but found "{" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Error.
#include <a_samp> new portao; forward pp(playerid); forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z); public OnGameModeExit() { SetTimer("pp", 999, false); return 1; } public pp(playerid) { if(PlayerToPoint(11.0, playerid, 213.8, 1875.0, 11.3) { MoveObject(portao, 200.8, 1875.0, 11.3, 5); } else { MoveObject(portao, 213.8, 1875.0, 11.3, 5); } return 1; } public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z) { if(IsPlayerConnected(playerid)) { new Float:oldposx, Float:oldposy, Float:oldposz; new Float:tempposx, Float:tempposy, Float:tempposz; GetPlayerPos(playerid, oldposx, oldposy, oldposz); tempposx = (oldposx -x); tempposy = (oldposy -y); tempposz = (oldposz -z); if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) { return 1; } } return 0; }
#include <a_samp>
new portao;
forward pp(playerid);
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
public OnGameModeExit()
{
SetTimer("pp", 999, false);
return 1;
}
public pp(playerid)
{
if(PlayerToPoint(11.0, playerid, 213.8, 1875.0, 11.3))
{
MoveObject(portao, 200.8, 1875.0, 11.3, 5);
}
else
{
MoveObject(portao, 213.8, 1875.0, 11.3, 5);
}
return 1;
}
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
if(IsPlayerConnected(playerid))
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
}
return 0;
}
tenta assim
pawn Код:
|
#include <a_samp>
new portao;
forward pp();
forward pp2(playerid);
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
public OnGameModeExit()
{
SetTimer("pp", 1000, false);
return 1;
}
public pp()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
pp2(i);
}
return 1;
}
public pp2(playerid)
{
if(PlayerToPoint(11.0, playerid, 213.8, 1875.0, 11.3))
{
MoveObject(portao, 200.8, 1875.0, 11.3, 5);
}
else
{
MoveObject(portao, 213.8, 1875.0, 11.3, 5);
}
return 1;
}
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
if(IsPlayerConnected(playerid))
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
}
return 0;
}