SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 13/11/2018, 01:46 PM   #1
iLinuxOficiaL
Little Clucker
 
Join Date: Jan 2017
Location: qZMg1jN9Lt0=
Posts: 33
Reputation: 3
Default Checar Online/Offline Líder

Alguem sabe como coloco pra checar se o Líder da ORG Está Online ou Offline ? pfv

Code:
	CMD:orgs(playerid)
	{
        new string[MAX_STRING];
		gs_Buffer[0] = EOS;
        format(string,sizeof(string), "{1E90FF}Governamental\n\n");
		strcat(gs_Buffer,string);
		format(string,sizeof(string), "{0099ff}7 - %s:{FFFFFF} %s\n", GetOrgName(7), InfoOrg[7][Lider]);//governo
		strcat(gs_Buffer,string);
		format(string,sizeof(string), "{00660C}3 - %s:{FFFFFF} %s\n", GetOrgName(3), InfoOrg[3][Lider]);//Guarda Nacional
		strcat(gs_Buffer,string);
		format(string,sizeof(string), "{917662}11 - %s:{FFFFFF} %s\n", GetOrgName(11), InfoOrg[11][Lider]);//pf
		strcat(gs_Buffer,string);
		format(string,sizeof(string), "{906000}33 - %s:{FFFFFF} %s\n", GetOrgName(33), InfoOrg[33][Lider]);//pc
		strcat(gs_Buffer,string);
		format(string,sizeof(string), "{FF6200}34 - %s:{FFFFFF} %s\n", GetOrgName(34), InfoOrg[34][Lider]);//pc
		strcat(gs_Buffer,string);
		format(string,sizeof(string), "{9fa4e8}1 - %s:{FFFFFF} %s\n", GetOrgName(1), InfoOrg[1][Lider]);//pm
		strcat(gs_Buffer,string);
		format(string,sizeof(string), "{3e3d3d}2 - %s:{FFFFFF} %s\n", GetOrgName(2), InfoOrg[2][Lider]);//rota
		strcat(gs_Buffer,string);
		format(string,sizeof(string), "{408080}16 - %s:{FFFFFF} %s\n\n", GetOrgName(16), InfoOrg[16][Lider]);//bope
		strcat(gs_Buffer,string);
		format(string,sizeof(string), "{1E90FF}Gangsters\n\n");
		strcat(gs_Buffer,string);
		format(string,sizeof(string), "{337EFF}5 - %s:{FFFFFF} %s\n", GetOrgName(5), InfoOrg[5][Lider]);//aztecas
		strcat(gs_Buffer,string);
		format(string,sizeof(string), "{00da1c}14 - %s:{FFFFFF} %s\n", GetOrgName(14), InfoOrg[14][Lider]);//grove
		strcat(gs_Buffer,string);
		format(string,sizeof(string), "{c640dd}17 - %s:{FFFFFF} %s\n", GetOrgName(17), InfoOrg[17][Lider]);//ballas
		strcat(gs_Buffer,string);
		format(string,sizeof(string), "{DEBC00}18 - %s:{FFFFFF} %s\n", GetOrgName(18), InfoOrg[18][Lider]);//losvagos
		strcat(gs_Buffer,string);
		format(string,sizeof(string), "{FF3636}19 - %s:{FFFFFF} %s\n", GetOrgName(19), InfoOrg[19][Lider]);//cv
		strcat(gs_Buffer,string);
		format(string,sizeof(string), "{9ACD32}21 - %s:{FFFFFF} %s\n\n", GetOrgName(21), InfoOrg[21][Lider]);//pcc
		strcat(gs_Buffer,string);
		format(string,sizeof(string), "{1E90FF}Assassinas\n\n");
		strcat(gs_Buffer,string);
		format(string,sizeof(string), "{BDBDBD}8 - %s:{FFFFFF} %s\n", GetOrgName(8), InfoOrg[8][Lider]);//hitmans
		strcat(gs_Buffer,string);
		format(string,sizeof(string), "{A4D1FF}22 - %s:{FFFFFF} %s\n\n", GetOrgName(22), InfoOrg[22][Lider]);//triads
		strcat(gs_Buffer,string);//
		format(string,sizeof(string), "{1E90FF}Mafiosas\n\n");
		strcat(gs_Buffer,string);
		format(string,sizeof(string), "{D48A30}12 - %s:{FFFFFF} %s\n", GetOrgName(12), InfoOrg[12][Lider]);//cosa
		strcat(gs_Buffer,string);
		format(string,sizeof(string), "{00483A}13 - %s:{FFFFFF} %s\n\n", GetOrgName(13), InfoOrg[13][Lider]);//yakuza
		strcat(gs_Buffer,string);
		format(string,sizeof(string), "{1E90FF}Terroristas\n\n");
		strcat(gs_Buffer,string);
		format(string,sizeof(string), "{6E6E6E}15 - %s:{FFFFFF} %s\n", GetOrgName(15), InfoOrg[15][Lider]);//asfarc
		strcat(gs_Buffer,string);
		format(string,sizeof(string), "{CC0196}23 - %s:{FFFFFF} %s\n\n", GetOrgName(23), InfoOrg[23][Lider]);//gi
		strcat(gs_Buffer,string);
		format(string,sizeof(string), "{1E90FF}Mercenárias\n\n");
		strcat(gs_Buffer,string);
		format(string,sizeof(string), "{961e32}24 - %s:{FFFFFF} %s\n", GetOrgName(24), InfoOrg[24][Lider]);//HellsAngels
		strcat(gs_Buffer,string);
		format(string,sizeof(string), "{535d71}25 - %s:{FFFFFF} %s\n\n", GetOrgName(25), InfoOrg[25][Lider]);//sons
		strcat(gs_Buffer,string);
		format(string,sizeof(string), "{1E90FF}Particular\n\n");
		strcat(gs_Buffer,string);
		format(string,sizeof(string), "{ffe99e}9 - %s:{FFFFFF} %s\n", GetOrgName(9), InfoOrg[9][Lider]);//reporteres
		strcat(gs_Buffer,string);
		format(string,sizeof(string), "{F78181}4 - %s:{FFFFFF} %s\n\n", GetOrgName(4), InfoOrg[4][Lider]);//pc
		strcat(gs_Buffer,string);
		ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "{A0A0A0}Líderes das Organizações", gs_Buffer, "Fechar","");
		return true;
		//return ShowPlayerDialog(playerid, 8724, DIALOG_STYLE_TABLIST_HEADERS, "Líderes das Organizações", gs_Buffer, "Fechar", "");
	}
iLinuxOficiaL is offline   Reply With Quote
Old 13/11/2018, 01:56 PM   #2
ipsLuan
High-roller
 
ipsLuan's Avatar
 
Join Date: Feb 2013
Location: Ilhéus, BA
Posts: 4,548
Reputation: 332
Default Re: Checar Online/Offline Líder

PHP Code:
player_IsConnected(playername[]) {
    static 
string[25], i;
    for(
GetMaxPlayers() - 1> -1; --i) {
        if(
IsPlayerConnected(i)) {
            
GetPlayerName(istringsizeof string);
            if(!
strcmp(playernamestringfalse)) {
                return 
true;
            }
        }
    }
    return 
false;
}

if(
player_IsConnected(InfoOrg[9][Lider])) {
    
//online
}
else {
    
//ofline

__________________
Precisando de algum sistema? Me contate.
ipsLuan is offline   Reply With Quote
Old 13/11/2018, 01:59 PM   #3
iLinuxOficiaL
Little Clucker
 
Join Date: Jan 2017
Location: qZMg1jN9Lt0=
Posts: 33
Reputation: 3
Default Re: Checar Online/Offline Líder

Quote:
Originally Posted by ipsLuan View Post
PHP Code:
player_IsConnected(playername[]) {
    static 
string[25], i;
    for(
GetMaxPlayers() - 1> -1; --i) {
        if(
IsPlayerConnected(i)) {
            
GetPlayerName(istringsizeof string);
            if(!
strcmp(playernamestringfalse)) {
                return 
true;
            }
        }
    }
    return 
false;
}

if(
player_IsConnected(InfoOrg[9][Lider])) {
    
//online
}
else {
    
//ofline

Não Expliquei muito bem, mas tipo o que eu tava tentando falar é que Tipo Ao Lado do Nome do Lider uma Mensagem dizendo se ele está "Online ou Onffline"
iLinuxOficiaL is offline   Reply With Quote
Old 13/11/2018, 02:01 PM   #4
ipsLuan
High-roller
 
ipsLuan's Avatar
 
Join Date: Feb 2013
Location: Ilhéus, BA
Posts: 4,548
Reputation: 332
Default Re: Checar Online/Offline Líder

Aí você precisa fazer a verificação com operação ternária.

PHP Code:
if(player_IsConnected(InfoOrg[9][Lider])) : online offline 
__________________
Precisando de algum sistema? Me contate.
ipsLuan is offline   Reply With Quote
Old 13/11/2018, 05:51 PM   #5
RazorGuigo
Banned
 
Join Date: May 2016
Location: South is my Country
Posts: 1,137
Reputation: 104
Default Re: Checar Online/Offline Líder

Utilize o parametro U do sscanf, é a maneira mais otimizada de fazer isso, e mais simples tambem!
RazorGuigo 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
ID 8 is offline but is actually online. WhateverRP Scripting Help 0 11/02/2017 04:22 PM
[PHP] Help Online and Offline Tween73 Scripting Help 4 14/03/2016 02:13 PM
[Ajuda] BUG importante ao dar sub-líder o sub-líder vira líder ? ScripterInicianteBR Português/Portuguese 18 28/01/2015 12:10 AM
[Ajuda] Checar se seu servidor de SA:MP está online! Breno Da Silva Pereira Português/Portuguese 2 02/03/2014 11:04 AM
[Ajuda] Sistema de demitir lider offline lukas_loky Português/Portuguese 11 06/12/2012 09:05 PM


All times are GMT. The time now is 02:43 AM.


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