[Ajuda] Bug no sistema de Clan
#4

Quote:
Originally Posted by PT
Посмотреть сообщение
qual o comando de criar cla e deletar?
Criar
Код:
	if( !strcmp( cmd, "/excluircla", true ))
	{
		if( in_z[ playerid ] != -1 )
		{
		    SendClientMessage( playerid, COLOR_ERRO, "[ x ] Vocк sу pode utilizar comandos de clг fora das Gangue Zones !" );
		    return 1;
		}
		if( !strcmp( playerClan[ playerid ], "Nenhum", true ))
  		{
  		    SendClientMessage( playerid, COLOR_ERRO, "[ x ] Vocк nгo percente a nenhum(a) Clг / Gangue !" );
  		    return 1;
  		}
		format( gFile, sizeof( gFile ), "clas/%s.ini", playerClan[ playerid ] );
		if( strcmp( dini_Get( gFile, "Dono" ), PlayerName( playerid ), false ))
		{
  			format( gstring, sizeof( gstring ), "[ x ] Vocк nгo й dono(a) do Clг / Gangue %s, somente o(a) dono(a) pode exclui-lo(a) !", playerClan[ playerid ] );
	    	SendClientMessage( playerid, COLOR_ERRO, gstring );
	    	return 1;
		}
		new
			m_id[ 24 ],
			n_m[ 128 ]
		;
		for( new m = 1; m < 31; ++m )
		{
		    format( m_id, 24, "Membro%d", m );

	    	if( strcmp( dini_Get( gFile, m_id ), "Ninguem", false ))
	    	{
	    	    format( n_m, 128, "clas/%s.ini", dini_Get( gFile, m_id ));
	    	    if( fexist( n_m ))
				{
					fremove( n_m );
				}
	    	}
	    }
		format( gStr, sizeof( gStr ), "[ > ] Clг / Gangue {00FFFF}%s{FFFFFF} excluнdo !", playerClan[ playerid ] );
		SendClientMessage( playerid, COLOR_BRANCO, gStr );
		format( gstring, sizeof( gstring ), "[ > ] %s acaba de (fechar / excluнr) o(a) Clг / Gangue {00FFFF}%s", PlayerName( playerid ), playerClan[ playerid ] );
		SendClientMessageToAll( COLOR_BRANCO, gstring );
		format( gStr, 128, "~r~~h~Cla / Gangue~n~~w~%s~n~~r~~h~excluido com sucesso!", playerClan[ playerid ] );
		GameTextForPlayer( playerid, gStr, 5000, 15 );
		foreach(Player, c)
		{
		    if( c != playerid && !strcmp( playerClan[ c ], playerClan[ playerid ], true ))
		    {
		    	format( playerClan[ c ], MAX_PLAYER_NAME+1, "Nenhum" );
	  			clanColor[ c ] = -1;
	  			
		  		format( gStr, 128, "~r~~h~Cla / Gangue~n~~w~%s~n~~r~~h~excluido !", playerClan[ playerid ] );
				GameTextForPlayer( c, gStr, 5000, 15 );

				format( gstring, sizeof( gstring ), "[ > ] %s lнder do Clг / Gangue %s que vocк era membro, excluнo o Clг / Gangue.", PlayerName( playerid ), playerClan[ playerid ] );
				SendClientMessage( c, COLOR_AMARELO, gstring );
			}
		}
		format( playerClan[ playerid ], MAX_PLAYER_NAME+1, "Nenhum" );
		clanColor[ playerid ] = -1;
		fremove( gFile );
		format( gStr, 128, "clas/%s.ini", PlayerName( playerid ));
  		fremove( gStr );
	    return 1;
	}
Код:
	if( !strcmp( cmd, "/criarcla", true ))
	{
		if( in_z[ playerid ] != -1 )
		{
		    SendClientMessage( playerid, COLOR_ERRO, "[ x ] Vocк sу pode utilizar comandos de clг fora das Gangue Zones !" );
		    return 1;
		}
	    if( LiberadoGG[ playerid ] == 0 )
	    {
	        SendClientMessage( playerid, COLOR_ERRO, "[ x ] Vocк precisa da permissгo de um(a) adminstrador(a) para criar um(a) Clг / Gangue !" );
	        SendClientMessage( playerid, COLOR_ERRO, "[ x ] Vocк tambйm precisa ter $10000 em mгos." );
	        return 1;
		}
		if( GetPlayerCash( playerid ) < 10000 )
		{
		    SendClientMessage( playerid, COLOR_ERRO, "[ x ] Vocк precisa de $10000 para poder criar um clг !" );
		    return 1;
		}
		if( strcmp( playerClan[ playerid ], "Nenhum", false ))
  		{
  		    format( gStr, 128, "[ x ] Vocк jб percente ao Clг / Gangue dos(as) %s !", playerClan[ playerid ] );
  		    SendClientMessage( playerid, COLOR_ERRO, gStr );
  		    return 1;
  		}
		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( playerid, COLOR_ERRO, "[ x ] Uso correto: /CriarCla [ Clг / Gangue NOME ]" );
	      	return 1;
	  	}
 	 	if( strlen( result ) > 24 )
		{
	      	SendClientMessage( playerid, COLOR_ERRO, "[ x ] O mбximo de caracteres permitido й 24 !" );
	      	SendClientMessage( playerid, COLOR_ERRO, "[ x ] Escolha um nome menor para seu Clг / Gangue !" );
	      	return 1;
	  	}
	  	if( !IsValidNickCla( result ))
        {
            SendClientMessage( playerid, COLOR_ERRO, "[ x ] Vocк utilizou caracteres invбlido / especiais !" );
            SendClientMessage( playerid, COLOR_ERRO, "[ x ] Escolha um nome com caracteres comuns !" );
			return 1;
		}
	  	format( gFile, sizeof( gFile ), "clas/%s.ini", result );
		if( !fexist( gFile ))
		{
			dini_Create( gFile );
			dini_Set( gFile, "Dono", PlayerName( playerid ));
			dini_IntSet( gFile, "Color", -1 );
			new
			    m_id[ 24 ]
			;
			for( new m = 1; m < 31; ++m )
			{
			    format( m_id, 24, "Membro%d", m );
			    dini_Set( gFile, m_id, "Ninguem" );
			}
		}
		else
		{
		    format( gStr, 128, "[ x ] %s й um(a) Clг / Gangue jб existente !", result );
			SendClientMessage( playerid, COLOR_ERRO, gStr );
			SendClientMessage( playerid, COLOR_ERRO, "[ x ] Defina outro nome para seu Clг / Gangue." );
			return 1;
		}
		format( pFile, 128, "clas/%s.ini", PlayerName( playerid ));
  	  	if( fexist( pFile ))
	  	{
	  	    fremove( pFile );
			dini_Create( pFile );
	  	    dini_Set( pFile, "cla", result );
	  	}
	  	else
	  	{
			dini_Create( pFile );
	  	    dini_Set( pFile, "cla", result );
	  	}
	  	format( playerClan[ playerid ], MAX_PLAYER_NAME+1, result );
	  	clanColor[ playerid ] = -1;
	  	
		format( gStr, sizeof( gStr ), "[ > ] Clг / Gangue {FFFFFF}%s{FFFF00} criado(a).", result );
		SendClientMessage( playerid, COLOR_AMARELO, gStr );
		format( gStr, 128, "~r~~h~Cla / Gangue~n~~w~%s~n~~b~~h~Criado com sucesso!", result );
		GameTextForPlayer( playerid, gStr, 5000, 15 );
        sGivePlayerCash( playerid, -10000 );
		format( gstring, sizeof( gstring ), "[ > ] %s acaba de fundar o(a) Clг / Gangue {FFFF00}%s", PlayerName( playerid ), result );
		SendClientMessageToAll( COLOR_BRANCO, gstring );
	  	return 1;
	}
Reply


Messages In This Thread
Bug no sistema de Clan - by leonardoaparecido - 15.09.2013, 00:44
Re: Bug no sistema de Clan - by PT - 15.09.2013, 01:19
Re: Bug no sistema de Clan - by Schocc - 15.09.2013, 01:28
Re: Bug no sistema de Clan - by leonardoaparecido - 15.09.2013, 01:29

Forum Jump:


Users browsing this thread: 1 Guest(s)