SA-MP Forums Archive
[Ajuda] Sem funзгo! - 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: [Ajuda] Sem funзгo! (/showthread.php?tid=602921)



Sem funзгo! - ThuuGLif3 - 15.03.2016

Код:
	if(!strcmp(cmd, "/remover", true))
	{
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp))
		{
			SendClientMessage(playerid, COR_AMARELO, "Opзхes: (Tapete)");
			SendClientMessage(playerid, COR_ERRO, "Uso vбlido: /Criar [Opзгo]");
			return 1;
		}
		if(!strcmp(tmp, "tapete", true))
		{
			if(pInfo[playerid][Prof] == POL_CIVIL || pInfo[playerid][Prof] == POL_MILITAR || pInfo[playerid][Prof] == POL_FEDERAL || aInfo[playerid][Admin] == 1)
			{
				if(pInfo[playerid][fardado] == 0 && aInfo[playerid][Admin] == 0)
				{
					SendClientMessage(playerid, COR_ERRO, "Vocк nгo estб fardado(a)!");
					SendClientMessage(playerid, COR_ERRO, "Vocк precisa estб fardado(a) para usar este comando!");
					return 1;
				}
				SendClientMessage(playerid, COR_AZULCLARO, "Tapete removido com sucesso!");
				DeleteClosestStrip(playerid);
			}
			else if(!strcmp(tmp, "itens", true))
			{
				if(!IsPlayerInDynamicCP(playerid, CP_5) &&
				!IsPlayerInDynamicCP(playerid, CP_41) &&
				!IsPlayerInDynamicCP(playerid, CP_42) &&
				!IsPlayerInDynamicCP(playerid, CP_43) &&
				!IsPlayerInDynamicCP(playerid, CP_44) &&
				!IsPlayerInDynamicCP(playerid, CP_45))
				{
					SendClientMessage(playerid, COR_ERRO, "Vocк nгo estб em uma loja de roupas!");
					return 1;
				}
				RemovePlayerAttachedObject(playerid, 1);
				WE_SetInt(f(playerid), "useOculos", 0);
				RemovePlayerAttachedObject(playerid, 2);
				WE_SetInt(f(playerid), "useMascara", 0);
				RemovePlayerAttachedObject(playerid, 4);
				WE_SetInt(f(playerid), "useChapeu", 0);
				SetarItensPlayer(playerid);
				SendClientMessage(playerid, COR_AMARELO, "Todos seus itens foram removidos.");
			}
		}
		return 1;
	}
Nгo esta funcionando o comando /remover itens.
Apenas o /remover tapete.

Poderiam me ajudar com a correзгo e uma explicaзгo do que foi feito?


Re: Sem funзгo! - ViniBorn - 15.03.2016

Porque no comando de remover tem essa funзгo?

SetarItensPlayer(playerid);


Re: Sem funзгo! - ThuuGLif3 - 15.03.2016

Й apenas um nome da stock.

Quando й digitado /remover itens, nгo aparece nada, nem a mensagem que foi removido. Agora quando й digitado /remover tapete, remove o tapete e aparece a mensagem de boa...

Tenho certeza que os problemas estгo por aqui:

Код:
			}
		}
		return 1;
	}



Re: Sem funзгo! - ViniBorn - 15.03.2016

WE_SetInt(f(playerid), "useOculos", 0);

esse f antes de (playerid) й normal?

Vale a pena fazer um debug, pode ser que esteja saindo do cуdigo antes de executб-lo...


Re: Sem funзгo! - ThuuGLif3 - 15.03.2016

Quote:
Originally Posted by ViniBorn
Посмотреть сообщение
WE_SetInt(f(playerid), "useOculos", 0);

esse f antes de (playerid) й normal?

Vale a pena fazer um debug, pode ser que esteja saindo do cуdigo antes de executб-lo...
Sim, o cуdigo funciona no /removeritens. Porйm, fiz uma adaptaзгo para usar-lo apenas em um comando..
Adicionei 2 comandos em 1, no caso o remover iria funcionar para remover os itens dos jogadores e remover o tapete policial...


Re: Sem funзгo! - Standby - 15.03.2016

pawn Код:
if(!strcmp(cmd, "/remover", true))
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COR_AMARELO, "Opзхes: (Tapete)");
            SendClientMessage(playerid, COR_ERRO, "Uso vбlido: /Criar [Opзгo]");
            return 1;
        }
        if(!strcmp(tmp, "tapete", true))
        {
            if(pInfo[playerid][Prof] == POL_CIVIL || pInfo[playerid][Prof] == POL_MILITAR || pInfo[playerid][Prof] == POL_FEDERAL || aInfo[playerid][Admin] == 1)
            {
                if(pInfo[playerid][fardado] == 0 && aInfo[playerid][Admin] == 0)
                {
                    SendClientMessage(playerid, COR_ERRO, "Vocк nгo estб fardado(a)!");
                    SendClientMessage(playerid, COR_ERRO, "Vocк precisa estб fardado(a) para usar este comando!");
                    return 1;
                }
                SendClientMessage(playerid, COR_AZULCLARO, "Tapete removido com sucesso!");
                DeleteClosestStrip(playerid);
             }
    }
            else if(!strcmp(tmp, "itens", true))
            {
                if(!IsPlayerInDynamicCP(playerid, CP_5) &&
                !IsPlayerInDynamicCP(playerid, CP_41) &&
                !IsPlayerInDynamicCP(playerid, CP_42) &&
                !IsPlayerInDynamicCP(playerid, CP_43) &&
                !IsPlayerInDynamicCP(playerid, CP_44) &&
                !IsPlayerInDynamicCP(playerid, CP_45))
               
                {
                    SendClientMessage(playerid, COR_ERRO, "Vocк nгo estб em uma loja de roupas!");
                    return 1;
                }
                RemovePlayerAttachedObject(playerid, 1);
                WE_SetInt(f(playerid), "useOculos", 0);
                RemovePlayerAttachedObject(playerid, 2);
                WE_SetInt(f(playerid), "useMascara", 0);
                RemovePlayerAttachedObject(playerid, 4);
                WE_SetInt(f(playerid), "useChapeu", 0);
                SetarItensPlayer(playerid);
                SendClientMessage(playerid, COR_AMARELO, "Todos seus itens foram removidos.");
            }
         return 1;
        }



Re: Sem funзгo! - ThuuGLif3 - 16.03.2016

Jб havia testado dessa forma, nгo funciona. Enfim, pode deixar...