[Projeto] Comando - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: Non-English (
https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (
https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (
https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Projeto] Comando (
/showthread.php?tid=586076)
Comando -
maxblaya01 - 19.08.2015
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?
Re: COMANDO -
Wellington1999 - 19.08.2015
PHP код:
new EstaNaArena[MAX_PLAYERS];
O Resto й com vocк
Re: COMANDO -
iTakelot - 19.08.2015
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;
}
Re: COMANDO -
Wellington1999 - 19.08.2015
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 ].
Re: COMANDO -
riajedA - 19.08.2015
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.
Re: COMANDO -
iTakelot - 19.08.2015
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.
Re: COMANDO -
ipsLuan - 19.08.2015
Quote:
Originally Posted by iTakelot
Apenas um exemplo como disse acima, se eu colocasse um "certinho" ele nгo tentaria criar o dele.
|
Sei...
Re: Comando -
ipsLuan - 19.08.2015
Sei ler e escrever, mas pelo jeito vocк nгo sabe.
* "Fassa".
Re: Comando -
iTakelot - 19.08.2015
Quote:
Originally Posted by ipsLuan
Sei ler e escrever, mas pelo jeito vocк nгo sabe.
* "Fassa".
|
Infelizmente nгo.
Re: Comando -
Cleyson - 19.08.2015
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(playerid, cmdtext[])
{
if(ComandosBloqueados[playerid] == true)
{
SendClientMessage(playerid, -1, "ERRO: Vocк nгo pode usar comandos na arena. /sairarena");
return 0;
}
return 1;
}