[Ajuda] Alguem Ajuda?
#1

Esse comando /m Fala amarelo como Policial eu queria saber porque eu digito varias palavras e so aparece uma?

abaixo code:

Код:
	if(strcmp(cmd, "/m", true) == 0 || strcmp(cmd, "/megaphone", true) == 0)
	{

        tmp = strtok(cmdtext, idx);
		GetPlayerName(playerid, sendername, sizeof(sendername));
		PlayerInfo[playerid][pGDE] = dini_Int(udb_encode(sendername), "levelgde");
 		if (!strlen(tmp) && PlayerInfo[playerid][pGDE] >= 1)
 		  		{
			SendClientMessage(playerid, COLOR_DBLUE, "Uso correto: /m [mensagem]");
 			return 1;
      	}
		if(logged[playerid] == 1)
		{
			if(PlayerInfo[playerid][pGDE] >= 1 || PlayerInfo[playerid][pBOPE] >= 1 || PlayerInfo[playerid][pPMLV] >= 1 || PlayerInfo[playerid][pPMSF] >= 1 || PlayerInfo[playerid][pChoque] >= 1 || PlayerInfo[playerid][pRodoviaria] >= 1)
			{
				for(new i=0; i <= MAX_PLAYERS; i++)
				if(GetDistanceBetweenPlayers(playerid, i) <= 50)
				{
				format(string, sizeof(string), "Polнcial %s: %s", sendername, tmp);
                SendClientMessage(i,COLOR_YELLOW,string);
				new PlayerName[30];
	 			GetPlayerName(playerid, PlayerName, 30);
				printf("[Command] %s usou /m com a menssagem: %s", PlayerName, tmp);
 		 		}

			}
	 		else
	  		{
				SendClientMessage(playerid, COLOR_RED, "Vocк nгo й um oficial!");
			}
		}
		else
		{
		    SendClientMessage(playerid, COLOR_RED, "Vocк tem que estar logado para usar este comando!");
		}
        return 1;
	}
Reply
#2

pawn Код:
if(strcmp(cmd, "/m", true) == 0 || strcmp(cmd, "/megaphone", true) == 0)
    {
        new string[500];
        tmp = strtok(cmdtext, idx);
        GetPlayerName(playerid, sendername, sizeof(sendername));
        PlayerInfo[playerid][pGDE] = dini_Int(udb_encode(sendername), "levelgde");
        if (!strlen(tmp) && PlayerInfo[playerid][pGDE] >= 1)
                {
            SendClientMessage(playerid, COLOR_DBLUE, "Uso correto: /m [mensagem]");
            return 1;
        }
        if(logged[playerid] == 1)
        {
            if(PlayerInfo[playerid][pGDE] >= 1 || PlayerInfo[playerid][pBOPE] >= 1 || PlayerInfo[playerid][pPMLV] >= 1 || PlayerInfo[playerid][pPMSF] >= 1 || PlayerInfo[playerid][pChoque] >= 1 || PlayerInfo[playerid][pRodoviaria] >= 1)
            {
                for(new i=0; i <= MAX_PLAYERS; i++)
                if(GetDistanceBetweenPlayers(playerid, i) <= 50)
                {
                format(string, sizeof(string), "Polнcial %s: %s", sendername, tmp);
                SendClientMessage(i,COLOR_YELLOW,string);
                new PlayerName[30];
                GetPlayerName(playerid, PlayerName, 30);
                printf("[Command] %s usou /m com a menssagem: %s", PlayerName, tmp);
                }

            }
            else
            {
                SendClientMessage(playerid, COLOR_RED, "Vocк nгo й um oficial!");
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "Vocк tem que estar logado para usar este comando!");
        }
        return 1;
    }
Reply
#3

Quote:
Originally Posted by s4kuL
Посмотреть сообщение
pawn Код:
if(strcmp(cmd, "/m", true) == 0 || strcmp(cmd, "/megaphone", true) == 0)
    {
        new string[500];
        tmp = strtok(cmdtext, idx);
        GetPlayerName(playerid, sendername, sizeof(sendername));
        PlayerInfo[playerid][pGDE] = dini_Int(udb_encode(sendername), "levelgde");
        if (!strlen(tmp) && PlayerInfo[playerid][pGDE] >= 1)
                {
            SendClientMessage(playerid, COLOR_DBLUE, "Uso correto: /m [mensagem]");
            return 1;
        }
        if(logged[playerid] == 1)
        {
            if(PlayerInfo[playerid][pGDE] >= 1 || PlayerInfo[playerid][pBOPE] >= 1 || PlayerInfo[playerid][pPMLV] >= 1 || PlayerInfo[playerid][pPMSF] >= 1 || PlayerInfo[playerid][pChoque] >= 1 || PlayerInfo[playerid][pRodoviaria] >= 1)
            {
                for(new i=0; i <= MAX_PLAYERS; i++)
                if(GetDistanceBetweenPlayers(playerid, i) <= 50)
                {
                format(string, sizeof(string), "Polнcial %s: %s", sendername, tmp);
                SendClientMessage(i,COLOR_YELLOW,string);
                new PlayerName[30];
                GetPlayerName(playerid, PlayerName, 30);
                printf("[Command] %s usou /m com a menssagem: %s", PlayerName, tmp);
                }

            }
            else
            {
                SendClientMessage(playerid, COLOR_RED, "Vocк nгo й um oficial!");
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "Vocк tem que estar logado para usar este comando!");
        }
        return 1;
    }
Deu esse erro ao compilar:

C:\Users\Familia\Desktop\admintestm.pwn(6045) : warning 219: local variable "string" shadows a variable at a preceding level

Linha (6045) : new string[500];
Reply
#4

PHP код:
    if(strcmp(cmd"/megafone"true) == || strcmp(cmd"/m"true) == 0)
    {
        if(
PlayerInfo[playerid][pMuted] == 1)
        {
            
SendClientMessage(playeridTEAM_CYAN_COLOR"Vocк nгo pode falar, pois foi calado");
            return 
true;
        }
        if(
IsPlayerConnected(playerid))
        {
            if(!
IsACop(playerid))
            {
                
SendClientMessage(playeridCOLOR_GREY"   Vocк nгo й um policial!");
                return 
true;
            }
            if(
OnDuty[playerid] != 1)
            {
                
SendClientMessage(playeridCOLOR_GREY"   Vocк nгo Bateu o cartгo!");
                return 
true;
            }
            
GetPlayerName(playeridsendernamesizeof(sendername));
            new 
length strlen(cmdtext);
            while ((
idx length) && (cmdtext[idx] <= ' '))
            {
                
idx++;
            }
            new 
offset idx;
            new 
result[64];
            while ((
idx length) && ((idx offset) < (sizeof(result) - 1)))
            {
                
result[idx offset] = cmdtext[idx];
                
idx++;
            }
            
result[idx offset] = EOS;
            if(!
strlen(result))
            {
                
SendClientMessage(playeridCOLOR_GRAD2"USE: (/m)egafone [phone chat]");
                return 
true;
            }
            if(
gTeam[playerid] == || IsACop(playerid))
            {
                if(
PlayerInfo[playerid][pMembro] == 1||PlayerInfo[playerid][pLider] == 1)
                {
                    
format(stringsizeof(string), "Policial Militar %s:o< %s"sendernameresult);
                    
ProxDetector(60.0playeridstring,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
                }
                else if(
PlayerInfo[playerid][pMembro] == 2||PlayerInfo[playerid][pLider] == 2)
                {
                    
format(stringsizeof(string), "B.O.P.E %s:o< %s"sendernameresult);
                    
ProxDetector(60.0playeridstring,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
                }
                else if(
PlayerInfo[playerid][pMembro] == 3||PlayerInfo[playerid][pLider] == 3)
                {
                    
format(stringsizeof(string), "Exйrcito %s:o< %s"sendernameresult);
                    
ProxDetector(60.0playeridstring,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
                }
                else if(
IsAGOV(playerid))
                {
                    
format(stringsizeof(string), "Governo %s:o< %s"sendernameresult);
                    
ProxDetector(60.0playeridstring,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
                }
                else if(
PlayerInfo[playerid][pMembro] == 16||PlayerInfo[playerid][pLider] == 16)
                {
                    
format(stringsizeof(string), "Policia Civil %s:o< %s"sendernameresult);
                    
ProxDetector(60.0playeridstring,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
                }
                else if(
PlayerInfo[playerid][pMembro] == 11||PlayerInfo[playerid][pLider] == 11)
                {
                    
format(stringsizeof(string), "Policia Federal %s:o< %s"sendernameresult);
                    
ProxDetector(60.0playeridstring,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
                }
                
printf("%s"string);
            }
            else
            {
                
SendClientMessage(playeridCOLOR_GRAD2"   Vocк nгo faz parte de nenhuma equipe !");
                return 
true;
            }
        }
        return 
true;
    } 
Reply
#5

Quote:
Originally Posted by Lucas_Rocha
Посмотреть сообщение
PHP код:
    if(strcmp(cmd"/megafone"true) == || strcmp(cmd"/m"true) == 0)
    {
        if(
PlayerInfo[playerid][pMuted] == 1)
        {
            
SendClientMessage(playeridTEAM_CYAN_COLOR"Vocк nгo pode falar, pois foi calado");
            return 
true;
        }
        if(
IsPlayerConnected(playerid))
        {
            if(!
IsACop(playerid))
            {
                
SendClientMessage(playeridCOLOR_GREY"   Vocк nгo й um policial!");
                return 
true;
            }
            if(
OnDuty[playerid] != 1)
            {
                
SendClientMessage(playeridCOLOR_GREY"   Vocк nгo Bateu o cartгo!");
                return 
true;
            }
            
GetPlayerName(playeridsendernamesizeof(sendername));
            new 
length strlen(cmdtext);
            while ((
idx length) && (cmdtext[idx] <= ' '))
            {
                
idx++;
            }
            new 
offset idx;
            new 
result[64];
            while ((
idx length) && ((idx offset) < (sizeof(result) - 1)))
            {
                
result[idx offset] = cmdtext[idx];
                
idx++;
            }
            
result[idx offset] = EOS;
            if(!
strlen(result))
            {
                
SendClientMessage(playeridCOLOR_GRAD2"USE: (/m)egafone [phone chat]");
                return 
true;
            }
            if(
gTeam[playerid] == || IsACop(playerid))
            {
                if(
PlayerInfo[playerid][pMembro] == 1||PlayerInfo[playerid][pLider] == 1)
                {
                    
format(stringsizeof(string), "Policial Militar %s:o< %s"sendernameresult);
                    
ProxDetector(60.0playeridstring,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
                }
                else if(
PlayerInfo[playerid][pMembro] == 2||PlayerInfo[playerid][pLider] == 2)
                {
                    
format(stringsizeof(string), "B.O.P.E %s:o< %s"sendernameresult);
                    
ProxDetector(60.0playeridstring,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
                }
                else if(
PlayerInfo[playerid][pMembro] == 3||PlayerInfo[playerid][pLider] == 3)
                {
                    
format(stringsizeof(string), "Exйrcito %s:o< %s"sendernameresult);
                    
ProxDetector(60.0playeridstring,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
                }
                else if(
IsAGOV(playerid))
                {
                    
format(stringsizeof(string), "Governo %s:o< %s"sendernameresult);
                    
ProxDetector(60.0playeridstring,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
                }
                else if(
PlayerInfo[playerid][pMembro] == 16||PlayerInfo[playerid][pLider] == 16)
                {
                    
format(stringsizeof(string), "Policia Civil %s:o< %s"sendernameresult);
                    
ProxDetector(60.0playeridstring,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
                }
                else if(
PlayerInfo[playerid][pMembro] == 11||PlayerInfo[playerid][pLider] == 11)
                {
                    
format(stringsizeof(string), "Policia Federal %s:o< %s"sendernameresult);
                    
ProxDetector(60.0playeridstring,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
                }
                
printf("%s"string);
            }
            else
            {
                
SendClientMessage(playeridCOLOR_GRAD2"   Vocк nгo faz parte de nenhuma equipe !");
                return 
true;
            }
        }
        return 
true;
    } 
Nгo consegui alguem ajuda?? nгo conseguir ageita essa pro meu gm deu uns warnings, alguem ajuda o meu q da ta com problema que quando digita aparece so 1 palavra
Reply
#6

up '-'
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)