[Ajuda] Portгo nгo abre
#1

Pessoal O portгo nгo abre pros cop nem pros advogado olhem.

PHP код:
    if(strcmp(cmd"/portaopc"true) == 0)
    {
        if(
PlayerInfo[playerid][pEmprego] == && !IsACop(playerid) && !PlayerToPoint(5.0playerid920.6636,-1221.9191,16.9766))
        {
            
F_MoveObjectPortaoPC923.6992, -1236.664821.3379 ,3);
            
F_MoveObjectPortaoPC3923.0747, -1205.638421.3828 ,3);
            
SetTimer("PortaoPC2"4200false);
        }
          return 
1;
    } 
Reply
#2

vai abrir 2 portхes de uma vez sу?, poste tambйm as coordenadas do portгo fechado
Reply
#3

Att DonSpeed
Reply
#4

Quote:
Originally Posted by LordShadow
Посмотреть сообщение
vai abrir 2 portхes de uma vez sу?, poste tambйm as coordenadas do portгo fechado
Leia com atenзгo!
Reply
#5

Quote:
Originally Posted by Don_Speed
Посмотреть сообщение
Ele teria que ser COP e Advogado ¬¬

Troque isso
PHP код:
if(PlayerInfo[playerid][pEmprego] == && !IsACop(playerid) && !PlayerToPoint(5.0playerid920.6636,-1221.9191,16.9766)) 
Por isso
PHP код:
if(PlayerInfo[playerid][pEmprego] == || !IsACop(playerid) && !PlayerToPoint(5.0playerid920.6636,-1221.9191,16.9766)) 
Att DonSpeed
Cara o portгo abriu perfeitamente, mais sу tem um problema, O portгo abre em qualquer distancia , exemplo: O portгo й em LS e o player ta em SF, se ele digita o cmd /portaopc, ele abre do mesmo geito - Queria colocar pra abrir sу se o player tiver perto do portгo.


PHP код:
!PlayerToPoint(5.0playerid920.6636,-1221.9191,16.9766))//Coloquei o 5.0 Pra 2.0 e continua abrindo de distancia longe. 
Reply
#6

Retire o ! da frente, pois ele nega, ou seja se ele NГO estiver nesse 'ponto'

A funзгo PlayerToPoint jб estб obsoleta faz tempo...

A melhor opзгo й a funзгo 'nativa' IsPlayerInRangeOfPoint agora.

Leia este tutorial sobre operadores

https://sampforum.blast.hk/showthread.php?tid=240266
Reply
#7

Quote:
Originally Posted by arakuta
Посмотреть сообщение
Retire o ! da frente, pois ele nega, ou seja se ele NГO estiver nesse 'ponto'

A funзгo PlayerToPoint jб estб obsoleta faz tempo...

A melhor opзгo й a funзгo 'nativa' IsPlayerInRangeOfPoint agora.
Ai resolveu mais vou continuar usando PlayerToPoint Nunca fui de usar IsPlayerInRangeOfPoint

Mais ai qual й a diferenзa ?
Reply
#8

A funзгo PlayerToPoint й uma funзгo criada por scripters, e contйm alguns cбlculos.
A funзгo IsPlayerInRangeOfPoint й uma funзгo original do sa-mp, provavelmente prй calculada quando o jogador envia sua posiзгo para o servidor.

Teria que fazer alguns testes, mas creio eu que a funзгo original do samp seja mais otimizada.
Reply
#9

Quote:
Originally Posted by arakuta
Посмотреть сообщение
A funзгo PlayerToPoint й uma funзгo criada por scripters, e contйm alguns cбlculos.
A funзгo IsPlayerInRangeOfPoint й uma funзгo original do sa-mp, provavelmente prй calculada quando o jogador envia sua posiзгo para o servidor.

Teria que fazer alguns testes, mas creio eu que a funзгo original do samp seja mais otimizada.
Bom cara mudei, vou ir pela sua opiniгo, Mude a funзгo mais agora o portгo sу abre pros advogados.

PHP код:
    if(strcmp(cmd"/portaopc"true) == 0)
    {
        if(
PlayerInfo[playerid][pEmprego] == && !IsACop(playerid) && IsPlayerInRangeOfPoint(playerid7.0920.6636,-1221.9191,16.9766))
        {
            
F_MoveObjectPortaoPC923.6992, -1236.664821.3379 ,3);
            
F_MoveObjectPortaoPC3923.0747, -1205.638421.3828 ,3);
            
SetTimer("PortaoPC2"4200false);
        }
          return 
1;
    } 
Reply
#10

Quote:
Originally Posted by PetterAdriano
Посмотреть сообщение
Bom cara mudei, vou ir pela sua opiniгo, Mude a funзгo mais agora o portгo sу abre pros advogados.

PHP код:
    if(strcmp(cmd"/portaopc"true) == 0)
    {
        if(
PlayerInfo[playerid][pEmprego] == && !IsACop(playerid) && IsPlayerInRangeOfPoint(playerid7.0920.6636,-1221.9191,16.9766))
        {
            
F_MoveObjectPortaoPC923.6992, -1236.664821.3379 ,3);
            
F_MoveObjectPortaoPC3923.0747, -1205.638421.3828 ,3);
            
SetTimer("PortaoPC2"4200false);
        }
          return 
1;
    } 
troca a terceira linha por isso:

PHP код:
if(PlayerInfo[playerid][pEmprego] == || IsACop(playerid) && IsPlayerInRangeOfPoint(playerid7.0920.6636,-1221.9191,16.9766)) 
&& = e
|| = ou

Ou seja, se fosse &&, o player teria que ser um advogado e ao mesmo tempo um policial para abrir.

! = diferente

Estava !IsACop(playerid), entгo: Vai abrir se ele for diferente de um COP, ou seja, se ele nгo for um COP.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)