[Ajuda] portгo abre ao se aproximar
#1

Olб galera da Fуrum samp eu estou procurando a um tempo procurei atй na booner inglкsa mais nгo achei :/
queria um portгo que vocк ao se aproximar ele abre automaticamente tanto dentro do carro como apй, se alguem tiver o cуdigo pode me passar quero da uma estudada nele.
Reply
#2

pawn Код:
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;
}
algo assim acho que funcionara
Reply
#3

nгo funfa ;/
Reply
#4

ai vc coloca uma funзгo de settimer dentro do lugar q ta abrindo pra ele fechar automatico depois de 5 segundos
Reply
#5

Quote:
Originally Posted by Chefгo
Посмотреть сообщение
ai vc coloca uma funзгo de settimer dentro do lugar q ta abrindo pra ele fechar automatico depois de 5 segundos
ta dando 1 erro, estou usando esse aqui que achei na booner inglкsa mais ta dando 1 erro nгo sei porque


Код:
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;
}
Reply
#6

tenta assim
pawn Код:
#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;
}
Reply
#7

Quote:
Originally Posted by Chefгo
Посмотреть сообщение
tenta assim
pawn Код:
#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;
}
Como й que vocк pretende chamar uma funзгo com parвmetros usando SetTimer ?

Faz que nem o PT indicou, ou entгo mete um setTimerEx ai, e um loop ao OnGameModeInit
Reply
#8

fmz tenta assim entгo

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;
}
Reply
#9

tem um problema, eu coloco no gm blz mais aonde eu coloco o id do portгo que quero mecher


no caso eu quero bota o objeto > 3095 como portгo :/

obs: o objeto tem rotaзгo :S o objeto original й: CreateObject(3095,213.8000000,1875.0000000,11.3000 000,90.0000000,180.0000000,0.0000000);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)