SA-MP Forums

Go Back   SA-MP Forums > Non-English > Languages > Português/Portuguese

Reply
 
Thread Tools Display Modes
Old 01/09/2016, 02:09 AM   #1
GustavoSouza
Big Clucker
 
Join Date: May 2015
Posts: 132
Reputation: 10
Default On, Off

Olá, venho aliás fazer um pedido de um simples code que posso verificar se o player esta online ou off do servidor, e também como posso aplicar em algum dialog para aparecer o seu status de conectado.

Obrigado.
__________________
Copyright (c) 1997-2006, ITB CompuPhase
GustavoSouza is offline   Reply With Quote
Old 01/09/2016, 02:18 AM   #2
matheusspohr
Gangsta
 
matheusspohr's Avatar
 
Join Date: Feb 2015
Location: Capanema PR
Posts: 670
Reputation: 33
Default Re: On, Off

Olá sumido! Rs, somos 2...
Quando abrir a dialog, procura pelo nome do jogador com um loop usando o comparador de strings(strcmp) e ai se ele estiver on, seta pra Online, else Off...

Abraços, chama skype.
matheusspohr is offline   Reply With Quote
Old 01/09/2016, 11:30 AM   #3
F1N4L
High-roller
 
F1N4L's Avatar
 
Join Date: Jun 2013
Posts: 2,726
Reputation: 260
Default Re: On, Off

Prefixo errado.

Busca através de nome:
Code:
new n[24];
	for(new i; i < 500; ++ i)
	{
		GetPlayerName(i, n, 24);
		
		if(strcmp(n, "NICK_DO_PLAYER", true) == 0)
		{
			print("Achei o safadinho!");
			
			break;
		}
	}
F1N4L is offline   Reply With Quote
Old 01/09/2016, 03:17 PM   #4
GustavoSouza
Big Clucker
 
Join Date: May 2015
Posts: 132
Reputation: 10
Default Re: On, Off

Quote:
Originally Posted by F1N4L View Post
Prefixo errado.

Busca através de nome:
Code:
new n[24];
	for(new i; i < 500; ++ i)
	{
		GetPlayerName(i, n, 24);
		
		if(strcmp(n, "NICK_DO_PLAYER", true) == 0)
		{
			print("Achei o safadinho!");
			
			break;
		}
	}
Não é isso, eu já tinha feito uma vez, não lembro mais, era algo como:

PHP Code:
format(gBufsizeof(gBuf), "Pos\tNome\tDinheiro\nStatus\n{ffffff}%iº\t%s\t%d\t%s\n"gPercorrer+1gGetgLevel, (Online ?: Offine)); 
Era algo assim, e tinha mais uma parte...
__________________
Copyright (c) 1997-2006, ITB CompuPhase
GustavoSouza is offline   Reply With Quote
Old 01/09/2016, 05:10 PM   #5
SammyJ
Gangsta
 
SammyJ's Avatar
 
Join Date: May 2015
Location: Rio de Janeiro
Posts: 811
Reputation: 71
Default Respuesta: On, Off

PHP Code:
format(gBufsizeof(gBuf), "Pos\tNome\tDinheiro\nStatus\n{ffffff}%iº\t%s\t%d\t%s\n"gPercorrer+1gGetgLevel, (VarLogado[playerid] ? "Online" "Offine")); 
__________________
SammyJ is offline   Reply With Quote
Old 01/09/2016, 06:10 PM   #6
F1N4L
High-roller
 
F1N4L's Avatar
 
Join Date: Jun 2013
Posts: 2,726
Reputation: 260
Default Re: Respuesta: On, Off

Quote:
Originally Posted by Glederson_dom View Post
PHP Code:
format(gBufsizeof(gBuf), "Pos\tNome\tDinheiro\nStatus\n{ffffff}%iº\t%s\t%d\t%s\n"gPercorrer+1gGetgLevel, (VarLogado[playerid] ? "Online" "Offine")); 
Detalhes...
Quote:
(VarLogado[playerid] ? ("Online") : ("Offine"))
F1N4L is offline   Reply With Quote
Old 01/09/2016, 11:06 PM   #7
GustavoSouza
Big Clucker
 
Join Date: May 2015
Posts: 132
Reputation: 10
Default Re: Respuesta: On, Off

Quote:
Originally Posted by Glederson_dom View Post
PHP Code:
format(gBufsizeof(gBuf), "Pos\tNome\tDinheiro\nStatus\n{ffffff}%iº\t%s\t%d\t%s\n"gPercorrer+1gGetgLevel, (VarLogado[playerid] ? "Online" "Offine")); 
É quase isso, mais não deu...
__________________
Copyright (c) 1997-2006, ITB CompuPhase
GustavoSouza is offline   Reply With Quote
Old 01/09/2016, 11:24 PM   #8
SammyJ
Gangsta
 
SammyJ's Avatar
 
Join Date: May 2015
Location: Rio de Janeiro
Posts: 811
Reputation: 71
Default Respuesta: Re: Respuesta: On, Off

Quote:
Originally Posted by F1N4L View Post
Detalhes...
vlw. rs

Quote:
Originally Posted by GustavoSouza View Post
É quase isso, mais não deu...
Mano não é possível.

PHP Code:
format(gBufsizeof(gBuf), "Pos\tNome\tDinheiro\nStatus\n{ffffff}%iº\t%s\t%d\t%s\n"gPercorrer+1gGetgLevel, (VarLogado[playerid] ? "Online" "Offine"));
ShowPlayerDialog(playerid0DIALOG_STYLE_LIST"[ PLAYERS ]"gBuf"Fechar"""); 
__________________
SammyJ is offline   Reply With Quote
Old 02/09/2016, 12:14 AM   #9
GustavoSouza
Big Clucker
 
Join Date: May 2015
Posts: 132
Reputation: 10
Default Re: On, Off

PHP Code:
error 028invalid subscript (not an array or too many subscripts): "VarLogado"
error 029invalid expressionassumed zero
error 029
invalid expressionassumed zero
 fatal error 107
too many error messages on one line 
__________________
Copyright (c) 1997-2006, ITB CompuPhase
GustavoSouza is offline   Reply With Quote
Old 02/09/2016, 11:22 AM   #10
F1N4L
High-roller
 
F1N4L's Avatar
 
Join Date: Jun 2013
Posts: 2,726
Reputation: 260
Default Re: On, Off

Tenta...

Code:
format(gBuf, sizeof(gBuf), "Pos\tNome\tDinheiro\nStatus\n{ffffff}%iº\t%s\t%d\t%s\n", gPercorrer+1, gGet, gLevel, (VarLogado[playerid] ? ("Online") : ("Offine"))); 
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_LIST, "[ PLAYERS ]", gBuf, "Fechar", "");
@EDIT

Você declarou a variável VarLogado de maneira errada:
Como você declarou: new VarLogado;
Como deve declarar: new VarLogado[MAX_PLAYERS];
F1N4L is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 05:03 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.