[Projeto] Comando
#1

estou montando uma gamemode unica, mais estou tenho uma dificuldade, tipo o player teleporta pra uma arena, e eu quero por pra quando ele for pra la nao poder usar nenhum comando, so pode usar de digita /sair pra sair da arena, como faзo isso?
Reply
#2

PHP код:
new EstaNaArena[MAX_PLAYERS]; 
O Resto й com vocк
Reply
#3

OBS: Isto й apenas um exemplo fassa o seu.

PHP код:

new :libr[MAX_PLAYERS];
function::
OnPlayerConnect(playerid){
    
libr=false//Seta true no onplayerconnect
    
return 1;
}
MyCommand:x1(playerid){
    
libr=false//no comando em que o player for para a arena vocк seta false.
    
return 1;
}    
MyCommand:Saude_(playerid){
    if(
libr[playerid] == true) return printf("vocк esta bloqueado de usar x comando")
    return 
1;
}
MyCommand:Sair(playerid){
    
libr=true//Seta false novamente liberando os comandos.
    
return 1;

Reply
#4

Quote:
Originally Posted by iTakelot
Посмотреть сообщение
OBS: Isto й apenas um exemplo fassa o seu.

PHP код:

new :libr[MAX_PLAYERS];
function::
OnPlayerConnect(playerid){
    
libr=false//Seta true no onplayerconnect
    
return 1;
}
MyCommand:x1(playerid){
    
libr=false//no comando em que o player for para a arena vocк seta false.
    
return 1;
}    
MyCommand:Saude_(playerid){
    if(
libr[playerid] == true) return printf("vocк esta bloqueado de usar x comando")
    return 
1;
}
MyCommand:Sair(playerid){
    
libr=true//Seta false novamente liberando os comandos.
    
return 1;

Corrigindo
PHP код:
new bool:libr[MAX_PLAYERS];
function::
OnPlayerConnect(playerid){
    
libr[playerid] =false//Seta true no onplayerconnect
    
return 1;
}
MyCommand:x1(playerid){
    
libr[playerid] =false//no comando em que o player for para a arena vocк seta false.
    
return 1;
}    
MyCommand:Saude_(playerid){
    if(
libr[playerid] == true) return printf("vocк esta bloqueado de usar x comando")
    return 
1;
}
MyCommand:Sair(playerid){
    
libr[playerid] = true//Seta false novamente liberando os comandos.
    
return 1;

Код:
  • Somente variбveis booleanas utilizam os Resultados [ TRUE ] ou [ FALSE ].
Reply
#5

Quote:
Originally Posted by iTakelot
Посмотреть сообщение
OBS: Isto й apenas um exemplo fassa o seu.

PHP код:

new :libr[MAX_PLAYERS];
function::
OnPlayerConnect(playerid){
    
libr=false//Seta true no onplayerconnect
    
return 1;
}
[.....] 
Os escopos deste cуdigo sгo totalmente redundantes.
Reply
#6

Quote:
Originally Posted by riajedA
Посмотреть сообщение
Os escopos deste cуdigo sгo totalmente redundantes.
Apenas um exemplo como disse acima, se eu colocasse um "certinho" ele nгo tentaria criar o dele.
Reply
#7

Quote:
Originally Posted by iTakelot
Посмотреть сообщение
Apenas um exemplo como disse acima, se eu colocasse um "certinho" ele nгo tentaria criar o dele.
Sei...
Reply
#8

Sei ler e escrever, mas pelo jeito vocк nгo sabe.

* "Fassa".
Reply
#9

Quote:
Originally Posted by ipsLuan
Посмотреть сообщение
Sei ler e escrever, mas pelo jeito vocк nгo sabe.

* "Fassa".
Infelizmente nгo.
Reply
#10

Se vocк usa o processador de comandos ZCMD (Oque й recomendado) pode se usar dessa maneira com manipulaзгo de variaveis e uma funзгo prуpria do zcmd:

PHP код:
new bool:ComandosBloqueados[MAX_PLAYERS];
CMD:irarena(playerid)
{
    
// SetPlayerPos.....
    
ComandosBloqueados[playerid] = true;
    return 
1;
}
CMD:sairarena(playerid)
{
    
// SetPlayerPos.....
    
ComandosBloqueados[playerid] = false;
    return 
1;
}
public 
OnPlayerCommandReceived(playeridcmdtext[])
{
    if(
ComandosBloqueados[playerid] == true)
    {
        
SendClientMessage(playerid, -1"ERRO: Vocк nгo pode usar comandos na arena. /sairarena");
        return 
0;
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)